Example usage for com.google.gwt.coreext.client JSOArray splitString

List of usage examples for com.google.gwt.coreext.client JSOArray splitString

Introduction

In this page you can find the example usage for com.google.gwt.coreext.client JSOArray splitString.

Prototype

public static native JSOArray<String> splitString(String str, String regexp) ;

Source Link

Document

Invokes the native string split on a string and returns a JavaScript array.

Usage

From source file:com.google.speedtracer.client.CompactGwtSymbolMapParser.java

License:Apache License

private void processLine(String line) {
    if (line.charAt(0) == '#') {
        return;// w  w  w. j  a  v a  2 s .c o  m
    }

    JSOArray<String> symbolInfo = JSOArray.splitString(line, ",");
    if ("%%".equals(symbolInfo.get(0))) {
        definePackage(symbolInfo);
    } else {
        processSymbol(symbolInfo);
    }
}

From source file:com.google.speedtracer.client.GwtSymbolMapParser.java

License:Apache License

private void processLine(String line) {
    if (line.charAt(0) == '#') {
        return;//  www .ja  va  2s.  c  om
    }

    JSOArray<String> symbolInfo = JSOArray.splitString(line, ",");
    String jsName = symbolInfo.get(0);
    String className = symbolInfo.get(2);
    String memberName = symbolInfo.get(3);
    String fileName = symbolInfo.get(4);
    String sourceLine = symbolInfo.get(5);

    // The path relative to the source server. We assume it is just the class
    // path base.
    String sourcePath = className.replace('.', '/');
    int lastSlashIndex = sourcePath.lastIndexOf("/") + 1;
    String sourcePathBase = sourcePath.substring(0, lastSlashIndex);

    // The sourceUri contains the actual file name.
    String sourceFileName = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.length());

    String sourceSymbolName = className + "::" + memberName;

    JsSymbol sourceSymbol = new JsSymbol(new Url(sourcePathBase + sourceFileName), Integer.parseInt(sourceLine),
            sourceSymbolName, false, fileName);
    symbolMap.put(jsName, sourceSymbol);
}

From source file:com.google.speedtracer.client.model.JavaScriptProfileModel.java

License:Apache License

private String formatSymbolName(String symbolName) {
    JSOArray<String> vals = JSOArray.splitString(symbolName, " ");
    StringBuilder result = new StringBuilder();
    for (int i = 0, length = vals.size(); i < length; ++i) {
        String val = vals.get(i);
        if (val.startsWith("http://") || val.startsWith("https://") || val.startsWith("file://")
                || val.startsWith("chrome://") || val.startsWith("chrome-extension://")) {
            // Presenting the entire URL takes too much space. Just show the
            // last path component.
            String resource = val.substring(val.lastIndexOf("/") + 1);

            resource = "".equals(resource) ? val : resource;
            result.append(resource);/*from w w w.jav a 2 s  . c om*/
        } else {
            result.append(val);
        }
        result.append(" ");
    }
    return result.toString();
}

From source file:com.google.speedtracer.client.model.JavaScriptProfileModelV8Impl.java

License:Apache License

/**
 * Take a raw timeline record and convert it into a bottom up profile.
 * //from w  w  w.  j  a v  a  2  s . com
 * @param rawEvent a raw JSON timeline event of type EventType.PROFILE_DATA
 */
@Override
public void parseRawEvent(final JavaScriptProfileEvent rawEvent, final UiEvent refRecord,
        JavaScriptProfile profile) {
    assert rawEvent.getFormat().equals(FORMAT);
    String profileData = rawEvent.getProfileData();
    if (profileData == null || profileData.length() == 0) {
        if (refRecord != null) {
            refRecord.setHasJavaScriptProfile(false);
        }
        return;
    }

    if (workQueue == null) {
        // Process the event synchronously
        currentProfile = profile;
        JSOArray<String> logLines = JSOArray.splitString(rawEvent.getProfileData(), "\n");
        processLogLines(refRecord, logLines, 0);
    } else {
        // Process the log entries using a deferred command to keep from blocking
        // the UI thread.
        if (refRecord != null) {
            refRecord.setProcessingJavaScriptProfile();
        }
        workQueue.append(new NewProfileDataWorker(refRecord, profile, rawEvent));
    }
}