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

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

Issue 389563002: DevTools: make paint profiler target-aware (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed a test and a stray line Created 6 years, 5 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
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineTracingView.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.TimelineUIUtils} 7 * @extends {WebInspector.TimelineUIUtils}
8 */ 8 */
9 WebInspector.TracingTimelineUIUtils = function() 9 WebInspector.TracingTimelineUIUtils = function()
10 { 10 {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 * @param {!WebInspector.Target} target 458 * @param {!WebInspector.Target} target
459 */ 459 */
460 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails = function(event, mod el, linkifier, callback, loadedFromFile, target) 460 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails = function(event, mod el, linkifier, callback, loadedFromFile, target)
461 { 461 {
462 var relatedNode = null; 462 var relatedNode = null;
463 var barrier = new CallbackBarrier(); 463 var barrier = new CallbackBarrier();
464 if (!event.previewElement) { 464 if (!event.previewElement) {
465 if (event.imageURL) 465 if (event.imageURL)
466 WebInspector.DOMPresentationUtils.buildImagePreviewContents(target, event.imageURL, false, barrier.createCallback(saveImage)); 466 WebInspector.DOMPresentationUtils.buildImagePreviewContents(target, event.imageURL, false, barrier.createCallback(saveImage));
467 else if (event.picture) 467 else if (event.picture)
468 WebInspector.TracingTimelineUIUtils.buildPicturePreviewContent(event .picture, barrier.createCallback(saveImage)); 468 WebInspector.TracingTimelineUIUtils.buildPicturePreviewContent(model .target(), event.picture, barrier.createCallback(saveImage));
469 } 469 }
470 if (event.backendNodeId) 470 if (event.backendNodeId)
471 target.domModel.pushNodesByBackendIdsToFrontend([event.backendNodeId], b arrier.createCallback(setRelatedNode)); 471 target.domModel.pushNodesByBackendIdsToFrontend([event.backendNodeId], b arrier.createCallback(setRelatedNode));
472 barrier.callWhenDone(callbackWrapper); 472 barrier.callWhenDone(callbackWrapper);
473 473
474 /** 474 /**
475 * @param {!Element=} element 475 * @param {!Element=} element
476 */ 476 */
477 function saveImage(element) 477 function saveImage(element)
478 { 478 {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (i > index) 691 if (i > index)
692 hasChildren = true; 692 hasChildren = true;
693 var category = WebInspector.TracingTimelineUIUtils.styleForTraceEven t(nextEvent.name).category.name; 693 var category = WebInspector.TracingTimelineUIUtils.styleForTraceEven t(nextEvent.name).category.name;
694 total[category] = (total[category] || 0) + nextEvent.selfTime; 694 total[category] = (total[category] || 0) + nextEvent.selfTime;
695 } 695 }
696 } 696 }
697 return hasChildren; 697 return hasChildren;
698 } 698 }
699 699
700 /** 700 /**
701 * @param {!WebInspector.Target} target
701 * @param {string} encodedPicture 702 * @param {string} encodedPicture
702 * @param {function(!Element=)} callback 703 * @param {function(!Element=)} callback
703 */ 704 */
704 WebInspector.TracingTimelineUIUtils.buildPicturePreviewContent = function(encode dPicture, callback) 705 WebInspector.TracingTimelineUIUtils.buildPicturePreviewContent = function(target , encodedPicture, callback)
705 { 706 {
706 var snapshotId; 707 WebInspector.PaintProfilerSnapshot.load(target, encodedPicture, onSnapshotLo aded);
707
708 LayerTreeAgent.loadSnapshot(encodedPicture, onSnapshotLoaded);
709 /** 708 /**
710 * @param {string} error 709 * @param {?WebInspector.PaintProfilerSnapshot} snapshot
711 * @param {string} id
712 */ 710 */
713 function onSnapshotLoaded(error, id) 711 function onSnapshotLoaded(snapshot)
714 { 712 {
715 if (error) { 713 if (!snapshot) {
716 console.error("LayerTreeAgent.loadSnapshot(): " + error);
717 callback(); 714 callback();
718 return; 715 return;
719 } 716 }
720 snapshotId = id; 717 snapshot.requestImage(null, null, 1, onGotImage);
721 LayerTreeAgent.replaySnapshot(snapshotId, onSnapshotReplayed); 718 snapshot.dispose();
722 } 719 }
723 720
724 /** 721 /**
725 * @param {string} error 722 * @param {string=} imageURL
726 * @param {string} encodedBitmap
727 */ 723 */
728 function onSnapshotReplayed(error, encodedBitmap) 724 function onGotImage(imageURL)
729 { 725 {
730 LayerTreeAgent.releaseSnapshot(snapshotId); 726 if (!imageURL) {
731 if (error) {
732 console.error("LayerTreeAgent.replaySnapshot(): " + error);
733 callback(); 727 callback();
734 return; 728 return;
735 } 729 }
736 var container = document.createElement("div"); 730 var container = document.createElement("div");
737 container.className = "image-preview-container"; 731 container.className = "image-preview-container";
738 var img = container.createChild("img"); 732 var img = container.createChild("img");
739 img.src = encodedBitmap; 733 img.src = imageURL;
740 callback(container); 734 callback(container);
741 } 735 }
742 } 736 }
743 737
744 /** 738 /**
745 * @param {string} recordType 739 * @param {string} recordType
746 * @param {string=} title 740 * @param {string=} title
747 * @return {!Element} 741 * @return {!Element}
748 */ 742 */
749 WebInspector.TracingTimelineUIUtils._createEventDivider = function(recordType, t itle) 743 WebInspector.TracingTimelineUIUtils._createEventDivider = function(recordType, t itle)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 return result; 777 return result;
784 } 778 }
785 779
786 /** 780 /**
787 * @return {!WebInspector.TracingTimelineModel.Filter} 781 * @return {!WebInspector.TracingTimelineModel.Filter}
788 */ 782 */
789 WebInspector.TracingTimelineUIUtils.hiddenEventsFilter = function() 783 WebInspector.TracingTimelineUIUtils.hiddenEventsFilter = function()
790 { 784 {
791 return new WebInspector.TracingTimelineModel.InclusiveEventNameFilter(WebIns pector.TracingTimelineUIUtils._visibleTypes()); 785 return new WebInspector.TracingTimelineModel.InclusiveEventNameFilter(WebIns pector.TracingTimelineUIUtils._visibleTypes());
792 } 786 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineTracingView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698