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

Unified Diff: Source/devtools/front_end/sdk/WorkspaceController.js

Issue 353743008: DevTools: Throttle file system refreshes on focus. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « Source/devtools/front_end/sdk/Workspace.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/WorkspaceController.js
diff --git a/Source/devtools/front_end/sdk/WorkspaceController.js b/Source/devtools/front_end/sdk/WorkspaceController.js
index 06ad17b14d9fd7f040d799b4d49f2cfb803215c0..47289bd3c31964dc6d4daaa1f1afffb9176ba75c 100644
--- a/Source/devtools/front_end/sdk/WorkspaceController.js
+++ b/Source/devtools/front_end/sdk/WorkspaceController.js
@@ -35,6 +35,7 @@ WebInspector.WorkspaceController = function(workspace)
{
this._workspace = workspace;
window.addEventListener("focus", this._windowFocused.bind(this), false);
+ this._fileSystemRefreshThrottler = new WebInspector.Throttler(1000);
}
WebInspector.WorkspaceController.prototype = {
@@ -43,19 +44,19 @@ WebInspector.WorkspaceController.prototype = {
*/
_windowFocused: function(event)
{
- if (this._fileSystemRefreshTimeout)
- return;
- this._fileSystemRefreshTimeout = setTimeout(refreshFileSystems.bind(this), 1000);
+ this._fileSystemRefreshThrottler.schedule(refreshFileSystems.bind(this));
/**
* @this {WebInspector.WorkspaceController}
+ * @param {!WebInspector.Throttler.FinishCallback} callback
*/
- function refreshFileSystems()
+ function refreshFileSystems(callback)
{
- delete this._fileSystemRefreshTimeout;
+ var barrier = new CallbackBarrier();
var projects = this._workspace.projects();
for (var i = 0; i < projects.length; ++i)
- projects[i].refresh("/");
+ projects[i].refresh("/", barrier.createCallback());
+ barrier.callWhenDone(callback);
}
}
}
« no previous file with comments | « Source/devtools/front_end/sdk/Workspace.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698