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

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

Issue 389563002: DevTools: make paint profiler target-aware (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
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.SplitView} 7 * @extends {WebInspector.SplitView}
8 */ 8 */
9 WebInspector.TimelinePaintProfilerView = function() 9 WebInspector.TimelinePaintProfilerView = function()
10 { 10 {
(...skipping 11 matching lines...) Expand all
22 this._paintProfilerView.addEventListener(WebInspector.PaintProfilerView.Even ts.WindowChanged, this._onWindowChanged, this); 22 this._paintProfilerView.addEventListener(WebInspector.PaintProfilerView.Even ts.WindowChanged, this._onWindowChanged, this);
23 this._paintProfilerView.show(this.sidebarElement()); 23 this._paintProfilerView.show(this.sidebarElement());
24 24
25 this._logTreeView = new WebInspector.PaintProfilerCommandLogView(); 25 this._logTreeView = new WebInspector.PaintProfilerCommandLogView();
26 this._logTreeView.show(this._logAndImageSplitView.sidebarElement()); 26 this._logTreeView.show(this._logAndImageSplitView.sidebarElement());
27 } 27 }
28 28
29 WebInspector.TimelinePaintProfilerView.prototype = { 29 WebInspector.TimelinePaintProfilerView.prototype = {
30 wasShown: function() 30 wasShown: function()
31 { 31 {
32 this._innerSetPicture(this._picture); 32 if (this._updateWhenVisible) {
33 this._updateWhenVisible = false;
34 this._update();
35 }
33 }, 36 },
34 37
35 /** 38 /**
39 * @param {!WebInspector.Target} target
36 * @param {string} encodedPicture 40 * @param {string} encodedPicture
37 */ 41 */
38 setPicture: function(encodedPicture) 42 setPicture: function(target, encodedPicture)
39 { 43 {
40 if (this._lastLoadedSnapshot) { 44 this._disposeSnapshot();
41 this._lastLoadedSnapshot.dispose();
42 this._lastLoadedSnapshot = null;
43 }
44 this._picture = encodedPicture; 45 this._picture = encodedPicture;
45 if (!this.isShowing()) 46 this._target = target;
46 return; 47 if (this.isShowing())
47 this._innerSetPicture(this._picture); 48 this._update();
49 else
50 this._updateWhenVisible = true;
48 }, 51 },
49 52
50 /** 53 _update: function()
51 * @param {string} encodedPicture
52 */
53 _innerSetPicture: function(encodedPicture)
54 { 54 {
55 WebInspector.PaintProfilerSnapshot.load(encodedPicture, onSnapshotLoaded .bind(this)); 55 WebInspector.PaintProfilerSnapshot.load(this._target, this._picture, onS napshotLoaded.bind(this));
56 /** 56 /**
57 * @param {?WebInspector.PaintProfilerSnapshot} snapshot 57 * @param {?WebInspector.PaintProfilerSnapshot} snapshot
58 * @this WebInspector.TimelinePaintProfilerView 58 * @this WebInspector.TimelinePaintProfilerView
59 */ 59 */
60 function onSnapshotLoaded(snapshot) 60 function onSnapshotLoaded(snapshot)
61 { 61 {
62 this._disposeSnapshot();
62 this._lastLoadedSnapshot = snapshot; 63 this._lastLoadedSnapshot = snapshot;
63 snapshot.commandLog(onCommandLogDone.bind(this, snapshot)); 64 snapshot.commandLog(onCommandLogDone.bind(this, snapshot));
64 } 65 }
65 66
66 /** 67 /**
67 * @param {!WebInspector.PaintProfilerSnapshot=} snapshot 68 * @param {!WebInspector.PaintProfilerSnapshot=} snapshot
68 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log 69 * @param {!Array.<!WebInspector.PaintProfilerLogItem>=} log
69 * @this {WebInspector.TimelinePaintProfilerView} 70 * @this {WebInspector.TimelinePaintProfilerView}
70 */ 71 */
71 function onCommandLogDone(snapshot, log) 72 function onCommandLogDone(snapshot, log)
72 { 73 {
73 this._logTreeView.setCommandLog(log); 74 this._logTreeView.setCommandLog(log);
74 this._paintProfilerView.setSnapshotAndLog(snapshot || null, log || [ ]); 75 this._paintProfilerView.setSnapshotAndLog(snapshot || null, log || [ ]);
75 } 76 }
76 }, 77 },
77 78
79 _disposeSnapshot: function()
80 {
81 if (!this._lastLoadedSnapshot)
82 return;
83 this._lastLoadedSnapshot.dispose();
84 this._lastLoadedSnapshot = null;
85 },
86
78 _onWindowChanged: function() 87 _onWindowChanged: function()
79 { 88 {
80 var window = this._paintProfilerView.windowBoundaries(); 89 var window = this._paintProfilerView.windowBoundaries();
81 this._logTreeView.updateWindow(window.left, window.right); 90 this._logTreeView.updateWindow(window.left, window.right);
82 }, 91 },
83 92
84 __proto__: WebInspector.SplitView.prototype 93 __proto__: WebInspector.SplitView.prototype
85 }; 94 };
86 95
87 /** 96 /**
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 * @param {string=} imageURL 138 * @param {string=} imageURL
130 */ 139 */
131 showImage: function(imageURL) 140 showImage: function(imageURL)
132 { 141 {
133 this._imageElement.classList.toggle("hidden", !imageURL); 142 this._imageElement.classList.toggle("hidden", !imageURL);
134 this._imageElement.src = imageURL; 143 this._imageElement.src = imageURL;
135 }, 144 },
136 145
137 __proto__: WebInspector.View.prototype 146 __proto__: WebInspector.View.prototype
138 }; 147 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698