Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 1184383002: DevTools: adopt FilmStripModel to new screenshot recorder trace format (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: get rid of callback in createFrameElement() Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 */ 1317 */
1318 WebInspector.TimelineUIUtils.generateDetailsContentForFrame = function(frameMode l, frame, filmStripFrame) 1318 WebInspector.TimelineUIUtils.generateDetailsContentForFrame = function(frameMode l, frame, filmStripFrame)
1319 { 1319 {
1320 var durationInMillis = frame.endTime - frame.startTime; 1320 var durationInMillis = frame.endTime - frame.startTime;
1321 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true), 1321 var durationText = WebInspector.UIString("%s (at %s)", Number.millisToString (frame.endTime - frame.startTime, true),
1322 Number.millisToString(frame.startTimeOffset, true)); 1322 Number.millisToString(frame.startTimeOffset, true));
1323 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(frame.timeByCat egory); 1323 var pieChart = WebInspector.TimelineUIUtils.generatePieChart(frame.timeByCat egory);
1324 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null , null, true); 1324 var contentHelper = new WebInspector.TimelineDetailsContentHelper(null, null , null, true);
1325 if (filmStripFrame) { 1325 if (filmStripFrame) {
1326 var filmStripPreview = createElementWithClass("img", "timeline-filmstrip -preview"); 1326 var filmStripPreview = createElementWithClass("img", "timeline-filmstrip -preview");
1327 filmStripPreview.src = "data:image/jpg;base64," + filmStripFrame.imageDa ta; 1327 filmStripFrame.imageDataPromise().then(onGotImageData.bind(null, filmStr ipPreview));
1328 contentHelper.appendElementRow(WebInspector.UIString("Screenshot"), film StripPreview); 1328 contentHelper.appendElementRow(WebInspector.UIString("Screenshot"), film StripPreview);
1329 filmStripPreview.addEventListener("click", filmStripClicked.bind(null, f ilmStripFrame), false); 1329 filmStripPreview.addEventListener("click", filmStripClicked.bind(null, f ilmStripFrame), false);
1330 } 1330 }
1331 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ; 1331 contentHelper.appendTextRow(WebInspector.UIString("Duration"), durationText) ;
1332 contentHelper.appendTextRow(WebInspector.UIString("FPS"), Math.floor(1000 / durationInMillis)); 1332 contentHelper.appendTextRow(WebInspector.UIString("FPS"), Math.floor(1000 / durationInMillis));
1333 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(frame.cpuTime, true)); 1333 contentHelper.appendTextRow(WebInspector.UIString("CPU time"), Number.millis ToString(frame.cpuTime, true));
1334 contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"), pie Chart); 1334 contentHelper.appendElementRow(WebInspector.UIString("Aggregated Time"), pie Chart);
1335 if (Runtime.experiments.isEnabled("layersPanel") && frame.layerTree) { 1335 if (Runtime.experiments.isEnabled("layersPanel") && frame.layerTree) {
1336 contentHelper.appendElementRow(WebInspector.UIString("Layer tree"), 1336 contentHelper.appendElementRow(WebInspector.UIString("Layer tree"),
1337 WebInspector.Linkifier.linkifyUsingReveal er(frame.layerTree, WebInspector.UIString("show"))); 1337 WebInspector.Linkifier.linkifyUsingReveal er(frame.layerTree, WebInspector.UIString("show")));
1338 } 1338 }
1339 1339
1340 /** 1340 /**
1341 * @param {!Element} image
1342 * @param {?string} data
1343 */
1344 function onGotImageData(image, data)
1345 {
1346 if (data)
1347 image.src = "data:image/jpg;base64," + data;
1348 }
1349
1350 /**
1341 * @param {!WebInspector.FilmStripModel.Frame} filmStripFrame 1351 * @param {!WebInspector.FilmStripModel.Frame} filmStripFrame
1342 */ 1352 */
1343 function filmStripClicked(filmStripFrame) 1353 function filmStripClicked(filmStripFrame)
1344 { 1354 {
1345 WebInspector.Dialog.show(null, new WebInspector.FilmStripView.DialogDele gate(filmStripFrame, 0)); 1355 WebInspector.Dialog.show(null, new WebInspector.FilmStripView.DialogDele gate(filmStripFrame, 0));
1346 } 1356 }
1347 1357
1348 return contentHelper.element; 1358 return contentHelper.element;
1349 } 1359 }
1350 1360
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 return; 1901 return;
1892 1902
1893 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace monospace"); 1903 var stackTraceElement = parentElement.createChild("div", "timeline-detai ls-view-row-value timeline-details-view-row-stack-trace monospace");
1894 1904
1895 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace); 1905 var callFrameElem = WebInspector.DOMPresentationUtils.buildStackTracePre viewContents(this._target, this._linkifier, stackTrace);
1896 1906
1897 stackTraceElement.appendChild(callFrameElem); 1907 stackTraceElement.appendChild(callFrameElem);
1898 } 1908 }
1899 1909
1900 } 1910 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698