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

Side by Side Diff: Source/devtools/front_end/screencast/ScreencastView.js

Issue 614323003: DevTools: enable by default disableAgentsWhenProfile experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: unnecessary line was removed Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 this._isCasting = false; 88 this._isCasting = false;
89 this._context = this._canvasElement.getContext("2d"); 89 this._context = this._canvasElement.getContext("2d");
90 this._checkerboardPattern = this._createCheckerboardPattern(this._contex t); 90 this._checkerboardPattern = this._createCheckerboardPattern(this._contex t);
91 91
92 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({}) ; 92 this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({}) ;
93 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector. KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this); 93 this._shortcuts[WebInspector.KeyboardShortcut.makeKey("l", WebInspector. KeyboardShortcut.Modifiers.Ctrl)] = this._focusNavigationBar.bind(this);
94 94
95 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre eModel.EventTypes.ScreencastFrame, this._screencastFrame, this); 95 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre eModel.EventTypes.ScreencastFrame, this._screencastFrame, this);
96 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre eModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged , this); 96 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTre eModel.EventTypes.ScreencastVisibilityChanged, this._screencastVisibilityChanged , this);
97 97
98 WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.S tateChanged, this._onProfilingStateChange, this); 98 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.E vents.SuspendStateChanged, this._onSuspendStateChange, this);
99 this._updateGlasspane(); 99 this._updateGlasspane();
100 }, 100 },
101 101
102 wasShown: function() 102 wasShown: function()
103 { 103 {
104 this._startCasting(); 104 this._startCasting();
105 }, 105 },
106 106
107 willHide: function() 107 willHide: function()
108 { 108 {
109 this._stopCasting(); 109 this._stopCasting();
110 }, 110 },
111 111
112 _startCasting: function() 112 _startCasting: function()
113 { 113 {
114 if (WebInspector.profilingLock().isAcquired()) 114 if (WebInspector.targetManager.allTargetsSuspended())
115 return; 115 return;
116 if (this._isCasting) 116 if (this._isCasting)
117 return; 117 return;
118 this._isCasting = true; 118 this._isCasting = true;
119 119
120 const maxImageDimension = 2048; 120 const maxImageDimension = 2048;
121 var dimensions = this._viewportDimensions(); 121 var dimensions = this._viewportDimensions();
122 if (dimensions.width < 0 || dimensions.height < 0) { 122 if (dimensions.width < 0 || dimensions.height < 0) {
123 this._isCasting = false; 123 this._isCasting = false;
124 return; 124 return;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 */ 178 */
179 _screencastVisibilityChanged: function(event) 179 _screencastVisibilityChanged: function(event)
180 { 180 {
181 this._targetInactive = !event.data.visible; 181 this._targetInactive = !event.data.visible;
182 this._updateGlasspane(); 182 this._updateGlasspane();
183 }, 183 },
184 184
185 /** 185 /**
186 * @param {!WebInspector.Event} event 186 * @param {!WebInspector.Event} event
187 */ 187 */
188 _onProfilingStateChange: function(event) 188 _onSuspendStateChange: function(event)
189 { 189 {
190 if (WebInspector.profilingLock().isAcquired()) 190 if (WebInspector.targetManager.allTargetsSuspended())
191 this._stopCasting(); 191 this._stopCasting();
192 else 192 else
193 this._startCasting(); 193 this._startCasting();
194 this._updateGlasspane(); 194 this._updateGlasspane();
195 }, 195 },
196 196
197 _updateGlasspane: function() 197 _updateGlasspane: function()
198 { 198 {
199 if (this._targetInactive) { 199 if (this._targetInactive) {
200 this._glassPaneElement.textContent = WebInspector.UIString("The tab is inactive"); 200 this._glassPaneElement.textContent = WebInspector.UIString("The tab is inactive");
201 this._glassPaneElement.classList.remove("hidden"); 201 this._glassPaneElement.classList.remove("hidden");
202 } else if (WebInspector.profilingLock().isAcquired()) { 202 } else if (WebInspector.targetManager.allTargetsSuspended()) {
203 this._glassPaneElement.textContent = WebInspector.UIString("Profilin g in progress"); 203 this._glassPaneElement.textContent = WebInspector.UIString("Profilin g in progress");
204 this._glassPaneElement.classList.remove("hidden"); 204 this._glassPaneElement.classList.remove("hidden");
205 } else { 205 } else {
206 this._glassPaneElement.classList.add("hidden"); 206 this._glassPaneElement.classList.add("hidden");
207 } 207 }
208 }, 208 },
209 209
210 /** 210 /**
211 * @param {!Event} event 211 * @param {!Event} event
212 */ 212 */
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 return; 856 return;
857 this._maxDisplayedProgress = progress; 857 this._maxDisplayedProgress = progress;
858 this._displayProgress(progress); 858 this._displayProgress(progress);
859 }, 859 },
860 860
861 _displayProgress: function(progress) 861 _displayProgress: function(progress)
862 { 862 {
863 this._element.style.width = (100 * progress) + "%"; 863 this._element.style.width = (100 * progress) + "%";
864 } 864 }
865 }; 865 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698