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 * @unrestricted | 5 * @unrestricted |
6 */ | 6 */ |
7 Persistence.Persistence = class extends Common.Object { | 7 Persistence.Persistence = class extends Common.Object { |
8 /** | 8 /** |
9 * @param {!Workspace.Workspace} workspace | 9 * @param {!Workspace.Workspace} workspace |
10 * @param {!Bindings.BreakpointManager} breakpointManager | 10 * @param {!Bindings.BreakpointManager} breakpointManager |
(...skipping 14 matching lines...) Expand all Loading... |
25 Components.Linkifier.setLinkDecorator(linkDecorator); | 25 Components.Linkifier.setLinkDecorator(linkDecorator); |
26 this._mapping = | 26 this._mapping = |
27 new Persistence.Automapping(workspace, this._validateBinding.bind(this
), this._onBindingRemoved.bind(this)); | 27 new Persistence.Automapping(workspace, this._validateBinding.bind(this
), this._onBindingRemoved.bind(this)); |
28 } else { | 28 } else { |
29 this._mapping = new Persistence.DefaultMapping( | 29 this._mapping = new Persistence.DefaultMapping( |
30 workspace, fileSystemMapping, this._validateBinding.bind(this), this._
onBindingRemoved.bind(this)); | 30 workspace, fileSystemMapping, this._validateBinding.bind(this), this._
onBindingRemoved.bind(this)); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 /** | 34 /** |
| 35 * @param {function(function(!Persistence.PersistenceBinding), function(!Persi
stence.PersistenceBinding)):{dispose: function()}} mappingFactory |
| 36 */ |
| 37 _setMappingForTest(mappingFactory) { |
| 38 this._mapping.dispose(); |
| 39 this._mapping = mappingFactory(this._validateBinding.bind(this), this._onBin
dingRemoved.bind(this)); |
| 40 } |
| 41 |
| 42 /** |
35 * @param {!Persistence.PersistenceBinding} binding | 43 * @param {!Persistence.PersistenceBinding} binding |
36 */ | 44 */ |
37 _validateBinding(binding) { | 45 _validateBinding(binding) { |
38 if (!Runtime.experiments.isEnabled('persistenceValidation') || binding.netwo
rk.contentType().isFromSourceMap() || | 46 if (!Runtime.experiments.isEnabled('persistenceValidation') || binding.netwo
rk.contentType().isFromSourceMap() || |
39 !binding.fileSystem.contentType().isTextType()) { | 47 !binding.fileSystem.contentType().isTextType()) { |
40 this._establishBinding(binding); | 48 this._establishBinding(binding); |
41 return; | 49 return; |
42 } | 50 } |
43 | 51 |
44 Promise.all([binding.network.requestContent(), binding.fileSystem.requestCon
tent()]).then(onContents.bind(this)); | 52 Promise.all([binding.network.requestContent(), binding.fileSystem.requestCon
tent()]).then(onContents.bind(this)); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 constructor(network, fileSystem, exactMatch) { | 385 constructor(network, fileSystem, exactMatch) { |
378 this.network = network; | 386 this.network = network; |
379 this.fileSystem = fileSystem; | 387 this.fileSystem = fileSystem; |
380 this.exactMatch = exactMatch; | 388 this.exactMatch = exactMatch; |
381 this._removed = false; | 389 this._removed = false; |
382 } | 390 } |
383 }; | 391 }; |
384 | 392 |
385 /** @type {!Persistence.Persistence} */ | 393 /** @type {!Persistence.Persistence} */ |
386 Persistence.persistence; | 394 Persistence.persistence; |
OLD | NEW |