Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1853)

Unified Diff: Source/devtools/front_end/inspector.js

Issue 185463010: DevTools: Introduce Target class which holds connection & models (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@gr-RuntimeAgent
Patch Set: Address vsevik's comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/inspector.js
diff --git a/Source/devtools/front_end/inspector.js b/Source/devtools/front_end/inspector.js
index 2baf581ab659c3ff310e8b8cd1484181e9e8927a..f7f16083bcc9f9629753e5ab806dd758c014bdaa 100644
--- a/Source/devtools/front_end/inspector.js
+++ b/Source/devtools/front_end/inspector.js
@@ -193,13 +193,6 @@ var WebInspector = {
return parsedURL ? parsedURL.host : "";
},
- _initializeCapability: function(name, callback, error, result)
- {
- Capabilities[name] = result;
- if (callback)
- callback();
- },
-
_debuggerPaused: function()
{
this.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
@@ -293,11 +286,8 @@ WebInspector.loaded = function()
WebInspector.doLoadedDone();
- // In case of loading as a web page with no bindings / harness, kick off initialization manually.
- if (InspectorFrontendHost.isStub) {
+ if (InspectorFrontendHost.isStub)
InspectorFrontendAPI.dispatchQueryParameters(WebInspector.queryParamsObject);
- WebInspector._doLoadedDoneWithCapabilities();
- }
}
WebInspector.doLoadedDone = function()
@@ -317,14 +307,16 @@ WebInspector.doLoadedDone = function()
var connection = workerId ? new WebInspector.WorkerConnection(workerId) : new InspectorBackendClass.MainConnection();
InspectorBackend.setConnection(connection);
- PageAgent.canScreencast(WebInspector._initializeCapability.bind(WebInspector, "canScreencast", null));
- WorkerAgent.canInspectWorkers(WebInspector._initializeCapability.bind(WebInspector, "canInspectWorkers", WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector)));
+ WebInspector.targetManager = new WebInspector.TargetManager();
+ WebInspector.targetManager.createTarget(connection, WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector));
}
-WebInspector._doLoadedDoneWithCapabilities = function()
+WebInspector._doLoadedDoneWithCapabilities = function(mainTarget)
{
- new WebInspector.VersionController().updateVersion();
+ // compatibility code
+ Capabilities.canInspectWorkers = mainTarget.canInspectWorkers;
vsevik 2014/03/06 16:30:08 Please move this to Target.
sergeyv 2014/03/06 16:45:37 Done.
+ new WebInspector.VersionController().updateVersion();
WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
this._registerShortcuts();
@@ -333,19 +325,13 @@ WebInspector._doLoadedDoneWithCapabilities = function()
WebInspector.shortcutsScreen.section(WebInspector.UIString("Elements Panel"));
WebInspector.ShortcutsScreen.registerShortcuts();
- this.console = new WebInspector.ConsoleModel();
this.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._resetErrorAndWarningCounts, this);
this.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._updateErrorAndWarningCounts, this);
this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._updateErrorAndWarningCounts, this);
- this.networkManager = new WebInspector.NetworkManager();
- this.resourceTreeModel = new WebInspector.ResourceTreeModel(this.networkManager);
- this.debuggerModel = new WebInspector.DebuggerModel();
+
this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
this.networkLog = new WebInspector.NetworkLog();
- this.domAgent = new WebInspector.DOMAgent();
this.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectNodeRequested, this._inspectNodeRequested, this);
- this.workerManager = new WebInspector.WorkerManager(Capabilities.canInspectWorkers);
- this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel);
this.zoomManager = new WebInspector.ZoomManager();
@@ -404,7 +390,7 @@ WebInspector._doLoadedDoneWithCapabilities = function()
this.panels = {};
this.inspectorView = new WebInspector.InspectorView();
// Screencast controller creates a root view itself.
- if (Capabilities.canScreencast)
+ if (mainTarget.canScreencast)
this._screencastController = new WebInspector.ScreencastController();
else
this._createRootView();

Powered by Google App Engine
This is Rietveld 408576698