Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @constructor | 8 * @constructor |
| 9 * @extends {Protocol.Agents} | 9 * @extends {Protocol.Agents} |
| 10 * @param {!WebInspector.TargetManager} targetManager | 10 * @param {!WebInspector.TargetManager} targetManager |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ | 27 /** @type {!Map.<!Function, !WebInspector.SDKModel>} */ |
| 28 this._modelByConstructor = new Map(); | 28 this._modelByConstructor = new Map(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @enum {number} | 32 * @enum {number} |
| 33 */ | 33 */ |
| 34 WebInspector.Target.Type = { | 34 WebInspector.Target.Type = { |
| 35 Page: 1, | 35 Page: 1, |
| 36 DedicatedWorker: 2, | 36 DedicatedWorker: 2, |
| 37 ServiceWorker: 4 | 37 ServiceWorker: 4, |
| 38 JSInspector: 8 | |
| 38 } | 39 } |
| 39 | 40 |
| 40 WebInspector.Target._nextId = 1; | 41 WebInspector.Target._nextId = 1; |
| 41 | 42 |
| 42 WebInspector.Target.prototype = { | 43 WebInspector.Target.prototype = { |
| 43 /** | 44 /** |
| 44 * @return {number} | 45 * @return {number} |
| 45 */ | 46 */ |
| 46 id: function() | 47 id: function() |
| 47 { | 48 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 isPage: function() | 100 isPage: function() |
| 100 { | 101 { |
| 101 return this._type === WebInspector.Target.Type.Page; | 102 return this._type === WebInspector.Target.Type.Page; |
| 102 }, | 103 }, |
| 103 | 104 |
| 104 /** | 105 /** |
| 105 * @return {boolean} | 106 * @return {boolean} |
| 106 */ | 107 */ |
| 107 isWorker: function() | 108 isWorker: function() |
| 108 { | 109 { |
| 109 return this.isDedicatedWorker() || this.isServiceWorker(); | 110 return this.isDedicatedWorker() || this.isServiceWorker() || this.isJSIn spector(); |
| 110 }, | 111 }, |
| 111 | 112 |
| 112 /** | 113 /** |
| 113 * @return {boolean} | 114 * @return {boolean} |
| 114 */ | 115 */ |
| 115 isDedicatedWorker: function() | 116 isDedicatedWorker: function() |
| 116 { | 117 { |
| 117 return this._type === WebInspector.Target.Type.DedicatedWorker; | 118 return this._type === WebInspector.Target.Type.DedicatedWorker; |
| 118 }, | 119 }, |
| 119 | 120 |
| 120 /** | 121 /** |
| 121 * @return {boolean} | 122 * @return {boolean} |
| 122 */ | 123 */ |
| 123 isServiceWorker: function() | 124 isServiceWorker: function() |
| 124 { | 125 { |
| 125 return this._type === WebInspector.Target.Type.ServiceWorker; | 126 return this._type === WebInspector.Target.Type.ServiceWorker; |
| 126 }, | 127 }, |
| 127 | 128 |
| 128 /** | 129 /** |
| 129 * @return {boolean} | 130 * @return {boolean} |
| 130 */ | 131 */ |
| 132 isJSInspector: function() | |
| 133 { | |
| 134 return this._type === WebInspector.Target.Type.JSInspector; | |
| 135 }, | |
| 136 | |
| 137 /** | |
| 138 * @return {boolean} | |
| 139 */ | |
| 131 hasJSContext: function() | 140 hasJSContext: function() |
| 132 { | 141 { |
| 133 return !this.isServiceWorker(); | 142 return !this.isServiceWorker(); |
| 134 }, | 143 }, |
| 135 | 144 |
| 136 /** | 145 /** |
| 146 * @return {boolean} | |
| 147 */ | |
| 148 supportsWorkers: function() | |
| 149 { | |
| 150 return !this.isDedicatedWorker() && !this.isJSInspector(); | |
|
dgozman
2016/06/30 17:24:33
Let's whitelist instead of blacklisting.
eostroukhov-old
2016/06/30 21:38:28
Done.
| |
| 151 }, | |
| 152 | |
| 153 /** | |
| 137 * @return {?WebInspector.Target} | 154 * @return {?WebInspector.Target} |
| 138 */ | 155 */ |
| 139 parentTarget: function() | 156 parentTarget: function() |
| 140 { | 157 { |
| 141 return this._parentTarget; | 158 return this._parentTarget; |
| 142 }, | 159 }, |
| 143 | 160 |
| 144 _onDisconnect: function() | 161 _onDisconnect: function() |
| 145 { | 162 { |
| 146 this._targetManager.removeTarget(this); | 163 this._targetManager.removeTarget(this); |
| 147 this._dispose(); | 164 this._dispose(); |
| 148 }, | 165 }, |
| 149 | 166 |
| 150 _dispose: function() | 167 _dispose: function() |
| 151 { | 168 { |
| 152 this._targetManager.dispatchEventToListeners(WebInspector.TargetManager. Events.TargetDisposed, this); | 169 this._targetManager.dispatchEventToListeners(WebInspector.TargetManager. Events.TargetDisposed, this); |
| 153 this.networkManager.dispose(); | |
| 154 this.cpuProfilerModel.dispose(); | 170 this.cpuProfilerModel.dispose(); |
| 155 WebInspector.ServiceWorkerCacheModel.fromTarget(this).dispose(); | 171 WebInspector.ServiceWorkerCacheModel.fromTarget(this).dispose(); |
| 156 if (this.workerManager) | 172 if (this.workerManager) |
| 157 this.workerManager.dispose(); | 173 this.workerManager.dispose(); |
| 158 }, | 174 }, |
| 159 | 175 |
| 160 /** | 176 /** |
| 161 * @return {boolean} | 177 * @return {boolean} |
| 162 */ | 178 */ |
| 163 isDetached: function() | 179 isDetached: function() |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 /** | 248 /** |
| 233 * @return {!Promise} | 249 * @return {!Promise} |
| 234 */ | 250 */ |
| 235 resumeModel: function() | 251 resumeModel: function() |
| 236 { | 252 { |
| 237 return Promise.resolve(); | 253 return Promise.resolve(); |
| 238 }, | 254 }, |
| 239 | 255 |
| 240 __proto__: WebInspector.SDKObject.prototype | 256 __proto__: WebInspector.SDKObject.prototype |
| 241 } | 257 } |
| OLD | NEW |