Chromium Code Reviews| Index: Source/devtools/front_end/screencast/ScreencastView.js |
| diff --git a/Source/devtools/front_end/screencast/ScreencastView.js b/Source/devtools/front_end/screencast/ScreencastView.js |
| index ee5eb4b2bbc55f024aa429f627fc63a55d7af561..ed88309d69a08a651a25302e1aaf77fb9b05814d 100644 |
| --- a/Source/devtools/front_end/screencast/ScreencastView.js |
| +++ b/Source/devtools/front_end/screencast/ScreencastView.js |
| @@ -95,14 +95,7 @@ WebInspector.ScreencastView.prototype = { |
| WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastFrame, this._screencastFrame, this); |
| WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged, this); |
| - WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineStarted, this._onTimeline.bind(this), this); |
| - WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, WebInspector.TimelineManager.EventTypes.TimelineStopped, this._onTimeline.bind(this), this); |
| - this._timelineActive = this._isTimelineActive(); |
| - |
| - WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerModel, WebInspector.CPUProfilerModel.EventTypes.ProfileStarted, this._onProfiler.bind(this), this); |
| - WebInspector.targetManager.addModelListener(WebInspector.CPUProfilerModel, WebInspector.CPUProfilerModel.EventTypes.ProfileStopped, this._onProfiler.bind(this), this); |
| - this._profilerActive = this._isProfilerActive(); |
| - |
| + this._target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChange, this); |
|
sergeyv
2014/08/14 15:01:34
Lets make profiling lock global (not per target
yurys
2014/08/14 15:29:09
Done. Please take a look: https://codereview.chrom
|
| this._updateGlasspane(); |
| }, |
| @@ -118,7 +111,7 @@ WebInspector.ScreencastView.prototype = { |
| _startCasting: function() |
| { |
| - if (this._timelineActive || this._profilerActive) |
| + if (this._isProfiling()) |
| return; |
| if (this._isCasting) |
| return; |
| @@ -189,39 +182,30 @@ WebInspector.ScreencastView.prototype = { |
| this._updateGlasspane(); |
| }, |
| - _onTimeline: function() |
| - { |
| - this._timelineActive = this._isTimelineActive(); |
| - if (this._timelineActive) |
| - this._stopCasting(); |
| - else |
| - this._startCasting(); |
| - this._updateGlasspane(); |
| - }, |
| - |
| /** |
| * @param {!WebInspector.Event} event |
| */ |
| - _onProfiler: function(event) |
| + _onProfilingStateChange: function(event) |
| { |
| - this._profilerActive = this._isProfilerActive(); |
| - if (this._profilerActive) |
| + if (this._isProfiling()) |
| this._stopCasting(); |
| else |
| this._startCasting(); |
| this._updateGlasspane(); |
| }, |
| + _isProfiling: function() |
| + { |
| + return this._target.profilingLock.isAcquired(); |
| + }, |
| + |
| _updateGlasspane: function() |
| { |
| if (this._targetInactive) { |
| this._glassPaneElement.textContent = WebInspector.UIString("The tab is inactive"); |
| this._glassPaneElement.classList.remove("hidden"); |
| - } else if (this._timelineActive) { |
| - this._glassPaneElement.textContent = WebInspector.UIString("Timeline is active"); |
| - this._glassPaneElement.classList.remove("hidden"); |
| - } else if (this._profilerActive) { |
| - this._glassPaneElement.textContent = WebInspector.UIString("CPU profiler is active"); |
| + } else if (this._isProfiling()) { |
| + this._glassPaneElement.textContent = WebInspector.UIString("Profiling in progress"); |
| this._glassPaneElement.classList.remove("hidden"); |
| } else { |
| this._glassPaneElement.classList.add("hidden"); |
| @@ -802,16 +786,6 @@ WebInspector.ScreencastView.prototype = { |
| return true; |
| }, |
| - _isTimelineActive: function() |
| - { |
| - return WebInspector.targetManager.targets().some(function(target){ return target.timelineManager.isStarted();}); |
| - }, |
| - |
| - _isProfilerActive: function() |
| - { |
| - return WebInspector.targetManager.targets().some(function(target){ return target.cpuProfilerModel.isRecordingProfile();}); |
| - }, |
| - |
| __proto__: WebInspector.VBox.prototype |
| } |