| 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 * @unrestricted | 6 * @unrestricted |
| 6 */ | 7 */ |
| 7 Persistence.Persistence = class extends Common.Object { | 8 Persistence.Persistence = class extends Common.Object { |
| 8 /** | 9 /** |
| 9 * @param {!Workspace.Workspace} workspace | 10 * @param {!Workspace.Workspace} workspace |
| 10 * @param {!Bindings.BreakpointManager} breakpointManager | 11 * @param {!Bindings.BreakpointManager} breakpointManager |
| 11 * @param {!Workspace.FileSystemMapping} fileSystemMapping | 12 * @param {!Persistence.FileSystemMapping} fileSystemMapping |
| 12 */ | 13 */ |
| 13 constructor(workspace, breakpointManager, fileSystemMapping) { | 14 constructor(workspace, breakpointManager, fileSystemMapping) { |
| 14 super(); | 15 super(); |
| 15 this._workspace = workspace; | 16 this._workspace = workspace; |
| 16 this._breakpointManager = breakpointManager; | 17 this._breakpointManager = breakpointManager; |
| 17 /** @type {!Map<string, number>} */ | 18 /** @type {!Map<string, number>} */ |
| 18 this._filePathPrefixesToBindingCount = new Map(); | 19 this._filePathPrefixesToBindingCount = new Map(); |
| 19 | 20 |
| 20 /** @type {!Multimap<!Workspace.UISourceCode, function()>} */ | 21 /** @type {!Multimap<!Workspace.UISourceCode, function()>} */ |
| 21 this._subscribedBindingEventListeners = new Multimap(); | 22 this._subscribedBindingEventListeners = new Multimap(); |
| 22 | 23 |
| 23 if (Runtime.experiments.isEnabled('persistence2')) { | 24 if (Runtime.experiments.isEnabled('persistence2')) { |
| 24 var linkDecorator = new Persistence.PersistenceUtils.LinkDecorator(this); | 25 var linkDecorator = new Persistence.PersistenceUtils.LinkDecorator(this); |
| 25 Components.Linkifier.setLinkDecorator(linkDecorator); | 26 Components.Linkifier.setLinkDecorator(linkDecorator); |
| 26 this._mapping = | 27 this._mapping = |
| 27 new Persistence.Automapping(workspace, this._validateBinding.bind(this
), this._onBindingRemoved.bind(this)); | 28 new Persistence.Automapping(workspace, this._validateBinding.bind(this
), this._onBindingRemoved.bind(this)); |
| 28 } else { | 29 } else { |
| 29 this._mapping = new Persistence.DefaultMapping( | 30 this._mapping = new Persistence.DefaultMapping( |
| 30 workspace, fileSystemMapping, this._validateBinding.bind(this), this._
onBindingRemoved.bind(this)); | 31 workspace, fileSystemMapping, this._validateBinding.bind(this), this._
onBindingRemoved.bind(this)); |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 | 34 |
| 34 /** | 35 /** |
| 35 * @param {function(function(!Persistence.PersistenceBinding), function(!Persi
stence.PersistenceBinding)):{dispose: function()}} mappingFactory | 36 * @param {function(function(!Persistence.PersistenceBinding), function(!Persi
stence.PersistenceBinding)):!Persistence.MappingSystem} mappingFactory |
| 36 */ | 37 */ |
| 37 _setMappingForTest(mappingFactory) { | 38 _setMappingForTest(mappingFactory) { |
| 38 this._mapping.dispose(); | 39 this._mapping.dispose(); |
| 39 this._mapping = mappingFactory(this._validateBinding.bind(this), this._onBin
dingRemoved.bind(this)); | 40 this._mapping = mappingFactory(this._validateBinding.bind(this), this._onBin
dingRemoved.bind(this)); |
| 40 } | 41 } |
| 41 | 42 |
| 42 /** | 43 /** |
| 43 * @param {!Persistence.PersistenceBinding} binding | 44 * @param {!Persistence.PersistenceBinding} binding |
| 44 */ | 45 */ |
| 45 _validateBinding(binding) { | 46 _validateBinding(binding) { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 * @param {boolean} exactMatch | 384 * @param {boolean} exactMatch |
| 384 */ | 385 */ |
| 385 constructor(network, fileSystem, exactMatch) { | 386 constructor(network, fileSystem, exactMatch) { |
| 386 this.network = network; | 387 this.network = network; |
| 387 this.fileSystem = fileSystem; | 388 this.fileSystem = fileSystem; |
| 388 this.exactMatch = exactMatch; | 389 this.exactMatch = exactMatch; |
| 389 this._removed = false; | 390 this._removed = false; |
| 390 } | 391 } |
| 391 }; | 392 }; |
| 392 | 393 |
| 394 /** |
| 395 * @interface |
| 396 */ |
| 397 Persistence.MappingSystem = function() {}; |
| 398 |
| 399 Persistence.MappingSystem.prototype = { |
| 400 dispose: function() {} |
| 401 }; |
| 402 |
| 393 /** @type {!Persistence.Persistence} */ | 403 /** @type {!Persistence.Persistence} */ |
| 394 Persistence.persistence; | 404 Persistence.persistence; |
| OLD | NEW |