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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
diff --git a/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js b/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
index 92965b7845ce14c790851933fa202a934c82fd5b..90accd5efb9dfe9e742f1d9ceafb418659f4cdc3 100644
--- a/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
+++ b/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
@@ -29,36 +29,40 @@ WebInspector.TimelinePaintProfilerView = function()
WebInspector.TimelinePaintProfilerView.prototype = {
wasShown: function()
{
- this._innerSetPicture(this._picture);
+ if (this._updateWhenVisible) {
+ this._updateWhenVisible = false;
+ this._update();
+ }
},
/**
+ * @param {!WeakReference.<!WebInspector.Target>} weakTarget
* @param {string} encodedPicture
*/
- setPicture: function(encodedPicture)
+ setPicture: function(weakTarget, encodedPicture)
{
- if (this._lastLoadedSnapshot) {
- this._lastLoadedSnapshot.dispose();
- this._lastLoadedSnapshot = null;
- }
+ this._disposeSnapshot();
this._picture = encodedPicture;
- if (!this.isShowing())
- return;
- this._innerSetPicture(this._picture);
+ this._weakTarget = weakTarget;
+ if (this.isShowing())
+ this._update();
+ else
+ this._updateWhenVisible = true;
},
- /**
- * @param {string} encodedPicture
- */
- _innerSetPicture: function(encodedPicture)
+ _update: function()
{
- WebInspector.PaintProfilerSnapshot.load(encodedPicture, onSnapshotLoaded.bind(this));
+ var target = this._weakTarget.get();
+ if (!target)
+ return;
+ WebInspector.PaintProfilerSnapshot.load(target, this._picture, onSnapshotLoaded.bind(this));
/**
* @param {?WebInspector.PaintProfilerSnapshot} snapshot
* @this WebInspector.TimelinePaintProfilerView
*/
function onSnapshotLoaded(snapshot)
{
+ this._disposeSnapshot();
this._lastLoadedSnapshot = snapshot;
snapshot.commandLog(onCommandLogDone.bind(this, snapshot));
}
@@ -75,6 +79,14 @@ WebInspector.TimelinePaintProfilerView.prototype = {
}
},
+ _disposeSnapshot: function()
+ {
+ if (!this._lastLoadedSnapshot)
+ return;
+ this._lastLoadedSnapshot.dispose();
+ this._lastLoadedSnapshot = null;
+ },
+
_onWindowChanged: function()
{
var window = this._paintProfilerView.windowBoundaries();
« no previous file with comments | « Source/devtools/front_end/timeline/TimelineLayersView.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698