| Index: third_party/WebKit/Source/devtools/front_end/sdk/Target.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/Target.js b/third_party/WebKit/Source/devtools/front_end/sdk/Target.js
|
| index 82f9ee07038be1424c800846418a946a9eba8b53..0f6b95f109b3e6e65a960a1252b37cda0ad256b7 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/Target.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/Target.js
|
| @@ -10,11 +10,12 @@
|
| * @param {!WebInspector.TargetManager} targetManager
|
| * @param {string} name
|
| * @param {number} capabilitiesMask
|
| - * @param {!InspectorBackendClass.Connection} connection
|
| + * @param {!InspectorBackendClass.Channel} channel
|
| * @param {?WebInspector.Target} parentTarget
|
| */
|
| -WebInspector.Target = function(targetManager, name, capabilitiesMask, connection, parentTarget)
|
| +WebInspector.Target = function(targetManager, name, capabilitiesMask, channel, parentTarget)
|
| {
|
| + var connection = new InspectorBackendClass.Connection(channel, this._dispose.bind(this));
|
| Protocol.Agents.call(this, connection.agentsMap());
|
| this._targetManager = targetManager;
|
| this._name = name;
|
| @@ -22,8 +23,8 @@ WebInspector.Target = function(targetManager, name, capabilitiesMask, connection
|
| this._capabilitiesMask = capabilitiesMask;
|
| this._connection = connection;
|
| this._parentTarget = parentTarget;
|
| - connection.addEventListener(InspectorBackendClass.Connection.Events.Disconnected, this.dispose, this);
|
| this._id = WebInspector.Target._nextId++;
|
| + this._disposed = false;
|
|
|
| /** @type {!Map.<!Function, !WebInspector.SDKModel>} */
|
| this._modelByConstructor = new Map();
|
| @@ -92,14 +93,6 @@ WebInspector.Target.prototype = {
|
| },
|
|
|
| /**
|
| - * @return {!InspectorBackendClass.Connection}
|
| - */
|
| - connection: function()
|
| - {
|
| - return this._connection;
|
| - },
|
| -
|
| - /**
|
| * @param {string} label
|
| * @return {string}
|
| */
|
| @@ -174,8 +167,12 @@ WebInspector.Target.prototype = {
|
| return this._parentTarget;
|
| },
|
|
|
| - dispose: function()
|
| + /**
|
| + * @param {string} reason
|
| + */
|
| + _dispose: function(reason)
|
| {
|
| + this._disposed = true;
|
| this._targetManager.removeTarget(this);
|
| for (var model of this._modelByConstructor.valuesArray())
|
| model.dispose();
|
| @@ -186,9 +183,9 @@ WebInspector.Target.prototype = {
|
| /**
|
| * @return {boolean}
|
| */
|
| - isDetached: function()
|
| + isDisposed: function()
|
| {
|
| - return this._connection.isClosed();
|
| + return this._disposed;
|
| },
|
|
|
| /**
|
|
|