List of usage examples for com.google.gwt.coreext.client JSOArray get
public final native T get(int index) ;
From source file:com.google.speedtracer.client.CompactGwtSymbolMapParser.java
License:Apache License
private void definePackage(JSOArray<String> symbolInfo) { packageMap.put(symbolInfo.get(2), symbolInfo.get(1)); }
From source file:com.google.speedtracer.client.CompactGwtSymbolMapParser.java
License:Apache License
private void processLine(String line) { if (line.charAt(0) == '#') { return;//from w w w .ja 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.CompactGwtSymbolMapParser.java
License:Apache License
private void processSymbol(JSOArray<String> symbolInfo) { String jsName = symbolInfo.get(0); String packageKey = symbolInfo.get(2); String className = symbolInfo.get(3); String memberName = symbolInfo.get(4); String fileName = symbolInfo.get(5); String sourceLine = symbolInfo.get(6); if ("%".equals(fileName)) { fileName = className;/*from w w w . j a v a2 s .c o m*/ } String packageName = packageMap.get(packageKey); assert (packageName != null); packageName = "".equals(packageName) ? "" : packageName + "."; fileName = "".equals(fileName) ? "Unknown" : fileName + ".java"; // The path relative to the source server. We assume it is just the class // path base. String sourcePathBase = packageName.replace(".", "/"); String sourceSymbolName = packageName + className + "::" + memberName; JsSymbol sourceSymbol = new JsSymbol(new Url(sourcePathBase + fileName), Integer.parseInt(sourceLine), sourceSymbolName, false, fileName); symbolMap.put(jsName, sourceSymbol); }
From source file:com.google.speedtracer.client.GwtSymbolMapParser.java
License:Apache License
private void processLine(String line) { if (line.charAt(0) == '#') { return;/* w w w .j ava 2 s .co m*/ } 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.AppStatsServerEvent.java
License:Apache License
private static JSOArray<UiEvent> toServerEvents(JSOArray<ApiEvent> apiEvents, double startTime) { final JSOArray<UiEvent> uiEvents = JSOArray.create(); for (int i = 0, n = apiEvents.size(); i < n; ++i) { final ApiEvent apiEvent = apiEvents.get(i); uiEvents.push(ServerEvent.create(ServerEvent.TYPE, startTime + apiEvent.getStartTimeOffset(), apiEvent.getDuration(), ServerEvent.createDataBag(createLabel(apiEvent), "API"), JSOArray.<UiEvent>create())); }//from w ww . j ava2 s . co m return uiEvents; }
From source file:com.google.speedtracer.client.model.HintRecord.java
License:Apache License
/** * Returns the most severe severity value found the list. * /* w ww . ja v a 2 s . c om*/ * @param hintRecords a list of Hintlet records to search. * @return the most severe severity value found in the list. */ public static int mostSevere(JSOArray<HintRecord> hintRecords) { int numRecs = hintRecords.size(); int maxSeverity = HintRecord.SEVERITY_INFO; for (int i = 0; i < numRecs; i++) { int severity = hintRecords.get(i).getSeverity(); if (severity < maxSeverity) { maxSeverity = severity; } } return maxSeverity; }
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);/* w w w . j a v a 2 s .c o m*/ } else { result.append(val); } result.append(" "); } return result.toString(); }
From source file:com.google.speedtracer.client.model.JavaScriptProfileModelV8Impl.java
License:Apache License
/** * Process a portion of the logLines array. If the workQueue is enabled, exit * early if the timeslice expires.//from w w w.j ava 2s . co m */ private void processLogLines(final UiEvent refRecord, final JSOArray<String> logLines, int currentLine) { final int logLinesLength = logLines.size(); for (; currentLine < logLinesLength; ++currentLine) { if (workQueue != null) { // Occasionally check to see if the time to run this chunk has expired. if ((currentLine % 10 == 0) && workQueue.isTimeSliceExpired()) { break; } } String logLine = logLines.get(currentLine); if (logDecompressor != null && logLine.length() > 0) { logLine = logDecompressor.decompressLogEntry(logLine); } JsArrayString decompressedLogLine = Csv.split(logLine); if (decompressedLogLine.length() > 0) { parseLogEntry(decompressedLogLine); } // force gc on processed log lines. logLines.set(currentLine, null); } if (currentLine < logLinesLength) { // Schedule this record to be the next thing run off the queue workQueue.prepend(new LogLineWorker(logLines, refRecord, currentLine)); } else { // All done! if (currentProfile.getProfile(JavaScriptProfile.PROFILE_TYPE_BOTTOM_UP) == null) { if (refRecord != null) { refRecord.setHasJavaScriptProfile(false); } } else { if (refRecord != null) { refRecord.setHasJavaScriptProfile(true); } } } }
From source file:com.google.speedtracer.client.model.NetworkEventDispatcher.java
License:Apache License
/** * @param identifier Resource ID// www .j av a 2 s.c om * @param url The redirect URL that we are using to match a redirect * candidate. */ private NetworkResource findAndRemoveRedirectCandidate(String identifier, String url) { // Look for it. JSOArray<NetworkResource> redirectCandidates = redirects.get(identifier); if (redirectCandidates == null) { return null; } for (int i = 0; i < redirectCandidates.size(); i++) { NetworkResource redirectCandidate = redirectCandidates.get(i); if (redirectCandidate.getUrl().equals(url)) { // Should not be a concurrent modification, since we now bail out of // the loop right after mutating the queue. redirectCandidates.splice(i, 1); return redirectCandidate; } } return null; }
From source file:com.google.speedtracer.client.model.SpringInsightServerEvent.java
License:Apache License
private static ServerEvent toServerEvent(NetworkResource resource, double traceStartTime, Frame frame) { final JSOArray<Frame> frames = frame.getChildren(); final JSOArray<UiEvent> events = JSOArray.create(); for (int i = 0, n = frames.size(); i < n; ++i) { events.push(toServerEvent(resource, traceStartTime, frames.get(i))); }/*from w w w .ja va 2 s . c o m*/ final double startTime = resource.getStartTime(); final Range range = frame.getRange(); final Operation operation = frame.getOperation(); return ServerEvent.create(EventRecordType.SERVER_EVENT, startTime + (range.getStart() - traceStartTime), range.getDuration(), ServerEvent.createDataBag(operation.getLabel(), operation.getType()), events); }