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

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

Issue 2391823002: [DevTools] Introduce Target.setAutoAttach. (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 604
605 /** 605 /**
606 * @param {!WebInspector.Target} target 606 * @param {!WebInspector.Target} target
607 * @return {?string} 607 * @return {?string}
608 */ 608 */
609 _serviceWorkerTargetIdForWorker: function(target) 609 _serviceWorkerTargetIdForWorker: function(target)
610 { 610 {
611 var parent = target.parentTarget(); 611 var parent = target.parentTarget();
612 if (!parent || parent.parentTarget() !== this._target) 612 if (!parent || parent.parentTarget() !== this._target)
613 return null; 613 return null;
614 if (this._subTargetsManager.targetType(parent) !== "service_worker") 614 var targetInfo = this._subTargetsManager.targetInfo(parent);
615 if (!targetInfo || targetInfo.type !== "service_worker")
615 return null; 616 return null;
616 return this._subTargetsManager.targetId(parent); 617 return targetInfo.id;
617 }, 618 },
618 619
619 _updateAllContextLabels: function() 620 _updateAllContextLabels: function()
620 { 621 {
621 for (var target of WebInspector.targetManager.targets()) { 622 for (var target of WebInspector.targetManager.targets()) {
622 var serviceWorkerTargetId = this._serviceWorkerTargetIdForWorker(tar get); 623 var serviceWorkerTargetId = this._serviceWorkerTargetIdForWorker(tar get);
623 if (!serviceWorkerTargetId) 624 if (!serviceWorkerTargetId)
624 continue; 625 continue;
625 var version = this._versionByTargetId.get(serviceWorkerTargetId) || null; 626 var version = this._versionByTargetId.get(serviceWorkerTargetId) || null;
626 for (var context of target.runtimeModel.executionContexts()) 627 for (var context of target.runtimeModel.executionContexts())
627 this._updateContextLabel(context, version); 628 this._updateContextLabel(context, version);
628 } 629 }
629 }, 630 },
630 631
631 /** 632 /**
632 * @param {!WebInspector.ExecutionContext} context 633 * @param {!WebInspector.ExecutionContext} context
633 * @param {?WebInspector.ServiceWorkerVersion} version 634 * @param {?WebInspector.ServiceWorkerVersion} version
634 */ 635 */
635 _updateContextLabel: function(context, version) 636 _updateContextLabel: function(context, version)
636 { 637 {
637 var parsedUrl = context.origin.asParsedURL(); 638 var parsedUrl = context.origin.asParsedURL();
638 var label = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : cont ext.name; 639 var label = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : cont ext.name;
639 if (version) 640 if (version)
640 context.setLabel(label + " #" + version.id + " (" + version.status + ")"); 641 context.setLabel(label + " #" + version.id + " (" + version.status + ")");
641 else 642 else
642 context.setLabel(label); 643 context.setLabel(label);
643 }, 644 },
644 } 645 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698