Chromium Code Reviews| 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); |
|
dgozman
2015/11/05 01:13:50
If you already have uiSourceCode here, why issue a
|
| + }, |
| + |
| dispose: function() |
| { |
| this._workspace.removeProject(this._projectId); |