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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/IsolatedFileSystemManager.js

Issue 2384343002: DevTools: improve DevTools file watcher to send added and removed paths (Closed)
Patch Set: Created 4 years, 2 months 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 unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.Object} 33 * @extends {WebInspector.Object}
34 */ 34 */
35 WebInspector.IsolatedFileSystemManager = function() 35 WebInspector.IsolatedFileSystemManager = function()
36 { 36 {
37 WebInspector.Object.call(this);
dgozman 2016/10/04 00:17:02 Whoa!
38
37 /** @type {!Map<string, !WebInspector.IsolatedFileSystem>} */ 39 /** @type {!Map<string, !WebInspector.IsolatedFileSystem>} */
38 this._fileSystems = new Map(); 40 this._fileSystems = new Map();
39 /** @type {!Map<number, function(!Array.<string>)>} */ 41 /** @type {!Map<number, function(!Array.<string>)>} */
40 this._callbacks = new Map(); 42 this._callbacks = new Map();
41 /** @type {!Map<number, !WebInspector.Progress>} */ 43 /** @type {!Map<number, !WebInspector.Progress>} */
42 this._progresses = new Map(); 44 this._progresses = new Map();
43 45
44 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.FileSystemRemoved, this._onFileSystemRemoved, this); 46 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.FileSystemRemoved, this._onFileSystemRemoved, this);
45 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.FileSystemAdded, this._onFileSystemAdded, this); 47 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.FileSystemAdded, this._onFileSystemAdded, this);
46 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.FileSystemFilesChanged, this._onFileSystemFilesChanged, this); 48 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.FileSystemFilesChanged, this._onFileSystemFilesChanged, this);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 this._fileSystems.delete(fileSystemPath); 194 this._fileSystems.delete(fileSystemPath);
193 isolatedFileSystem.fileSystemRemoved(); 195 isolatedFileSystem.fileSystemRemoved();
194 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Eve nts.FileSystemRemoved, isolatedFileSystem); 196 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Eve nts.FileSystemRemoved, isolatedFileSystem);
195 }, 197 },
196 198
197 /** 199 /**
198 * @param {!WebInspector.Event} event 200 * @param {!WebInspector.Event} event
199 */ 201 */
200 _onFileSystemFilesChanged: function(event) 202 _onFileSystemFilesChanged: function(event)
201 { 203 {
202 var embedderPaths = /** @type {!Array<string>} */ (event.data); 204 var changedPaths = /** @type {!Array<string>} */ (event.data["changedPat hs"]).map(WebInspector.IsolatedFileSystemManager.normalizePath);
203 var paths = embedderPaths.map(embedderPath => WebInspector.IsolatedFileS ystemManager.normalizePath(embedderPath)); 205 var addedPaths = /** @type {!Array<string>} */ (event.data["addedPaths"] ).map(WebInspector.IsolatedFileSystemManager.normalizePath);
206 var removedPaths = /** @type {!Array<string>} */ (event.data["removedPat hs"]).map(WebInspector.IsolatedFileSystemManager.normalizePath);
207 var paths = changedPaths.concat(addedPaths, removedPaths);
dgozman 2016/10/04 00:17:02 Let's use it in the same patch?
lushnikov 2016/10/04 01:04:19 Reverted this.
204 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Eve nts.FileSystemFilesChanged, paths); 208 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Eve nts.FileSystemFilesChanged, paths);
205 }, 209 },
206 210
207 /** 211 /**
208 * @return {!Array<!WebInspector.IsolatedFileSystem>} 212 * @return {!Array<!WebInspector.IsolatedFileSystem>}
209 */ 213 */
210 fileSystems: function() 214 fileSystems: function()
211 { 215 {
212 return this._fileSystems.valuesArray(); 216 return this._fileSystems.valuesArray();
213 }, 217 },
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 this._callbacks.delete(requestId); 357 this._callbacks.delete(requestId);
354 }, 358 },
355 359
356 __proto__: WebInspector.Object.prototype 360 __proto__: WebInspector.Object.prototype
357 } 361 }
358 362
359 /** 363 /**
360 * @type {!WebInspector.IsolatedFileSystemManager} 364 * @type {!WebInspector.IsolatedFileSystemManager}
361 */ 365 */
362 WebInspector.isolatedFileSystemManager; 366 WebInspector.isolatedFileSystemManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698