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

Unified Diff: Source/devtools/front_end/screencast/ScreencastView.js

Issue 471013002: Use profiling lock in ScreencastView to detect if Timeline or Profiler is started (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8b1f616eb58661587e33a5e7b131c94484c01781 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();
-
+ WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.StateChanged, this._onProfilingStateChange, this);
this._updateGlasspane();
},
@@ -118,7 +111,7 @@ WebInspector.ScreencastView.prototype = {
_startCasting: function()
{
- if (this._timelineActive || this._profilerActive)
+ if (WebInspector.profilingLock().isAcquired())
return;
if (this._isCasting)
return;
@@ -189,23 +182,12 @@ 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 (WebInspector.profilingLock().isAcquired())
this._stopCasting();
else
this._startCasting();
@@ -217,11 +199,8 @@ WebInspector.ScreencastView.prototype = {
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 (WebInspector.profilingLock().isAcquired()) {
+ this._glassPaneElement.textContent = WebInspector.UIString("Profiling in progress");
this._glassPaneElement.classList.remove("hidden");
} else {
this._glassPaneElement.classList.add("hidden");
@@ -802,16 +781,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
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698