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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js

Issue 1422463007: DevTools: use inotify to pick changes on the filesystem. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 5 years, 1 month 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: third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js b/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
index d4e51a18ad8a51d2ac582fee131cdeee9397d2d9..d8e69f0e971539d59af0b4146515a6c904322497 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/FileSystemWorkspaceBinding.js
@@ -39,6 +39,7 @@ WebInspector.FileSystemWorkspaceBinding = function(isolatedFileSystemManager, wo
this._workspace = workspace;
this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
+ this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemFilesChanged, this._fileSystemFilesChanged, this);
/** @type {!Map.<string, !WebInspector.FileSystemWorkspaceBinding.FileSystem>} */
this._boundFileSystems = new Map();
@@ -98,6 +99,22 @@ WebInspector.FileSystemWorkspaceBinding.prototype = {
},
/**
+ * @param {!WebInspector.Event} event
+ */
+ _fileSystemFilesChanged: function(event)
+ {
+ var paths = /** @type {!Array<string>} */ (event.data);
+ for (var path of paths) {
+ var normalizedPath = WebInspector.IsolatedFileSystem.normalizePath(path);
+ for (var key of this._boundFileSystems.keys()) {
+ if (!normalizedPath.startsWith(key))
+ continue;
+ this._boundFileSystems.get(key)._fileChanged(normalizedPath.substr(key.length + 1));
+ }
+ }
+ },
+
+ /**
* @param {string} projectId
* @return {string}
*/
@@ -233,7 +250,7 @@ WebInspector.FileSystemWorkspaceBinding.FileSystem = function(fileSystemWorkspac
this._projectId = WebInspector.FileSystemWorkspaceBinding.projectId(this._fileSystem.path());
console.assert(!this._workspace.project(this._projectId));
- this._workspace.addProject(this._projectId, this);
+ this._project = this._workspace.addProject(this._projectId, this);
this.populate();
}
@@ -617,6 +634,19 @@ WebInspector.FileSystemWorkspaceBinding.FileSystem.prototype = {
this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileRemoved, path);
},
+ /**
+ * @param {string} path
+ */
+ _fileChanged: function(path)
+ {
+ var uiSourceCode = this._project.uiSourceCode(path);
+ if (!uiSourceCode) {
+ this._addFile(path);
+ return;
+ }
+ this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileChanged, path);
+ },
+
dispose: function()
{
this._workspace.removeProject(this._projectId);

Powered by Google App Engine
This is Rietveld 408576698