| Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| index c45b38f0ae489c0c0987e2a570e55d56c05ee5a0..63c929dc42a5d71e0987049992f3c8e248a06bc6 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
|
| @@ -207,6 +207,7 @@ WebInspector.Main.prototype = {
|
| WebInspector.ShortcutsScreen.registerShortcuts();
|
| this._registerForwardedShortcuts();
|
| this._registerMessageSinkListener();
|
| + new WebInspector.Main.InspectorDomainObserver();
|
|
|
| self.runtime.extension(WebInspector.AppProvider).instance().then(this._showAppUI.bind(this));
|
| console.timeEnd("Main._createAppUI");
|
| @@ -266,77 +267,18 @@ WebInspector.Main.prototype = {
|
|
|
| _initializeTarget: function()
|
| {
|
| - this._connectAndCreateTarget();
|
| + console.time("Main._initializeTarget");
|
| + WebInspector.targetManager.connectToMainTarget(webSocketConnectionLost);
|
| +
|
| InspectorFrontendHost.readyForTest();
|
| - WebInspector.targetManager.setMainConnectionInterceptor(this._interceptMainConnection.bind(this));
|
| // Asynchronously run the extensions.
|
| setTimeout(this._lateInitialization.bind(this), 100);
|
| - },
|
| -
|
| - _connectAndCreateTarget: function()
|
| - {
|
| - console.time("Main._connectAndCreateTarget");
|
| -
|
| - 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.Target;
|
| - if (Runtime.queryParam("isSharedWorker")) {
|
| - capabilities =
|
| - WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.Log |
|
| - WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Target;
|
| - } else if (Runtime.queryParam("v8only")) {
|
| - capabilities = WebInspector.Target.Capability.JS;
|
| - }
|
| -
|
| - var target = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, this._createMainConnection.bind(this), null);
|
| - target.registerInspectorDispatcher(new WebInspector.Main.InspectorDomainDispatcher(target));
|
| - target.runtimeAgent().runIfWaitingForDebugger();
|
| - if (target.hasBrowserCapability())
|
| - target.inspectorAgent().enable();
|
| -
|
| - console.timeEnd("Main._connectAndCreateTarget");
|
| - },
|
| -
|
| - /**
|
| - * @param {function(string)} onMessage
|
| - * @return {!Promise<!InspectorBackendClass.Connection>}
|
| - */
|
| - _interceptMainConnection: function(onMessage)
|
| - {
|
| - var params = {
|
| - onMessage: onMessage,
|
| - onDisconnect: this._connectAndCreateTarget.bind(this)
|
| - };
|
| - return this._connection.disconnect().then(this._createMainConnection.bind(this, params));
|
| - },
|
| -
|
| - /**
|
| - * @param {!InspectorBackendClass.Connection.Params} params
|
| - * @return {!InspectorBackendClass.Connection}
|
| - */
|
| - _createMainConnection: function(params)
|
| - {
|
| - if (Runtime.queryParam("ws")) {
|
| - var ws = "ws://" + Runtime.queryParam("ws");
|
| - params.onDisconnect = onDisconnect.bind(null, params.onDisconnect);
|
| - this._connection = new WebInspector.WebSocketConnection(ws, params);
|
| - } else if (InspectorFrontendHost.isHostedMode()) {
|
| - this._connection = new WebInspector.StubConnection(params);
|
| - } else {
|
| - this._connection = new WebInspector.MainConnection(params);
|
| - }
|
| - return this._connection;
|
| + console.timeEnd("Main._initializeTarget");
|
|
|
| - /**
|
| - * @param {function(string)} callback
|
| - * @param {string} reason
|
| - */
|
| - function onDisconnect(callback, reason)
|
| + function webSocketConnectionLost()
|
| {
|
| if (!WebInspector._disconnectedScreenWithReasonWasShown)
|
| - WebInspector.RemoteDebuggingTerminatedScreen.show(reason);
|
| - callback(reason);
|
| + WebInspector.RemoteDebuggingTerminatedScreen.show("WebSocket disconnected");
|
| }
|
| },
|
|
|
| @@ -555,6 +497,35 @@ WebInspector.Main.prototype = {
|
|
|
| /**
|
| * @constructor
|
| + * @implements {WebInspector.TargetManager.Observer}
|
| + */
|
| +WebInspector.Main.InspectorDomainObserver = function()
|
| +{
|
| + WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Browser);
|
| +};
|
| +
|
| +WebInspector.Main.InspectorDomainObserver.prototype = {
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.Target} target
|
| + */
|
| + targetAdded: function(target)
|
| + {
|
| + target.registerInspectorDispatcher(new WebInspector.Main.InspectorDomainDispatcher(target));
|
| + target.inspectorAgent().enable();
|
| + },
|
| +
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.Target} target
|
| + */
|
| + targetRemoved: function(target)
|
| + {
|
| + },
|
| +};
|
| +
|
| +/**
|
| + * @constructor
|
| * @implements {InspectorAgent.Dispatcher}
|
| * @param {!WebInspector.Target} target
|
| */
|
|
|