Chromium Code Reviews| 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 f79d7fb37c061e8f5b376b01133469b184d6918c..4db8006bb83ae43b78211aa2c45fcb783839480f 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/Target.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/Target.js |
| @@ -26,6 +26,8 @@ WebInspector.Target = function(targetManager, name, type, connection, parentTarg |
| /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ |
| this._modelByConstructor = new Map(); |
| + /** @type {!Array<!{dispose: !Function}>} */ |
|
dgozman
2016/06/29 18:37:58
If we go for this, Disposable should be an interfa
eostroukhov-old
2016/06/29 22:54:20
Removed the array, listening to an event instead.
|
| + this.disposables = []; |
| } |
| /** |
| @@ -34,7 +36,8 @@ WebInspector.Target = function(targetManager, name, type, connection, parentTarg |
| WebInspector.Target.Type = { |
| Page: 1, |
| DedicatedWorker: 2, |
| - ServiceWorker: 4 |
| + ServiceWorker: 4, |
| + V8Inspector: 8 |
|
dgozman
2016/06/29 18:37:58
I think it's better to use JS term instead of V8.
eostroukhov-old
2016/06/29 22:54:20
Done.
|
| } |
| WebInspector.Target._nextId = 1; |
| @@ -106,7 +109,7 @@ WebInspector.Target.prototype = { |
| */ |
| isWorker: function() |
| { |
| - return this.isDedicatedWorker() || this.isServiceWorker(); |
| + return this.isDedicatedWorker() || this.isServiceWorker() || this.isV8Inspector(); |
| }, |
| /** |
| @@ -128,6 +131,14 @@ WebInspector.Target.prototype = { |
| /** |
| * @return {boolean} |
| */ |
| + isV8Inspector: function() |
| + { |
| + return this._type === WebInspector.Target.Type.V8Inspector; |
| + }, |
| + |
| + /** |
| + * @return {boolean} |
| + */ |
| hasJSContext: function() |
| { |
| return !this.isServiceWorker(); |
| @@ -150,11 +161,12 @@ WebInspector.Target.prototype = { |
| _dispose: function() |
| { |
| this._targetManager.dispatchEventToListeners(WebInspector.TargetManager.Events.TargetDisposed, this); |
| - this.networkManager.dispose(); |
| this.cpuProfilerModel.dispose(); |
| WebInspector.ServiceWorkerCacheModel.fromTarget(this).dispose(); |
| if (this.workerManager) |
| this.workerManager.dispose(); |
| + for (var disposable of this.disposables) |
|
dgozman
2016/06/29 18:37:58
I think we can just listen for TargetDisposed even
eostroukhov-old
2016/06/29 22:54:20
Done.
|
| + disposable.dispose(); |
| }, |
| /** |