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

Unified Diff: Source/devtools/front_end/sdk/IsolatedFileSystem.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
Index: Source/devtools/front_end/sdk/IsolatedFileSystem.js
diff --git a/Source/devtools/front_end/sdk/IsolatedFileSystem.js b/Source/devtools/front_end/sdk/IsolatedFileSystem.js
index 8201cc63a16f62b52d31fa031b1648228013eefc..7fce01076da8657327bbbd456aaecc62a96066cb 100644
--- a/Source/devtools/front_end/sdk/IsolatedFileSystem.js
+++ b/Source/devtools/front_end/sdk/IsolatedFileSystem.js
@@ -109,13 +109,15 @@ WebInspector.IsolatedFileSystem.prototype = {
/**
* @param {string} path
- * @param {function(string)} callback
+ * @param {function(string)} fileCallback
+ * @param {function()=} finishedCallback
*/
- requestFilesRecursive: function(path, callback)
+ requestFilesRecursive: function(path, fileCallback, finishedCallback)
{
this._requestFileSystem(fileSystemLoaded.bind(this));
var domFileSystem;
+ var pendingRequests = 0;
/**
* @param {?DOMFileSystem} fs
* @this {WebInspector.IsolatedFileSystem}
@@ -124,6 +126,7 @@ WebInspector.IsolatedFileSystem.prototype = {
{
domFileSystem = /** @type {!DOMFileSystem} */ (fs);
console.assert(domFileSystem);
+ ++pendingRequests;
this._requestEntries(domFileSystem, path, innerCallback.bind(this));
}
@@ -138,14 +141,17 @@ WebInspector.IsolatedFileSystem.prototype = {
if (!entry.isDirectory) {
if (this._manager.mapping().isFileExcluded(this._path, entry.fullPath))
continue;
- callback(entry.fullPath.substr(1));
+ fileCallback(entry.fullPath.substr(1));
}
else {
if (this._manager.mapping().isFileExcluded(this._path, entry.fullPath + "/"))
continue;
+ ++pendingRequests;
this._requestEntries(domFileSystem, entry.fullPath, innerCallback.bind(this));
}
}
+ if (finishedCallback && (--pendingRequests === 0))
+ finishedCallback();
}
},

Powered by Google App Engine
This is Rietveld 408576698