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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/SubTargetsManager.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.SDKModel} 7 * @extends {WebInspector.SDKModel}
8 * @param {!WebInspector.Target} target 8 * @param {!WebInspector.Target} target
9 */ 9 */
10 WebInspector.SubTargetsManager = function(target) 10 WebInspector.SubTargetsManager = function(target)
11 { 11 {
12 WebInspector.SDKModel.call(this, WebInspector.SubTargetsManager, target); 12 WebInspector.SDKModel.call(this, WebInspector.SubTargetsManager, target);
13 target.registerTargetDispatcher(new WebInspector.SubTargetsDispatcher(this)) ; 13 target.registerTargetDispatcher(new WebInspector.SubTargetsDispatcher(this)) ;
14 this._lastAnonymousTargetId = 0; 14 this._lastAnonymousTargetId = 0;
15 this._agent = target.targetAgent(); 15 this._agent = target.targetAgent();
16 16
17 /** @type {!Map<string, !WebInspector.Target>} */ 17 /** @type {!Map<string, !WebInspector.Target>} */
18 this._attachedTargets = new Map(); 18 this._attachedTargets = new Map();
19 /** @type {!Map<string, !WebInspector.SubTargetConnection>} */ 19 /** @type {!Map<string, !WebInspector.SubTargetConnection>} */
20 this._connections = new Map(); 20 this._connections = new Map();
21 21
22 this._agent.setAutoAttach(true /* autoAttach */, true /* waitForDebuggerOnSt art */); 22 this._agent.setAutoAttach(true /* autoAttach */, true /* waitForDebuggerOnSt art */);
23 this._agent.setAttachToFrames(Runtime.experiments.isEnabled("autoAttachToCro ssProcessSubframes")); 23 this._agent.setAttachToFrames(Runtime.experiments.isEnabled("autoAttachToCro ssProcessSubframes"));
24 24
25 if (Runtime.experiments.isEnabled("nodeDebugging") && !target.parentTarget() ) { 25 if (Runtime.experiments.isEnabled("nodeDebugging") && !target.parentTarget() ) {
26 var defaultLocations = [{host: "localhost", port: 9229}]; 26 var defaultLocations = [{host: "localhost", port: 9229}];
27 this._agent.setRemoteLocations(defaultLocations); 27 this._agent.setRemoteLocations(defaultLocations);
28 this._agent.setDiscoverTargets(true); 28 this._agent.setDiscoverTargets(true);
29 } 29 }
30 } 30 };
31 31
32 /** @enum {symbol} */ 32 /** @enum {symbol} */
33 WebInspector.SubTargetsManager.Events = { 33 WebInspector.SubTargetsManager.Events = {
34 SubTargetAdded: Symbol("SubTargetAdded"), 34 SubTargetAdded: Symbol("SubTargetAdded"),
35 SubTargetRemoved: Symbol("SubTargetRemoved"), 35 SubTargetRemoved: Symbol("SubTargetRemoved"),
36 } 36 };
37 37
38 WebInspector.SubTargetsManager._InfoSymbol = Symbol("SubTargetInfo"); 38 WebInspector.SubTargetsManager._InfoSymbol = Symbol("SubTargetInfo");
39 39
40 WebInspector.SubTargetsManager.prototype = { 40 WebInspector.SubTargetsManager.prototype = {
41 /** 41 /**
42 * @override 42 * @override
43 * @return {!Promise} 43 * @return {!Promise}
44 */ 44 */
45 suspendModel: function() 45 suspendModel: function()
46 { 46 {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 function innerCallback(error, targetInfo) 94 function innerCallback(error, targetInfo)
95 { 95 {
96 if (error) { 96 if (error) {
97 console.error(error); 97 console.error(error);
98 callback(null); 98 callback(null);
99 return; 99 return;
100 } 100 }
101 if (targetInfo) 101 if (targetInfo)
102 callback(new WebInspector.TargetInfo(targetInfo)); 102 callback(new WebInspector.TargetInfo(targetInfo));
103 else 103 else
104 callback(null) 104 callback(null);
105 } 105 }
106 this._agent.getTargetInfo(targetId, innerCallback); 106 this._agent.getTargetInfo(targetId, innerCallback);
107 }, 107 },
108 108
109 /** 109 /**
110 * @param {string} targetId 110 * @param {string} targetId
111 * @return {?WebInspector.Target} 111 * @return {?WebInspector.Target}
112 */ 112 */
113 targetForId: function(targetId) 113 targetForId: function(targetId)
114 { 114 {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 /** 210 /**
211 * @param {string} targetId 211 * @param {string} targetId
212 */ 212 */
213 _targetDestroyed: function(targetId) 213 _targetDestroyed: function(targetId)
214 { 214 {
215 // All the work is done in _detachedFromTarget. 215 // All the work is done in _detachedFromTarget.
216 }, 216 },
217 217
218 __proto__: WebInspector.SDKModel.prototype 218 __proto__: WebInspector.SDKModel.prototype
219 } 219 };
220 220
221 /** 221 /**
222 * @constructor 222 * @constructor
223 * @implements {TargetAgent.Dispatcher} 223 * @implements {TargetAgent.Dispatcher}
224 * @param {!WebInspector.SubTargetsManager} manager 224 * @param {!WebInspector.SubTargetsManager} manager
225 */ 225 */
226 WebInspector.SubTargetsDispatcher = function(manager) 226 WebInspector.SubTargetsDispatcher = function(manager)
227 { 227 {
228 this._manager = manager; 228 this._manager = manager;
229 } 229 };
230 230
231 WebInspector.SubTargetsDispatcher.prototype = { 231 WebInspector.SubTargetsDispatcher.prototype = {
232 /** 232 /**
233 * @override 233 * @override
234 * @param {!TargetAgent.TargetInfo} targetInfo 234 * @param {!TargetAgent.TargetInfo} targetInfo
235 */ 235 */
236 targetCreated: function(targetInfo) 236 targetCreated: function(targetInfo)
237 { 237 {
238 this._manager._targetCreated(new WebInspector.TargetInfo(targetInfo)); 238 this._manager._targetCreated(new WebInspector.TargetInfo(targetInfo));
239 }, 239 },
(...skipping 28 matching lines...) Expand all
268 268
269 /** 269 /**
270 * @override 270 * @override
271 * @param {string} targetId 271 * @param {string} targetId
272 * @param {string} message 272 * @param {string} message
273 */ 273 */
274 receivedMessageFromTarget: function(targetId, message) 274 receivedMessageFromTarget: function(targetId, message)
275 { 275 {
276 this._manager._receivedMessageFromTarget(targetId, message); 276 this._manager._receivedMessageFromTarget(targetId, message);
277 } 277 }
278 } 278 };
279 279
280 /** 280 /**
281 * @constructor 281 * @constructor
282 * @extends {InspectorBackendClass.Connection} 282 * @extends {InspectorBackendClass.Connection}
283 * @param {!Protocol.TargetAgent} agent 283 * @param {!Protocol.TargetAgent} agent
284 * @param {string} targetId 284 * @param {string} targetId
285 */ 285 */
286 WebInspector.SubTargetConnection = function(agent, targetId) 286 WebInspector.SubTargetConnection = function(agent, targetId)
287 { 287 {
288 InspectorBackendClass.Connection.call(this); 288 InspectorBackendClass.Connection.call(this);
289 this._agent = agent; 289 this._agent = agent;
290 this._targetId = targetId; 290 this._targetId = targetId;
291 } 291 };
292 292
293 WebInspector.SubTargetConnection.prototype = { 293 WebInspector.SubTargetConnection.prototype = {
294 /** 294 /**
295 * @override 295 * @override
296 * @param {!Object} messageObject 296 * @param {!Object} messageObject
297 */ 297 */
298 sendMessage: function(messageObject) 298 sendMessage: function(messageObject)
299 { 299 {
300 this._agent.sendMessageToTarget(this._targetId, JSON.stringify(messageOb ject)); 300 this._agent.sendMessageToTarget(this._targetId, JSON.stringify(messageOb ject));
301 }, 301 },
302 302
303 /** 303 /**
304 * @override 304 * @override
305 */ 305 */
306 forceClose: function() 306 forceClose: function()
307 { 307 {
308 this._agent.detachFromTarget(this._targetId); 308 this._agent.detachFromTarget(this._targetId);
309 }, 309 },
310 310
311 _reportClosed: function() 311 _reportClosed: function()
312 { 312 {
313 this.connectionClosed("target_terminated"); 313 this.connectionClosed("target_terminated");
314 }, 314 },
315 315
316 __proto__: InspectorBackendClass.Connection.prototype 316 __proto__: InspectorBackendClass.Connection.prototype
317 } 317 };
318 318
319 /** 319 /**
320 * @constructor 320 * @constructor
321 * @param {!TargetAgent.TargetInfo} payload 321 * @param {!TargetAgent.TargetInfo} payload
322 */ 322 */
323 WebInspector.TargetInfo = function(payload) 323 WebInspector.TargetInfo = function(payload)
324 { 324 {
325 this.id = payload.targetId; 325 this.id = payload.targetId;
326 this.url = payload.url; 326 this.url = payload.url;
327 this.type = payload.type; 327 this.type = payload.type;
328 if (this.type !== "page" && this.type !== "iframe") { 328 if (this.type !== "page" && this.type !== "iframe") {
329 this.title = WebInspector.UIString("Worker: %s", this.url); 329 this.title = WebInspector.UIString("Worker: %s", this.url);
330 this.canActivate = false; 330 this.canActivate = false;
331 } else { 331 } else {
332 this.title = payload.title; 332 this.title = payload.title;
333 this.canActivate = true; 333 this.canActivate = true;
334 } 334 }
335 } 335 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698