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

Side by Side Diff: Source/devtools/front_end/Target.js

Issue 201123007: DevTools: Create target per each worker behind experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master 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 unified diff | Download patch
« no previous file with comments | « Source/devtools/front_end/Main.js ('k') | Source/devtools/front_end/WorkerManager.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /** 7 /**
8 * @constructor 8 * @constructor
9 * @extends {Protocol.Agents} 9 * @extends {Protocol.Agents}
10 * @param {!InspectorBackendClass.Connection} connection 10 * @param {!InspectorBackendClass.Connection} connection
11 * @param {function(!WebInspector.Target)=} callback 11 * @param {function(!WebInspector.Target)=} callback
12 */ 12 */
13 WebInspector.Target = function(connection, callback) 13 WebInspector.Target = function(connection, callback)
14 { 14 {
15 Protocol.Agents.call(this, connection.agentsMap()); 15 Protocol.Agents.call(this, connection.agentsMap());
16 this._connection = connection; 16 this._connection = connection;
17 this.isMainFrontend = false; 17 this.isMainFrontend = false;
18 18
19 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null)); 19 this.pageAgent().canScreencast(this._initializeCapability.bind(this, "canScr eencast", null));
20 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " isMainFrontend", this._loadedWithCapabilities.bind(this, callback))); 20 this.workerAgent().canInspectWorkers(this._initializeCapability.bind(this, " isMainFrontend", this._loadedWithCapabilities.bind(this, callback)));
21 } 21 }
22 22
23 WebInspector.Target.prototype = { 23 WebInspector.Target.prototype = {
24 24
25 _initializeCapability: function(name, callback, error, result) 25 _initializeCapability: function(name, callback, error, result)
26 { 26 {
27 this[name] = result; 27 this[name] = result;
28 Capabilities[name] = result; 28 if (!Capabilities[name])
29 Capabilities[name] = result;
29 if (callback) 30 if (callback)
30 callback(); 31 callback();
31 }, 32 },
32 33
33 /** 34 /**
34 * @param {function(!WebInspector.Target)=} callback 35 * @param {function(!WebInspector.Target)=} callback
35 */ 36 */
36 _loadedWithCapabilities: function(callback) 37 _loadedWithCapabilities: function(callback)
37 { 38 {
38 this.consoleModel = new WebInspector.ConsoleModel(this); 39 this.consoleModel = new WebInspector.ConsoleModel(this);
39 //This and similar lines are needed for compatibility 40 //This and similar lines are needed for compatibility
40 WebInspector.console = this.consoleModel; 41 if (!WebInspector.console)
42 WebInspector.console = this.consoleModel;
43
41 this.networkManager = new WebInspector.NetworkManager(this); 44 this.networkManager = new WebInspector.NetworkManager(this);
42 WebInspector.networkManager = this.networkManager; 45 if (!WebInspector.networkManager)
46 WebInspector.networkManager = this.networkManager;
47
43 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this); 48 this.resourceTreeModel = new WebInspector.ResourceTreeModel(this);
44 WebInspector.resourceTreeModel = this.resourceTreeModel; 49 if (!WebInspector.resourceTreeModel)
50 WebInspector.resourceTreeModel = this.resourceTreeModel;
51
45 this.debuggerModel = new WebInspector.DebuggerModel(this); 52 this.debuggerModel = new WebInspector.DebuggerModel(this);
46 WebInspector.debuggerModel = this.debuggerModel; 53 if (!WebInspector.debuggerModel)
54 WebInspector.debuggerModel = this.debuggerModel;
55
47 this.runtimeModel = new WebInspector.RuntimeModel(this); 56 this.runtimeModel = new WebInspector.RuntimeModel(this);
48 WebInspector.runtimeModel = this.runtimeModel; 57 if (!WebInspector.runtimeModel)
58 WebInspector.runtimeModel = this.runtimeModel;
49 59
50 //we can't name it domAgent, because it clashes with function, WebInspec tor.DOMAgent should be renamed to DOMModel 60 //we can't name it domAgent, because it clashes with function, WebInspec tor.DOMAgent should be renamed to DOMModel
51 this.domModel = new WebInspector.DOMAgent(); 61 this.domModel = new WebInspector.DOMAgent();
52 WebInspector.domAgent = this.domModel; 62 if (!WebInspector.domAgent)
63 WebInspector.domAgent = this.domModel;
64
53 this.workerManager = new WebInspector.WorkerManager(this.isMainFrontend) ; 65 this.workerManager = new WebInspector.WorkerManager(this.isMainFrontend) ;
54 WebInspector.workerManager = this.workerManager; 66 if (!WebInspector.workerManager)
67 WebInspector.workerManager = this.workerManager;
55 68
56 if (callback) 69 if (callback)
57 callback(this); 70 callback(this);
58 }, 71 },
59 72
60 /** 73 /**
61 * @override 74 * @override
62 * @param {string} domain 75 * @param {string} domain
63 * @param {!Object} dispatcher 76 * @param {!Object} dispatcher
64 */ 77 */
(...skipping 28 matching lines...) Expand all
93 * @param {!InspectorBackendClass.Connection} connection 106 * @param {!InspectorBackendClass.Connection} connection
94 * @param {function(!WebInspector.Target)=} callback 107 * @param {function(!WebInspector.Target)=} callback
95 */ 108 */
96 createTarget: function(connection, callback) 109 createTarget: function(connection, callback)
97 { 110 {
98 var newTarget = new WebInspector.Target(connection, callback); 111 var newTarget = new WebInspector.Target(connection, callback);
99 this._targets.push(newTarget); 112 this._targets.push(newTarget);
100 } 113 }
101 114
102 } 115 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/Main.js ('k') | Source/devtools/front_end/WorkerManager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698