Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js |
| index 6aa4d3eec2f244c1cd4051488980b66caff8daca..445aecffe784db94e53a69038b92c4344d36afbf 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkMapping.js |
| @@ -17,23 +17,25 @@ WebInspector.NetworkMapping = function(targetManager, workspace, fileSystemWorks |
| this._fileSystemMapping = fileSystemMapping; |
| InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.RevealSourceLine, this._revealSourceLine, this); |
| - // For now, following block is here primarily for testing since in the real life, network manager is created early enough to capture those events. |
| - var fileSystemManager = fileSystemWorkspaceBinding.fileSystemManager(); |
| - for (var fileSystem of fileSystemManager.fileSystems()) |
| - this._addMappingsForFilesystem(fileSystem); |
| - if (fileSystemManager.fileSystemsLoaded()) |
| - this._fileSystemsLoaded(); |
| - |
| + this._fileSystemManager = fileSystemWorkspaceBinding.fileSystemManager(); |
| this._eventListeners = [ |
| - fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this), |
| - fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this), |
| - fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemsLoaded, this._fileSystemsLoaded, this), |
| + this._fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this), |
| + this._fileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this), |
| this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping.Events.FileMappingAdded, this._fileSystemMappingChanged, this), |
| this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping.Events.FileMappingRemoved, this._fileSystemMappingChanged, this) |
| ]; |
| + |
| + this._fileSystemManager.waitForFileSystems() |
| + .then(this._fileSystemsLoaded.bind(this)); |
| } |
| WebInspector.NetworkMapping.prototype = { |
| + _fileSystemsLoaded: function() |
| + { |
| + 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.
|
| + this._addMappingsForFilesystem(fileSystem); |
| + }, |
| + |
| /** |
| * @param {!WebInspector.Event} event |
| */ |
| @@ -238,14 +240,9 @@ WebInspector.NetworkMapping.prototype = { |
| this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdded, listener, this); |
| }, |
| - _fileSystemsLoaded: function() |
| - { |
| - this._fileSystemsReady = true; |
| - }, |
| - |
| _fileSystemMappingChanged: function() |
| { |
| - if (!this._fileSystemsReady || this._addingFileSystem) |
| + if (this._addingFileSystem) |
| return; |
| this._targetManager.suspendAndResumeAllTargets(); |
| }, |