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

Unified Diff: Source/devtools/front_end/sdk/PaintProfiler.js

Issue 402633002: DevTools: Remove redundant dependency on target from TimelineFrameModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address caseq comments 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/sdk/PaintProfiler.js
diff --git a/Source/devtools/front_end/sdk/PaintProfiler.js b/Source/devtools/front_end/sdk/PaintProfiler.js
index 0f885b75b90fc7aa4b66f899207321a6e500d0f1..9f5d05b0d3253f20909d4fa91addf859ecb9e51d 100644
--- a/Source/devtools/front_end/sdk/PaintProfiler.js
+++ b/Source/devtools/front_end/sdk/PaintProfiler.js
@@ -30,12 +30,12 @@
/**
* @constructor
- * @param {!WeakReference.<!WebInspector.Target>} weakTarget
+ * @param {!WebInspector.Target} target
* @param {string} snapshotId
*/
-WebInspector.PaintProfilerSnapshot = function(weakTarget, snapshotId)
+WebInspector.PaintProfilerSnapshot = function(target, snapshotId)
{
- this._weakTarget = weakTarget;
+ this._target = target;
this._id = snapshotId;
}
@@ -46,7 +46,7 @@ WebInspector.PaintProfilerSnapshot = function(weakTarget, snapshotId)
*/
WebInspector.PaintProfilerSnapshot.load = function(target, encodedPicture, callback)
{
- var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "LayerTreeAgent.loadSnapshot(): ", WebInspector.PaintProfilerSnapshot.bind(null, target.weakReference()));
+ var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "LayerTreeAgent.loadSnapshot(): ", WebInspector.PaintProfilerSnapshot.bind(null, target));
target.layerTreeAgent().loadSnapshot(encodedPicture, wrappedCallback);
}
@@ -100,17 +100,15 @@ WebInspector.PaintProfilerSnapshot._processAnnotations = function(log)
WebInspector.PaintProfilerSnapshot.prototype = {
dispose: function()
{
- var target = this._weakTarget.get();
- if (target)
- target.layerTreeAgent().releaseSnapshot(this._id);
+ this._target.layerTreeAgent().releaseSnapshot(this._id);
},
/**
- * @return {?WebInspector.Target}
+ * @return {!WebInspector.Target}
*/
target: function()
{
- return this._weakTarget.get();
+ return this._target;
},
/**
@@ -121,13 +119,8 @@ WebInspector.PaintProfilerSnapshot.prototype = {
*/
requestImage: function(firstStep, lastStep, scale, callback)
{
- var target = this._weakTarget.get();
- if (!target) {
- callback();
- return;
- }
var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "LayerTreeAgent.replaySnapshot(): ");
- target.layerTreeAgent().replaySnapshot(this._id, firstStep || undefined, lastStep || undefined, scale || 1.0, wrappedCallback);
+ this._target.layerTreeAgent().replaySnapshot(this._id, firstStep || undefined, lastStep || undefined, scale || 1.0, wrappedCallback);
},
/**
@@ -135,13 +128,8 @@ WebInspector.PaintProfilerSnapshot.prototype = {
*/
profile: function(callback)
{
- var target = this._weakTarget.get();
- if (!target) {
- callback();
- return;
- }
var wrappedCallback = InspectorBackend.wrapClientCallback(callback, "LayerTreeAgent.profileSnapshot(): ");
- target.layerTreeAgent().profileSnapshot(this._id, 5, 1, wrappedCallback);
+ this._target.layerTreeAgent().profileSnapshot(this._id, 5, 1, wrappedCallback);
},
/**
@@ -149,11 +137,6 @@ WebInspector.PaintProfilerSnapshot.prototype = {
*/
commandLog: function(callback)
{
- var target = this._weakTarget.get();
- if (!target) {
- callback();
- return;
- }
/**
* @param {?string} error
* @param {!Array.<!WebInspector.RawPaintProfilerLogItem>} log
@@ -168,7 +151,7 @@ WebInspector.PaintProfilerSnapshot.prototype = {
callback(WebInspector.PaintProfilerSnapshot._processAnnotations(log));
}
- target.layerTreeAgent().snapshotCommandLog(this._id, callbackWrapper);
+ this._target.layerTreeAgent().snapshotCommandLog(this._id, callbackWrapper);
}
};
« no previous file with comments | « Source/devtools/front_end/sdk/LayerTreeModel.js ('k') | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698