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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js

Issue 2296983003: DevTools: kill WI.IsolatedFileSystemManager FileSystemsLoaded event (Closed)
Patch Set: Created 4 years, 3 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.TargetManager} targetManager 7 * @param {!WebInspector.TargetManager} targetManager
8 * @param {!WebInspector.Workspace} workspace 8 * @param {!WebInspector.Workspace} workspace
9 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding 9 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding
10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping 10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping
11 */ 11 */
12 WebInspector.NetworkMapping = function(targetManager, workspace, fileSystemWorks paceBinding, fileSystemMapping) 12 WebInspector.NetworkMapping = function(targetManager, workspace, fileSystemWorks paceBinding, fileSystemMapping)
13 { 13 {
14 this._targetManager = targetManager; 14 this._targetManager = targetManager;
15 this._workspace = workspace; 15 this._workspace = workspace;
16 this._fileSystemWorkspaceBinding = fileSystemWorkspaceBinding; 16 this._fileSystemWorkspaceBinding = fileSystemWorkspaceBinding;
17 this._fileSystemMapping = fileSystemMapping; 17 this._fileSystemMapping = fileSystemMapping;
18 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.RevealSourceLine, this._revealSourceLine, this); 18 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event s.RevealSourceLine, this._revealSourceLine, this);
19 19
20 // For now, following block is here primarily for testing since in the real life, network manager is created early enough to capture those events. 20 this._fileSystemManager = fileSystemWorkspaceBinding.fileSystemManager();
21 var fileSystemManager = fileSystemWorkspaceBinding.fileSystemManager();
22 for (var fileSystem of fileSystemManager.fileSystems())
23 this._addMappingsForFilesystem(fileSystem);
24 if (fileSystemManager.fileSystemsLoaded())
25 this._fileSystemsLoaded();
26
27 this._eventListeners = [ 21 this._eventListeners = [
28 fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManage r.Events.FileSystemAdded, this._fileSystemAdded, this), 22 this._fileSystemManager.addEventListener(WebInspector.IsolatedFileSystem Manager.Events.FileSystemAdded, this._fileSystemAdded, this),
29 fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManage r.Events.FileSystemRemoved, this._fileSystemRemoved, this), 23 this._fileSystemManager.addEventListener(WebInspector.IsolatedFileSystem Manager.Events.FileSystemRemoved, this._fileSystemRemoved, this),
30 fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManage r.Events.FileSystemsLoaded, this._fileSystemsLoaded, this),
31 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping. Events.FileMappingAdded, this._fileSystemMappingChanged, this), 24 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping. Events.FileMappingAdded, this._fileSystemMappingChanged, this),
32 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping. Events.FileMappingRemoved, this._fileSystemMappingChanged, this) 25 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping. Events.FileMappingRemoved, this._fileSystemMappingChanged, this)
33 ]; 26 ];
27
28 this._fileSystemManager.waitForFileSystems()
29 .then(this._fileSystemsLoaded.bind(this));
34 } 30 }
35 31
36 WebInspector.NetworkMapping.prototype = { 32 WebInspector.NetworkMapping.prototype = {
33 _fileSystemsLoaded: function()
34 {
35 for (var fileSystem of this._fileSystemManager.fileSystems())
dgozman 2016/08/31 01:39:46 Let's have an array of initial file systems return
lushnikov 2016/08/31 17:35:10 Done.
36 this._addMappingsForFilesystem(fileSystem);
37 },
38
37 /** 39 /**
38 * @param {!WebInspector.Event} event 40 * @param {!WebInspector.Event} event
39 */ 41 */
40 _fileSystemAdded: function(event) 42 _fileSystemAdded: function(event)
41 { 43 {
42 var fileSystem = /** @type {!WebInspector.IsolatedFileSystem} */ (event. data); 44 var fileSystem = /** @type {!WebInspector.IsolatedFileSystem} */ (event. data);
43 this._addMappingsForFilesystem(fileSystem); 45 this._addMappingsForFilesystem(fileSystem);
44 this._fileSystemMappingChanged(); 46 this._fileSystemMappingChanged();
45 }, 47 },
46 48
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event. data); 233 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event. data);
232 if (this.networkURL(uiSourceCode) === url) { 234 if (this.networkURL(uiSourceCode) === url) {
233 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)); 235 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber));
234 this._workspace.removeEventListener(WebInspector.Workspace.Event s.UISourceCodeAdded, listener, this); 236 this._workspace.removeEventListener(WebInspector.Workspace.Event s.UISourceCodeAdded, listener, this);
235 } 237 }
236 } 238 }
237 239
238 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this); 240 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this);
239 }, 241 },
240 242
241 _fileSystemsLoaded: function()
242 {
243 this._fileSystemsReady = true;
244 },
245
246 _fileSystemMappingChanged: function() 243 _fileSystemMappingChanged: function()
247 { 244 {
248 if (!this._fileSystemsReady || this._addingFileSystem) 245 if (this._addingFileSystem)
249 return; 246 return;
250 this._targetManager.suspendAndResumeAllTargets(); 247 this._targetManager.suspendAndResumeAllTargets();
251 }, 248 },
252 249
253 dispose: function() 250 dispose: function()
254 { 251 {
255 WebInspector.EventTarget.removeEventListeners(this._eventListeners); 252 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
256 } 253 }
257 } 254 }
258 255
259 /** 256 /**
260 * @type {!WebInspector.NetworkMapping} 257 * @type {!WebInspector.NetworkMapping}
261 */ 258 */
262 WebInspector.networkMapping; 259 WebInspector.networkMapping;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698