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

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: Created 6 years, 10 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 dcb891da8a15bcbb906a1fb546d184669a959358..4d4fd1dd81f4cf825d71db81fa08d74daea77eca 100644
--- a/Source/devtools/front_end/inspector.js
+++ b/Source/devtools/front_end/inspector.js
@@ -293,11 +293,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 +314,25 @@ 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();
+ var mainTarget = WebInspector.targetManager.newConnectionAvailable(connection);
+ mainTarget.addEventListener(WebInspector.Target.Events.TargetIsReady, WebInspector._doLoadedDoneWithCapabilities.bind(WebInspector, mainTarget));
}
-WebInspector._doLoadedDoneWithCapabilities = function()
+WebInspector._doLoadedDoneWithCapabilities = function(mainTarget)
{
- new WebInspector.VersionController().updateVersion();
+ // compatibility code
+ Capabilities.canInspectWorkers = mainTarget.canInspectWorkers;
+ this.console = mainTarget.consoleModel;
+ this.networkManager = mainTarget.networkManager;
+ this.resourceTreeModel = mainTarget.resourceTreeModel;
+ this.debuggerModel = mainTarget.debuggerModel;
+ this.runtimeModel = mainTarget.runtimeModel;
+
+ this.domAgent = new WebInspector.DOMAgent();
+ this.workerManager = new WebInspector.WorkerManager(this.canInspectWorkers);
+ new WebInspector.VersionController().updateVersion();
WebInspector.shortcutsScreen = new WebInspector.ShortcutsScreen();
this._registerShortcuts();
@@ -333,19 +341,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.console);
- 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);
aandrey 2014/03/04 10:05:16 domAgent is one for many targets? what is "target"
sergeyv 2014/03/04 12:42:38 It is hard to add support of multiple target in al
- this.workerManager = new WebInspector.WorkerManager(Capabilities.canInspectWorkers);
- this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel);
this.zoomManager = new WebInspector.ZoomManager();
@@ -404,7 +406,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