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

Side by Side Diff: Source/devtools/front_end/emulation/MediaQueryInspector.js

Issue 1285183006: DevTools: WI.Throttler goes promisified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cc
Patch Set: remove dependent patchset Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.Widget} 7 * @extends {WebInspector.Widget}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.MediaQueryInspector = function() 10 WebInspector.MediaQueryInspector = function()
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 WebInspector.Revealer.reveal(location); 168 WebInspector.Revealer.reveal(location);
169 }, 169 },
170 170
171 _scheduleMediaQueriesUpdate: function() 171 _scheduleMediaQueriesUpdate: function()
172 { 172 {
173 if (!this._enabled) 173 if (!this._enabled)
174 return; 174 return;
175 this._mediaThrottler.schedule(this._refetchMediaQueries.bind(this)); 175 this._mediaThrottler.schedule(this._refetchMediaQueries.bind(this));
176 }, 176 },
177 177
178 /** 178 _refetchMediaQueries: function()
179 * @param {!WebInspector.Throttler.FinishCallback} finishCallback
180 */
181 _refetchMediaQueries: function(finishCallback)
182 { 179 {
183 if (!this._enabled || !this._cssModel) { 180 if (!this._enabled || !this._cssModel)
184 finishCallback(); 181 return Promise.resolve();
185 return;
186 }
187 182
188 this._cssModel.mediaQueriesPromise() 183 return this._cssModel.mediaQueriesPromise()
189 .then(this._rebuildMediaQueries.bind(this)) 184 .then(this._rebuildMediaQueries.bind(this))
190 .then(finishCallback)
191 .catch(finishCallback);
192 }, 185 },
193 186
194 /** 187 /**
195 * @param {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} mod els 188 * @param {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} mod els
196 * @return {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} 189 * @return {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>}
197 */ 190 */
198 _squashAdjacentEqual: function(models) 191 _squashAdjacentEqual: function(models)
199 { 192 {
200 var filtered = []; 193 var filtered = [];
201 for (var i = 0; i < models.length; ++i) { 194 for (var i = 0; i < models.length; ++i) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 }, 494 },
502 495
503 /** 496 /**
504 * @return {boolean} 497 * @return {boolean}
505 */ 498 */
506 active: function() 499 active: function()
507 { 500 {
508 return this._active; 501 return this._active;
509 } 502 }
510 } 503 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/StylesSidebarPane.js ('k') | Source/devtools/front_end/emulation/OverridesSupport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698