Chromium Code Reviews| 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 |
| 155 for (var key of this._boundFileSystems.keys()) { | 155 forEachFile.call(this, paths.changed, (path, file) => file._fileChanged(path )); |
|
lushnikov
2017/01/25 02:23:10
file => fileSystem?
einbinder
2017/01/25 19:53:12
Done.
| |
| 156 if (!path.startsWith(key)) | 156 forEachFile.call(this, paths.added, (path, file) => file._fileChanged(path)) ; |
| 157 continue; | 157 forEachFile.call(this, paths.removed, (path, file) => file.removeUISourceCod e(path)); |
| 158 this._boundFileSystems.get(key)._fileChanged(path); | 158 |
| 159 /** | |
| 160 * @param {!Array<string>} filePaths | |
| 161 * @param {function(string, !Persistence.FileSystemWorkspaceBinding.FileSyst em)} fn | |
| 162 * @this {Persistence.FileSystemWorkspaceBinding} | |
| 163 */ | |
| 164 function forEachFile(filePaths, fn) { | |
|
lushnikov
2017/01/25 02:23:10
fn => callback
einbinder
2017/01/25 19:53:12
Done.
| |
| 165 for (var path of filePaths) { | |
|
lushnikov
2017/01/25 02:23:10
path => filePath
einbinder
2017/01/25 19:53:12
Done.
| |
| 166 for (var key of this._boundFileSystems.keys()) { | |
|
lushnikov
2017/01/25 02:23:10
key => fileSystemPath
einbinder
2017/01/25 19:53:12
Done.
| |
| 167 if (!path.startsWith(key)) | |
| 168 continue; | |
| 169 fn(path, this._boundFileSystems.get(key)); | |
| 170 } | |
| 159 } | 171 } |
| 160 } | 172 } |
| 161 } | 173 } |
| 162 | 174 |
| 163 dispose() { | 175 dispose() { |
| 164 Common.EventTarget.removeEventListeners(this._eventListeners); | 176 Common.EventTarget.removeEventListeners(this._eventListeners); |
| 165 for (var fileSystem of this._boundFileSystems.values()) { | 177 for (var fileSystem of this._boundFileSystems.values()) { |
| 166 fileSystem.dispose(); | 178 fileSystem.dispose(); |
| 167 this._boundFileSystems.remove(fileSystem._fileSystem.path()); | 179 this._boundFileSystems.remove(fileSystem._fileSystem.path()); |
| 168 } | 180 } |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 uiSourceCode[Persistence.FileSystemWorkspaceBinding._metadata] = null; | 583 uiSourceCode[Persistence.FileSystemWorkspaceBinding._metadata] = null; |
| 572 uiSourceCode.checkContentUpdated(); | 584 uiSourceCode.checkContentUpdated(); |
| 573 } | 585 } |
| 574 | 586 |
| 575 dispose() { | 587 dispose() { |
| 576 this.removeProject(); | 588 this.removeProject(); |
| 577 } | 589 } |
| 578 }; | 590 }; |
| 579 | 591 |
| 580 Persistence.FileSystemWorkspaceBinding._metadata = Symbol('FileSystemWorkspaceBi nding.Metadata'); | 592 Persistence.FileSystemWorkspaceBinding._metadata = Symbol('FileSystemWorkspaceBi nding.Metadata'); |
| OLD | NEW |