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

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

Issue 2852173002: DevTools: Show screenshots on the main flamechart (Closed)
Patch Set: addressing comments Created 3 years, 7 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
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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 * @param {!TimelineModel.TimelineFrame} frame 1562 * @param {!TimelineModel.TimelineFrame} frame
1563 * @param {?SDK.FilmStripModel.Frame} filmStripFrame 1563 * @param {?SDK.FilmStripModel.Frame} filmStripFrame
1564 * @return {!Element} 1564 * @return {!Element}
1565 */ 1565 */
1566 static generateDetailsContentForFrame(frame, filmStripFrame) { 1566 static generateDetailsContentForFrame(frame, filmStripFrame) {
1567 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null); 1567 var contentHelper = new Timeline.TimelineDetailsContentHelper(null, null);
1568 contentHelper.addSection(Common.UIString('Frame')); 1568 contentHelper.addSection(Common.UIString('Frame'));
1569 1569
1570 var duration = Timeline.TimelineUIUtils.frameDuration(frame); 1570 var duration = Timeline.TimelineUIUtils.frameDuration(frame);
1571 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame. hasWarnings()); 1571 contentHelper.appendElementRow(Common.UIString('Duration'), duration, frame. hasWarnings());
1572 var durationInMillis = frame.endTime - frame.startTime;
1573 contentHelper.appendTextRow(Common.UIString('FPS'), Math.floor(1000 / durati onInMillis));
1574 contentHelper.appendTextRow(Common.UIString('CPU time'), Number.millisToStri ng(frame.cpuTime, true));
1572 if (filmStripFrame) { 1575 if (filmStripFrame) {
1573 var filmStripPreview = createElementWithClass('img', 'timeline-filmstrip-p review'); 1576 var filmStripPreview = createElementWithClass('div', 'timeline-filmstrip-p review');
1574 filmStripFrame.imageDataPromise().then(onGotImageData.bind(null, filmStrip Preview)); 1577 filmStripFrame.imageDataPromise()
1578 .then(data => UI.loadImageFromData(data))
1579 .then(image => image && filmStripPreview.appendChild(image));
1575 contentHelper.appendElementRow('', filmStripPreview); 1580 contentHelper.appendElementRow('', filmStripPreview);
1576 filmStripPreview.addEventListener('click', frameClicked.bind(null, filmStr ipFrame), false); 1581 filmStripPreview.addEventListener('click', frameClicked.bind(null, filmStr ipFrame), false);
1577 } 1582 }
1578 var durationInMillis = frame.endTime - frame.startTime;
1579 contentHelper.appendTextRow(Common.UIString('FPS'), Math.floor(1000 / durati onInMillis));
1580 contentHelper.appendTextRow(Common.UIString('CPU time'), Number.millisToStri ng(frame.cpuTime, true));
1581 1583
1582 if (frame.layerTree) { 1584 if (frame.layerTree) {
1583 contentHelper.appendElementRow( 1585 contentHelper.appendElementRow(
1584 Common.UIString('Layer tree'), 1586 Common.UIString('Layer tree'),
1585 Components.Linkifier.linkifyRevealable(frame.layerTree, Common.UIStrin g('show'))); 1587 Components.Linkifier.linkifyRevealable(frame.layerTree, Common.UIStrin g('show')));
1586 } 1588 }
1587 1589
1588 /** 1590 /**
1589 * @param {!Element} image
1590 * @param {?string} data
1591 */
1592 function onGotImageData(image, data) {
1593 if (data)
1594 image.src = 'data:image/jpg;base64,' + data;
1595 }
1596
1597 /**
1598 * @param {!SDK.FilmStripModel.Frame} filmStripFrame 1591 * @param {!SDK.FilmStripModel.Frame} filmStripFrame
1599 */ 1592 */
1600 function frameClicked(filmStripFrame) { 1593 function frameClicked(filmStripFrame) {
1601 new PerfUI.FilmStripView.Dialog(filmStripFrame, 0); 1594 new PerfUI.FilmStripView.Dialog(filmStripFrame, 0);
1602 } 1595 }
1603 1596
1604 return contentHelper.fragment; 1597 return contentHelper.fragment;
1605 } 1598 }
1606 1599
1607 /** 1600 /**
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 * @param {string=} warningType 2289 * @param {string=} warningType
2297 */ 2290 */
2298 appendWarningRow(event, warningType) { 2291 appendWarningRow(event, warningType) {
2299 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType); 2292 var warning = Timeline.TimelineUIUtils.eventWarning(event, warningType);
2300 if (warning) 2293 if (warning)
2301 this.appendElementRow(Common.UIString('Warning'), warning, true); 2294 this.appendElementRow(Common.UIString('Warning'), warning, true);
2302 } 2295 }
2303 }; 2296 };
2304 2297
2305 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache'); 2298 Timeline.TimelineUIUtils._categoryBreakdownCacheSymbol = Symbol('categoryBreakdo wnCache');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698