Commit e0f27b98 authored by eostroukhov's avatar eostroukhov Committed by Commit bot

[Devtools] Add capability for the log domain

BUG=594160

Review-Url: https://codereview.chromium.org/2345873002
Cr-Commit-Position: refs/heads/master@{#419304}
parent 063754cb
...@@ -34,10 +34,14 @@ InspectorTest.createWorkspace = function(ignoreEvents) ...@@ -34,10 +34,14 @@ InspectorTest.createWorkspace = function(ignoreEvents)
} }
InspectorTest._mockTargetId = 1; InspectorTest._mockTargetId = 1;
InspectorTest._pageCapabilities =
WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM |
WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log |
WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
InspectorTest.createMockTarget = function(id, debuggerModelConstructor, capabilities) InspectorTest.createMockTarget = function(id, debuggerModelConstructor, capabilities)
{ {
capabilities = capabilities || (WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker); capabilities = capabilities || InspectorTest._pageCapabilities;
var MockTarget = function(name, connection, callback) var MockTarget = function(name, connection, callback)
{ {
WebInspector.Target.call(this, InspectorTest.testTargetManager, name, capabilities, connection, null, callback); WebInspector.Target.call(this, InspectorTest.testTargetManager, name, capabilities, connection, null, callback);
......
...@@ -290,9 +290,14 @@ WebInspector.Main.prototype = { ...@@ -290,9 +290,14 @@ WebInspector.Main.prototype = {
WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason); WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason);
} }
var capabilities = WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker | WebInspector.Target.Capability.DOM; var capabilities =
WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.DOM |
WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log |
WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
if (Runtime.queryParam("isSharedWorker")) if (Runtime.queryParam("isSharedWorker"))
capabilities = WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker; capabilities =
WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.Log |
WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
else if (Runtime.queryParam("v8only")) else if (Runtime.queryParam("v8only"))
capabilities = WebInspector.Target.Capability.JS; capabilities = WebInspector.Target.Capability.JS;
......
...@@ -32,8 +32,9 @@ ...@@ -32,8 +32,9 @@
* @constructor * @constructor
* @extends {WebInspector.SDKModel} * @extends {WebInspector.SDKModel}
* @param {!WebInspector.Target} target * @param {!WebInspector.Target} target
* @param {?Protocol.LogAgent} logAgent
*/ */
WebInspector.ConsoleModel = function(target) WebInspector.ConsoleModel = function(target, logAgent)
{ {
WebInspector.SDKModel.call(this, WebInspector.ConsoleModel, target); WebInspector.SDKModel.call(this, WebInspector.ConsoleModel, target);
...@@ -44,9 +45,11 @@ WebInspector.ConsoleModel = function(target) ...@@ -44,9 +45,11 @@ WebInspector.ConsoleModel = function(target)
this._warnings = 0; this._warnings = 0;
this._errors = 0; this._errors = 0;
this._revokedErrors = 0; this._revokedErrors = 0;
this._logAgent = target.logAgent(); this._logAgent = logAgent;
target.registerLogDispatcher(new WebInspector.LogDispatcher(this)); if (this._logAgent) {
this._logAgent.enable(); target.registerLogDispatcher(new WebInspector.LogDispatcher(this));
this._logAgent.enable();
}
} }
/** @enum {symbol} */ /** @enum {symbol} */
...@@ -134,7 +137,7 @@ WebInspector.ConsoleModel.prototype = { ...@@ -134,7 +137,7 @@ WebInspector.ConsoleModel.prototype = {
requestClearMessages: function() requestClearMessages: function()
{ {
this._logAgent.clear(); this._logAgent && this._logAgent.clear();
this.clear(); this.clear();
}, },
......
...@@ -436,7 +436,9 @@ WebInspector.ServiceWorker = function(manager, workerId, url, versionId) ...@@ -436,7 +436,9 @@ WebInspector.ServiceWorker = function(manager, workerId, url, versionId)
this._scope = parsedURL ? parsedURL.host + parsedURL.folderPathComponents : ""; this._scope = parsedURL ? parsedURL.host + parsedURL.folderPathComponents : "";
this._manager._workers.set(workerId, this); this._manager._workers.set(workerId, this);
var capabilities = WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker; var capabilities =
WebInspector.Target.Capability.Log | WebInspector.Target.Capability.Network |
WebInspector.Target.Capability.Worker;
this._target = WebInspector.targetManager.createTarget(this._name, capabilities, this._connection, manager.target()); this._target = WebInspector.targetManager.createTarget(this._name, capabilities, this._connection, manager.target());
this._target[WebInspector.ServiceWorker.Symbol] = this; this._target[WebInspector.ServiceWorker.Symbol] = this;
this._manager.dispatchEventToListeners(WebInspector.ServiceWorkerManager.Events.WorkersUpdated); this._manager.dispatchEventToListeners(WebInspector.ServiceWorkerManager.Events.WorkersUpdated);
......
...@@ -34,11 +34,12 @@ WebInspector.Target = function(targetManager, name, capabilitiesMask, connection ...@@ -34,11 +34,12 @@ WebInspector.Target = function(targetManager, name, capabilitiesMask, connection
*/ */
WebInspector.Target.Capability = { WebInspector.Target.Capability = {
Browser: 1, Browser: 1,
JS: 2, DOM: 2,
Network: 4, JS: 4,
Worker: 8, Log: 8,
DOM: 16 Network: 16,
} Worker: 32
};
WebInspector.Target._nextId = 1; WebInspector.Target._nextId = 1;
...@@ -120,6 +121,14 @@ WebInspector.Target.prototype = { ...@@ -120,6 +121,14 @@ WebInspector.Target.prototype = {
return this.hasAllCapabilities(WebInspector.Target.Capability.JS); return this.hasAllCapabilities(WebInspector.Target.Capability.JS);
}, },
/**
* @return {boolean}
*/
hasLogCapability: function()
{
return this.hasAllCapabilities(WebInspector.Target.Capability.Log);
},
/** /**
* @return {boolean} * @return {boolean}
*/ */
......
...@@ -190,8 +190,10 @@ WebInspector.TargetManager.prototype = { ...@@ -190,8 +190,10 @@ WebInspector.TargetManager.prototype = {
{ {
var target = new WebInspector.Target(this, name, capabilitiesMask, connection, parentTarget); var target = new WebInspector.Target(this, name, capabilitiesMask, connection, parentTarget);
var logAgent = target.hasLogCapability() ? target.logAgent() : null;
/** @type {!WebInspector.ConsoleModel} */ /** @type {!WebInspector.ConsoleModel} */
target.consoleModel = new WebInspector.ConsoleModel(target); target.consoleModel = new WebInspector.ConsoleModel(target, logAgent);
/** @type {!WebInspector.RuntimeModel} */ /** @type {!WebInspector.RuntimeModel} */
target.runtimeModel = new WebInspector.RuntimeModel(target); target.runtimeModel = new WebInspector.RuntimeModel(target);
......
...@@ -101,7 +101,7 @@ WebInspector.WorkerManager.prototype = { ...@@ -101,7 +101,7 @@ WebInspector.WorkerManager.prototype = {
var parsedURL = url.asParsedURL(); var parsedURL = url.asParsedURL();
var workerName = parsedURL ? parsedURL.lastPathComponentWithFragment() : "#" + (++this._lastAnonymousTargetId); var workerName = parsedURL ? parsedURL.lastPathComponentWithFragment() : "#" + (++this._lastAnonymousTargetId);
var target = WebInspector.targetManager.createTarget(workerName, WebInspector.Target.Capability.JS, connection, this.target()); var target = WebInspector.targetManager.createTarget(workerName, WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Log, connection, this.target());
this._targetsByWorkerId.set(workerId, target); this._targetsByWorkerId.set(workerId, target);
// Only pause new worker if debugging SW - we are going through the // Only pause new worker if debugging SW - we are going through the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment