Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 29 matching lines...) Expand all Loading... | |
| 40 /** @type {!Map<number, function(!Array.<string>)>} */ | 40 /** @type {!Map<number, function(!Array.<string>)>} */ |
| 41 this._callbacks = new Map(); | 41 this._callbacks = new Map(); |
| 42 /** @type {!Map<number, !Common.Progress>} */ | 42 /** @type {!Map<number, !Common.Progress>} */ |
| 43 this._progresses = new Map(); | 43 this._progresses = new Map(); |
| 44 | 44 |
| 45 InspectorFrontendHost.events.addEventListener( | 45 InspectorFrontendHost.events.addEventListener( |
| 46 InspectorFrontendHostAPI.Events.FileSystemRemoved, this._onFileSystemRem oved, this); | 46 InspectorFrontendHostAPI.Events.FileSystemRemoved, this._onFileSystemRem oved, this); |
| 47 InspectorFrontendHost.events.addEventListener( | 47 InspectorFrontendHost.events.addEventListener( |
| 48 InspectorFrontendHostAPI.Events.FileSystemAdded, this._onFileSystemAdded , this); | 48 InspectorFrontendHostAPI.Events.FileSystemAdded, this._onFileSystemAdded , this); |
| 49 InspectorFrontendHost.events.addEventListener( | 49 InspectorFrontendHost.events.addEventListener( |
| 50 InspectorFrontendHostAPI.Events.FileSystemFilesChanged, this._onFileSyst emFilesChanged, this); | 50 InspectorFrontendHostAPI.Events.FileSystemFilesChangedAddedRemoved, this ._onFileSystemFilesChanged, this); |
| 51 InspectorFrontendHost.events.addEventListener( | 51 InspectorFrontendHost.events.addEventListener( |
| 52 InspectorFrontendHostAPI.Events.IndexingTotalWorkCalculated, this._onInd exingTotalWorkCalculated, this); | 52 InspectorFrontendHostAPI.Events.IndexingTotalWorkCalculated, this._onInd exingTotalWorkCalculated, this); |
| 53 InspectorFrontendHost.events.addEventListener( | 53 InspectorFrontendHost.events.addEventListener( |
| 54 InspectorFrontendHostAPI.Events.IndexingWorked, this._onIndexingWorked, this); | 54 InspectorFrontendHostAPI.Events.IndexingWorked, this._onIndexingWorked, this); |
| 55 InspectorFrontendHost.events.addEventListener( | 55 InspectorFrontendHost.events.addEventListener( |
| 56 InspectorFrontendHostAPI.Events.IndexingDone, this._onIndexingDone, this ); | 56 InspectorFrontendHostAPI.Events.IndexingDone, this._onIndexingDone, this ); |
| 57 InspectorFrontendHost.events.addEventListener( | 57 InspectorFrontendHost.events.addEventListener( |
| 58 InspectorFrontendHostAPI.Events.SearchCompleted, this._onSearchCompleted , this); | 58 InspectorFrontendHostAPI.Events.SearchCompleted, this._onSearchCompleted , this); |
| 59 | 59 |
| 60 this._initExcludePatterSetting(); | 60 this._initExcludePatterSetting(); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 return; | 160 return; |
| 161 this._fileSystems.delete(fileSystemPath); | 161 this._fileSystems.delete(fileSystemPath); |
| 162 isolatedFileSystem.fileSystemRemoved(); | 162 isolatedFileSystem.fileSystemRemoved(); |
| 163 this.dispatchEventToListeners(Workspace.IsolatedFileSystemManager.Events.Fil eSystemRemoved, isolatedFileSystem); | 163 this.dispatchEventToListeners(Workspace.IsolatedFileSystemManager.Events.Fil eSystemRemoved, isolatedFileSystem); |
| 164 } | 164 } |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * @param {!Common.Event} event | 167 * @param {!Common.Event} event |
| 168 */ | 168 */ |
| 169 _onFileSystemFilesChanged(event) { | 169 _onFileSystemFilesChanged(event) { |
| 170 var embedderPaths = /** @type {!Array<string>} */ (event.data); | 170 var paths = /** @type {!Workspace.IsolatedFileSystemManager.FilesChangedData } */ (event.data); |
| 171 var paths = embedderPaths.map(embedderPath => Common.ParsedURL.platformPathT oURL(embedderPath)); | 171 for (var pathType in paths) |
|
lushnikov
2017/01/26 01:10:57
let's write this explicitly
var changedPaths = pa
einbinder
2017/01/26 22:06:14
Done.
| |
| 172 paths[pathType] = paths[pathType].map(embedderPath => Common.ParsedURL.pla tformPathToURL(embedderPath)); | |
| 172 this.dispatchEventToListeners(Workspace.IsolatedFileSystemManager.Events.Fil eSystemFilesChanged, paths); | 173 this.dispatchEventToListeners(Workspace.IsolatedFileSystemManager.Events.Fil eSystemFilesChanged, paths); |
| 173 } | 174 } |
| 174 | 175 |
| 175 /** | 176 /** |
| 176 * @return {!Array<!Workspace.IsolatedFileSystem>} | 177 * @return {!Array<!Workspace.IsolatedFileSystem>} |
| 177 */ | 178 */ |
| 178 fileSystems() { | 179 fileSystems() { |
| 179 return this._fileSystems.valuesArray(); | 180 return this._fileSystems.valuesArray(); |
| 180 } | 181 } |
| 181 | 182 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 if (!callback) | 292 if (!callback) |
| 292 return; | 293 return; |
| 293 callback.call(null, files); | 294 callback.call(null, files); |
| 294 this._callbacks.delete(requestId); | 295 this._callbacks.delete(requestId); |
| 295 } | 296 } |
| 296 }; | 297 }; |
| 297 | 298 |
| 298 /** @typedef {!{fileSystemName: string, rootURL: string, fileSystemPath: string} } */ | 299 /** @typedef {!{fileSystemName: string, rootURL: string, fileSystemPath: string} } */ |
| 299 Workspace.IsolatedFileSystemManager.FileSystem; | 300 Workspace.IsolatedFileSystemManager.FileSystem; |
| 300 | 301 |
| 302 /** @typedef {!{changed:!Array<string>, added:!Array<string>, removed:!Array<str ing>}} */ | |
| 303 Workspace.IsolatedFileSystemManager.FilesChangedData; | |
| 304 | |
| 301 /** @enum {symbol} */ | 305 /** @enum {symbol} */ |
| 302 Workspace.IsolatedFileSystemManager.Events = { | 306 Workspace.IsolatedFileSystemManager.Events = { |
| 303 FileSystemAdded: Symbol('FileSystemAdded'), | 307 FileSystemAdded: Symbol('FileSystemAdded'), |
| 304 FileSystemRemoved: Symbol('FileSystemRemoved'), | 308 FileSystemRemoved: Symbol('FileSystemRemoved'), |
| 305 FileSystemFilesChanged: Symbol('FileSystemFilesChanged'), | 309 FileSystemFilesChanged: Symbol('FileSystemFilesChanged'), |
| 306 ExcludedFolderAdded: Symbol('ExcludedFolderAdded'), | 310 ExcludedFolderAdded: Symbol('ExcludedFolderAdded'), |
| 307 ExcludedFolderRemoved: Symbol('ExcludedFolderRemoved') | 311 ExcludedFolderRemoved: Symbol('ExcludedFolderRemoved') |
| 308 }; | 312 }; |
| 309 | 313 |
| 310 Workspace.IsolatedFileSystemManager._lastRequestId = 0; | 314 Workspace.IsolatedFileSystemManager._lastRequestId = 0; |
| 311 | 315 |
| 312 /** | 316 /** |
| 313 * @type {!Workspace.IsolatedFileSystemManager} | 317 * @type {!Workspace.IsolatedFileSystemManager} |
| 314 */ | 318 */ |
| 315 Workspace.isolatedFileSystemManager; | 319 Workspace.isolatedFileSystemManager; |
| OLD | NEW |