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

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: remove nested arrow 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.
21 var fileSystemManager = fileSystemWorkspaceBinding.fileSystemManager(); 20 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 fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManage r.Events.FileSystemAdded, this._fileSystemAdded, this),
29 fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManage r.Events.FileSystemRemoved, this._fileSystemRemoved, this), 23 fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManage r.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 fileSystemManager.waitForFileSystems()
29 .then(this._fileSystemsLoaded.bind(this));
34 } 30 }
35 31
36 WebInspector.NetworkMapping.prototype = { 32 WebInspector.NetworkMapping.prototype = {
37 /** 33 /**
34 * @param {!Array<!WebInspector.IsolatedFileSystem>} fileSystems
35 */
36 _fileSystemsLoaded: function(fileSystems)
37 {
38 for (var fileSystem of fileSystems)
39 this._addMappingsForFilesystem(fileSystem);
40 },
41
42 /**
38 * @param {!WebInspector.Event} event 43 * @param {!WebInspector.Event} event
39 */ 44 */
40 _fileSystemAdded: function(event) 45 _fileSystemAdded: function(event)
41 { 46 {
42 var fileSystem = /** @type {!WebInspector.IsolatedFileSystem} */ (event. data); 47 var fileSystem = /** @type {!WebInspector.IsolatedFileSystem} */ (event. data);
43 this._addMappingsForFilesystem(fileSystem); 48 this._addMappingsForFilesystem(fileSystem);
44 this._fileSystemMappingChanged(); 49 this._fileSystemMappingChanged();
45 }, 50 },
46 51
47 /** 52 /**
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event. data); 236 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event. data);
232 if (this.networkURL(uiSourceCode) === url) { 237 if (this.networkURL(uiSourceCode) === url) {
233 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)); 238 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber));
234 this._workspace.removeEventListener(WebInspector.Workspace.Event s.UISourceCodeAdded, listener, this); 239 this._workspace.removeEventListener(WebInspector.Workspace.Event s.UISourceCodeAdded, listener, this);
235 } 240 }
236 } 241 }
237 242
238 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this); 243 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this);
239 }, 244 },
240 245
241 _fileSystemsLoaded: function()
242 {
243 this._fileSystemsReady = true;
244 },
245
246 _fileSystemMappingChanged: function() 246 _fileSystemMappingChanged: function()
247 { 247 {
248 if (!this._fileSystemsReady || this._addingFileSystem) 248 if (this._addingFileSystem)
249 return; 249 return;
250 this._targetManager.suspendAndResumeAllTargets(); 250 this._targetManager.suspendAndResumeAllTargets();
251 }, 251 },
252 252
253 dispose: function() 253 dispose: function()
254 { 254 {
255 WebInspector.EventTarget.removeEventListeners(this._eventListeners); 255 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
256 } 256 }
257 } 257 }
258 258
259 /** 259 /**
260 * @type {!WebInspector.NetworkMapping} 260 * @type {!WebInspector.NetworkMapping}
261 */ 261 */
262 WebInspector.networkMapping; 262 WebInspector.networkMapping;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698