| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 var fileSystem = /** @type {!Workspace.IsolatedFileSystem} */ (event.data); | 143 var fileSystem = /** @type {!Workspace.IsolatedFileSystem} */ (event.data); |
| 144 var boundFileSystem = this._boundFileSystems.get(fileSystem.path()); | 144 var boundFileSystem = this._boundFileSystems.get(fileSystem.path()); |
| 145 boundFileSystem.dispose(); | 145 boundFileSystem.dispose(); |
| 146 this._boundFileSystems.remove(fileSystem.path()); | 146 this._boundFileSystems.remove(fileSystem.path()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 /** | 149 /** |
| 150 * @param {!Common.Event} event | 150 * @param {!Common.Event} event |
| 151 */ | 151 */ |
| 152 _fileSystemFilesChanged(event) { | 152 _fileSystemFilesChanged(event) { |
| 153 var paths = /** @type {!Array<string>} */ (event.data); | 153 var paths = /** @type {!Workspace.IsolatedFileSystemManager.FilesChangedData
} */ (event.data); |
| 154 for (var path of paths) { | 154 forEachFile.call(this, paths.changed, (path, fileSystem) => fileSystem._file
Changed(path)); |
| 155 for (var key of this._boundFileSystems.keys()) { | 155 forEachFile.call(this, paths.added, (path, fileSystem) => fileSystem._fileCh
anged(path)); |
| 156 if (!path.startsWith(key)) | 156 forEachFile.call(this, paths.removed, (path, fileSystem) => fileSystem.remov
eUISourceCode(path)); |
| 157 continue; | 157 |
| 158 this._boundFileSystems.get(key)._fileChanged(path); | 158 /** |
| 159 * @param {!Array<string>} filePaths |
| 160 * @param {function(string, !Persistence.FileSystemWorkspaceBinding.FileSyst
em)} callback |
| 161 * @this {Persistence.FileSystemWorkspaceBinding} |
| 162 */ |
| 163 function forEachFile(filePaths, callback) { |
| 164 for (var filePath of filePaths) { |
| 165 for (var fileSystemPath of this._boundFileSystems.keys()) { |
| 166 if (!filePath.startsWith(fileSystemPath)) |
| 167 continue; |
| 168 callback(filePath, this._boundFileSystems.get(fileSystemPath)); |
| 169 } |
| 159 } | 170 } |
| 160 } | 171 } |
| 161 } | 172 } |
| 162 | 173 |
| 163 dispose() { | 174 dispose() { |
| 164 Common.EventTarget.removeEventListeners(this._eventListeners); | 175 Common.EventTarget.removeEventListeners(this._eventListeners); |
| 165 for (var fileSystem of this._boundFileSystems.values()) { | 176 for (var fileSystem of this._boundFileSystems.values()) { |
| 166 fileSystem.dispose(); | 177 fileSystem.dispose(); |
| 167 this._boundFileSystems.remove(fileSystem._fileSystem.path()); | 178 this._boundFileSystems.remove(fileSystem._fileSystem.path()); |
| 168 } | 179 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 uiSourceCode[Persistence.FileSystemWorkspaceBinding._metadata] = null; | 582 uiSourceCode[Persistence.FileSystemWorkspaceBinding._metadata] = null; |
| 572 uiSourceCode.checkContentUpdated(); | 583 uiSourceCode.checkContentUpdated(); |
| 573 } | 584 } |
| 574 | 585 |
| 575 dispose() { | 586 dispose() { |
| 576 this.removeProject(); | 587 this.removeProject(); |
| 577 } | 588 } |
| 578 }; | 589 }; |
| 579 | 590 |
| 580 Persistence.FileSystemWorkspaceBinding._metadata = Symbol('FileSystemWorkspaceBi
nding.Metadata'); | 591 Persistence.FileSystemWorkspaceBinding._metadata = Symbol('FileSystemWorkspaceBi
nding.Metadata'); |
| OLD | NEW |