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

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

Issue 389563002: DevTools: make paint profiler target-aware (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use WeakReference to Target in places thay may outlive tatget 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/Target.js
diff --git a/Source/devtools/front_end/sdk/Target.js b/Source/devtools/front_end/sdk/Target.js
index dc5ffba3f2747094417a59087b0c09755a1e0736..ecd60e20ea292e30d6da68ab4314cbb720f9f129 100644
--- a/Source/devtools/front_end/sdk/Target.js
+++ b/Source/devtools/front_end/sdk/Target.js
@@ -14,6 +14,8 @@
WebInspector.Target = function(name, connection, callback)
{
Protocol.Agents.call(this, connection.agentsMap());
+ /** @type {!WeakReference.<!WebInspector.Target>} */
+ this._weakReference = new WeakReference(this);
this._name = name;
this._connection = connection;
/** @type {boolean} */
@@ -58,6 +60,14 @@ WebInspector.Target.prototype = {
},
/**
+ * @return {!WeakReference.<!WebInspector.Target>}
+ */
+ weakReference: function()
+ {
+ return this._weakReference;
+ },
+
+ /**
* @param {string} name
* @param {function()|null} callback
* @param {?Protocol.Error} error
@@ -182,6 +192,7 @@ WebInspector.Target.prototype = {
dispose: function()
{
+ this._weakReference.clear();
this.debuggerModel.dispose();
this.networkManager.dispose();
this.cpuProfilerModel.dispose();
@@ -190,6 +201,7 @@ WebInspector.Target.prototype = {
__proto__: Protocol.Agents.prototype
}
+
apavlov 2014/07/11 16:24:48 stray blank line
/**
* @constructor
* @extends {WebInspector.Object}
« no previous file with comments | « Source/devtools/front_end/sdk/PaintProfiler.js ('k') | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698