Index: Source/devtools/front_end/profiler/ProfilesPanel.js |
diff --git a/Source/devtools/front_end/profiler/ProfilesPanel.js b/Source/devtools/front_end/profiler/ProfilesPanel.js |
index 44dd77b7ee2425cbda916e7ccc53a3ebf259cdf3..81f16168e936236e9b45937c5238994d52ddb060 100644 |
--- a/Source/devtools/front_end/profiler/ProfilesPanel.js |
+++ b/Source/devtools/front_end/profiler/ProfilesPanel.js |
@@ -238,9 +238,9 @@ |
setProfileBeingRecorded: function(profile) |
{ |
if (this._profileBeingRecorded && this._profileBeingRecorded.target()) |
- WebInspector.profilingLock.release(); |
+ this._profileBeingRecorded.target().profilingLock.release(); |
if (profile && profile.target()) |
- WebInspector.profilingLock.acquire(); |
+ profile.target().profilingLock.acquire(); |
this._profileBeingRecorded = profile; |
}, |
@@ -440,6 +440,7 @@ |
* @constructor |
* @implements {WebInspector.Searchable} |
* @implements {WebInspector.ProfileType.DataDisplayDelegate} |
+ * @implements {WebInspector.TargetManager.Observer} |
* @extends {WebInspector.PanelWithSidebarTree} |
*/ |
WebInspector.ProfilesPanel = function() |
@@ -500,10 +501,26 @@ |
this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true); |
this._registerShortcuts(); |
- WebInspector.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this); |
+ WebInspector.targetManager.observeTargets(this); |
} |
WebInspector.ProfilesPanel.prototype = { |
+ /** |
+ * @param {!WebInspector.Target} target |
+ */ |
+ targetAdded: function(target) |
+ { |
+ target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this); |
+ }, |
+ |
+ /** |
+ * @param {!WebInspector.Target} target |
+ */ |
+ targetRemoved: function(target) |
+ { |
+ target.profilingLock.removeEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChanged, this); |
+ }, |
+ |
/** |
* @return {!WebInspector.SearchableView} |
*/ |
@@ -600,7 +617,7 @@ |
{ |
if (WebInspector.experimentsSettings.disableAgentsWhenProfile.isEnabled()) |
WebInspector.inspectorView.setCurrentPanelLocked(toggled); |
- var isAcquiredInSomeTarget = WebInspector.profilingLock.isAcquired(); |
+ var isAcquiredInSomeTarget = WebInspector.targetManager.targets().some(function(target) { return target.profilingLock.isAcquired(); }); |
var enable = toggled || !isAcquiredInSomeTarget; |
this.recordButton.setEnabled(enable); |
this.recordButton.toggled = toggled; |