| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.Workspace} workspace | 7 * @param {!WebInspector.Workspace} workspace |
| 8 * @param {!WebInspector.FileSystemMapping} fileSystemMapping | 8 * @param {!WebInspector.FileSystemMapping} fileSystemMapping |
| 9 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated | 9 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated |
| 10 * @param {function(!WebInspector.PersistenceBinding)} onBindingRemoved | 10 * @param {function(!WebInspector.PersistenceBinding)} onBindingRemoved |
| 11 */ | 11 */ |
| 12 WebInspector.DefaultMapping = function(workspace, fileSystemMapping, onBindingCr
eated, onBindingRemoved) | 12 WebInspector.DefaultMapping = function(workspace, fileSystemMapping, onBindingCr
eated, onBindingRemoved) |
| 13 { | 13 { |
| 14 this._workspace = workspace; | 14 this._workspace = workspace; |
| 15 this._fileSystemMapping = fileSystemMapping; | 15 this._fileSystemMapping = fileSystemMapping; |
| 16 /** @type {!Set<!WebInspector.PersistenceBinding>} */ | 16 /** @type {!Set<!WebInspector.PersistenceBinding>} */ |
| 17 this._bindings = new Set(); | 17 this._bindings = new Set(); |
| 18 this._onBindingCreated = onBindingCreated; | 18 this._onBindingCreated = onBindingCreated; |
| 19 this._onBindingRemoved = onBindingRemoved; | 19 this._onBindingRemoved = onBindingRemoved; |
| 20 | 20 |
| 21 this._eventListeners = [ | 21 this._eventListeners = [ |
| 22 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdd
ed, this._onUISourceCodeAdded, this), | 22 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdd
ed, this._onUISourceCodeAdded, this), |
| 23 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRem
oved, this._onUISourceCodeRemoved, this), | 23 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRem
oved, this._onUISourceCodeRemoved, this), |
| 24 workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,
this._onProjectRemoved, this), | 24 workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemoved,
this._onProjectRemoved, this), |
| 25 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping.
Events.FileMappingAdded, this._remap, this), | 25 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping.
Events.FileMappingAdded, this._remap, this), |
| 26 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping.
Events.FileMappingRemoved, this._remap, this) | 26 this._fileSystemMapping.addEventListener(WebInspector.FileSystemMapping.
Events.FileMappingRemoved, this._remap, this) |
| 27 ]; | 27 ]; |
| 28 this._remap(); | 28 this._remap(); |
| 29 } | 29 }; |
| 30 | 30 |
| 31 WebInspector.DefaultMapping._binding = Symbol("DefaultMapping.Binding"); | 31 WebInspector.DefaultMapping._binding = Symbol("DefaultMapping.Binding"); |
| 32 | 32 |
| 33 WebInspector.DefaultMapping.prototype = { | 33 WebInspector.DefaultMapping.prototype = { |
| 34 _remap: function() | 34 _remap: function() |
| 35 { | 35 { |
| 36 for (var binding of this._bindings.valuesArray()) | 36 for (var binding of this._bindings.valuesArray()) |
| 37 this._unbind(binding.network); | 37 this._unbind(binding.network); |
| 38 var networkProjects = this._workspace.projectsForType(WebInspector.proje
ctTypes.Network); | 38 var networkProjects = this._workspace.projectsForType(WebInspector.proje
ctTypes.Network); |
| 39 for (var networkProject of networkProjects) { | 39 for (var networkProject of networkProjects) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */(event.targe
t); | 134 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */(event.targe
t); |
| 135 var binding = uiSourceCode[WebInspector.DefaultMapping._binding]; | 135 var binding = uiSourceCode[WebInspector.DefaultMapping._binding]; |
| 136 this._unbind(binding.network); | 136 this._unbind(binding.network); |
| 137 this._bind(binding.network); | 137 this._bind(binding.network); |
| 138 }, | 138 }, |
| 139 | 139 |
| 140 dispose: function() | 140 dispose: function() |
| 141 { | 141 { |
| 142 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 142 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
| 143 } | 143 } |
| 144 } | 144 }; |
| OLD | NEW |