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

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

Issue 2956423003: [DevTools] Provide Target.targetInfoChanged notification (Closed)
Patch Set: Created 3 years, 5 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 | « third_party/WebKit/Source/core/inspector/browser_protocol.json ('k') | no next file » | 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 SDK.TargetManager = class extends Common.Object { 7 SDK.TargetManager = class extends Common.Object {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 /** @type {!Array.<!SDK.Target>} */ 10 /** @type {!Array.<!SDK.Target>} */
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 483 }
484 484
485 /** 485 /**
486 * @override 486 * @override
487 * @param {!Protocol.Target.TargetInfo} targetInfo 487 * @param {!Protocol.Target.TargetInfo} targetInfo
488 */ 488 */
489 targetCreated(targetInfo) { 489 targetCreated(targetInfo) {
490 if (targetInfo.type !== 'node') 490 if (targetInfo.type !== 'node')
491 return; 491 return;
492 if (Runtime.queryParam('nodeFrontend')) { 492 if (Runtime.queryParam('nodeFrontend')) {
493 this._targetAgent.attachToTarget(targetInfo.targetId); 493 if (!targetInfo.attached)
caseq 2017/06/29 20:36:17 This is still prone to races. So perhaps try attac
dgozman 2017/06/29 21:31:23 Acknowledged.
494 } else { 494 this._targetAgent.attachToTarget(targetInfo.targetId);
495 this._targetManager._nodeTargetIds.add(targetInfo.targetId); 495 return;
496 }
497 if (targetInfo.attached)
498 return;
499 this._targetManager._nodeTargetIds.add(targetInfo.targetId);
500 this._targetManager.dispatchEventToListeners(SDK.TargetManager.Events.Availa bleNodeTargetsChanged);
501 }
502
503 /**
504 * @override
505 * @param {!Protocol.Target.TargetInfo} targetInfo
506 */
507 targetInfoChanged(targetInfo) {
508 if (targetInfo.type !== 'node' || Runtime.queryParam('nodeFrontend'))
509 return;
510 var availableIds = this._targetManager._nodeTargetIds;
511 if (!availableIds.has(targetInfo.targetId) && !targetInfo.attached) {
512 availableIds.add(targetInfo.targetId);
513 this._targetManager.dispatchEventToListeners(SDK.TargetManager.Events.Avai lableNodeTargetsChanged);
514 } else if (availableIds.has(targetInfo.targetId) && targetInfo.attached) {
515 availableIds.delete(targetInfo.targetId);
496 this._targetManager.dispatchEventToListeners(SDK.TargetManager.Events.Avai lableNodeTargetsChanged); 516 this._targetManager.dispatchEventToListeners(SDK.TargetManager.Events.Avai lableNodeTargetsChanged);
497 } 517 }
498 } 518 }
499 519
500 /** 520 /**
501 * @override 521 * @override
502 * @param {string} targetId 522 * @param {string} targetId
503 */ 523 */
504 targetDestroyed(targetId) { 524 targetDestroyed(targetId) {
505 if (Runtime.queryParam('nodeFrontend') || !this._targetManager._nodeTargetId s.has(targetId)) 525 if (Runtime.queryParam('nodeFrontend') || !this._targetManager._nodeTargetId s.has(targetId))
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 /** 664 /**
645 * @param {!T} model 665 * @param {!T} model
646 */ 666 */
647 modelRemoved(model) {}, 667 modelRemoved(model) {},
648 }; 668 };
649 669
650 /** 670 /**
651 * @type {!SDK.TargetManager} 671 * @type {!SDK.TargetManager}
652 */ 672 */
653 SDK.targetManager = new SDK.TargetManager(); 673 SDK.targetManager = new SDK.TargetManager();
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/browser_protocol.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698