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 ebaf360642910fa249815ba62469fdc3f72b917c..97356b5faade1cac87b48ffa92fc4e930b330125 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/sdk/Target.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/sdk/Target.js |
| @@ -9,16 +9,16 @@ |
| * @extends {Protocol.Agents} |
| * @param {!WebInspector.TargetManager} targetManager |
| * @param {string} name |
| - * @param {number} type |
| + * @param {number} capabilitiesMask |
| * @param {!InspectorBackendClass.Connection} connection |
| * @param {?WebInspector.Target} parentTarget |
| */ |
| -WebInspector.Target = function(targetManager, name, type, connection, parentTarget) |
| +WebInspector.Target = function(targetManager, name, capabilitiesMask, connection, parentTarget) |
| { |
| Protocol.Agents.call(this, connection.agentsMap()); |
| this._targetManager = targetManager; |
| this._name = name; |
| - this._type = type; |
| + this._capabilitiesMask = capabilitiesMask; |
| this._connection = connection; |
| this._parentTarget = parentTarget; |
| connection.addEventListener(InspectorBackendClass.Connection.Events.Disconnected, this._onDisconnect, this); |
| @@ -31,11 +31,11 @@ WebInspector.Target = function(targetManager, name, type, connection, parentTarg |
| /** |
| * @enum {number} |
| */ |
| -WebInspector.Target.Type = { |
| - Page: 1, |
| - DedicatedWorker: 2, |
| - ServiceWorker: 4, |
| - JSInspector: 8 |
| +WebInspector.Target.Capabilities = { |
|
dgozman
2016/07/12 00:34:11
Capability
eostroukhov-old
2016/07/12 21:46:16
Done.
|
| + BROWSER_DOMAINS: 1, |
|
dgozman
2016/07/12 00:34:11
Browser, JS, Network, Worker
eostroukhov-old
2016/07/12 21:46:15
Done.
|
| + JS_DOMAINS: 2, |
| + NETWORK_DOMAINS: 4, |
| + WORKER_DOMAINS: 8, |
| } |
| WebInspector.Target._nextId = 1; |
| @@ -58,21 +58,19 @@ WebInspector.Target.prototype = { |
| }, |
| /** |
| - * |
| - * @return {number} |
| + * @return {!WebInspector.TargetManager} |
| */ |
| - type: function() |
| + targetManager: function() |
| { |
| - return this._type; |
| + return this._targetManager; |
| }, |
| /** |
| - * |
| - * @return {!WebInspector.TargetManager} |
| + * @return {number} |
| */ |
| - targetManager: function() |
| + capabilitiesMask: function() |
|
dgozman
2016/07/12 00:34:11
Who uses this? Let's not expose.
eostroukhov-old
2016/07/12 21:46:16
It was used by the TargetManager - now that have c
|
| { |
| - return this._targetManager; |
| + return this._capabilitiesMask; |
| }, |
| /** |
| @@ -81,7 +79,7 @@ WebInspector.Target.prototype = { |
| */ |
| decorateLabel: function(label) |
| { |
| - return this.isWorker() ? "\u2699 " + label : label; |
| + return !this.hasBrowserDomains() ? "\u2699 " + label : label; |
| }, |
| /** |
| @@ -94,60 +92,41 @@ WebInspector.Target.prototype = { |
| this._connection.registerDispatcher(domain, dispatcher); |
| }, |
| - /** |
| - * @return {boolean} |
| - */ |
| - isPage: function() |
| - { |
| - return this._type === WebInspector.Target.Type.Page; |
| - }, |
| - |
| - /** |
| - * @return {boolean} |
| - */ |
| - isWorker: function() |
| - { |
| - return this.isDedicatedWorker() || this.isServiceWorker() || this.isJSInspector(); |
| - }, |
| - |
| - /** |
| - * @return {boolean} |
| - */ |
| - isDedicatedWorker: function() |
| + _hasCapability: function(capability) |
|
dgozman
2016/07/12 00:34:11
Annotate please.
eostroukhov-old
2016/07/12 21:46:16
This function is now gone.
|
| { |
| - return this._type === WebInspector.Target.Type.DedicatedWorker; |
| + return (this._capabilitiesMask & capability) === capability; |
| }, |
| /** |
| * @return {boolean} |
| */ |
| - isServiceWorker: function() |
| + hasBrowserDomains: function() |
|
dgozman
2016/07/12 00:34:11
Now I think maybe we should call this hasBrowserCa
eostroukhov-old
2016/07/12 21:46:16
Done.
|
| { |
| - return this._type === WebInspector.Target.Type.ServiceWorker; |
| + return this._hasCapability(WebInspector.Target.Capabilities.BROWSER_DOMAINS); |
| }, |
| /** |
| * @return {boolean} |
| */ |
| - isJSInspector: function() |
| + hasJSDomains: function() |
| { |
| - return this._type === WebInspector.Target.Type.JSInspector; |
| + return this._hasCapability(WebInspector.Target.Capabilities.JS_DOMAINS); |
| }, |
| /** |
| * @return {boolean} |
| */ |
| - hasJSContext: function() |
| + hasNetworkDomains: function() |
| { |
| - return !this.isServiceWorker(); |
| + return this._hasCapability(WebInspector.Target.Capabilities.NETWORK_DOMAINS); |
| }, |
| /** |
| * @return {boolean} |
| */ |
| - supportsWorkers: function() |
| + hasWorkerDomains: function() |
| { |
| - return this.isPage() || this.isServiceWorker(); |
| + return this._hasCapability(WebInspector.Target.Capabilities.WORKER_DOMAINS); |
| }, |
| /** |