Chromium Code Reviews| 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 } else { | 25 } else { |
| 26 this._mapping = new Persistence.DefaultMapping( | 26 this._mapping = new Persistence.DefaultMapping( |
| 27 workspace, fileSystemMapping, this._onBindingCreated.bind(this), this. _onBindingRemoved.bind(this)); | 27 workspace, fileSystemMapping, this._onBindingCreated.bind(this), this. _onBindingRemoved.bind(this)); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @param {!Persistence.PersistenceBinding} binding | 32 * @param {!Persistence.PersistenceBinding} binding |
| 33 */ | 33 */ |
| 34 _onBindingCreated(binding) { | 34 _onBindingCreated(binding) { |
| 35 // FIXME(lushnikov): workspace should contain only one UISourceCode per URL. | |
|
dgozman
2016/12/01 18:29:05
TODO
| |
| 36 if (binding.network[Persistence.Persistence._binding] || binding.fileSystem[ Persistence.Persistence._binding]) | |
|
dgozman
2016/12/01 18:29:06
I think we should move this check to both mappings
lushnikov
2016/12/02 01:54:55
Since Persistence instance is nicely isolated from
| |
| 37 return; | |
| 35 if (binding.network.isDirty()) { | 38 if (binding.network.isDirty()) { |
| 36 Common.console.log( | 39 Common.console.log( |
| 37 Common.UIString('%s can not be persisted to file system due to unsaved changes.', binding.network.name())); | 40 Common.UIString('%s can not be persisted to file system due to unsaved changes.', binding.network.name())); |
| 38 return; | 41 return; |
| 39 } | 42 } |
| 40 if (binding.fileSystem.isDirty()) | 43 if (binding.fileSystem.isDirty()) |
| 41 binding.network.setWorkingCopy(binding.fileSystem.workingCopy()); | 44 binding.network.setWorkingCopy(binding.fileSystem.workingCopy()); |
| 42 | 45 |
| 43 binding.network[Persistence.Persistence._binding] = binding; | 46 binding.network[Persistence.Persistence._binding] = binding; |
| 44 binding.fileSystem[Persistence.Persistence._binding] = binding; | 47 binding.fileSystem[Persistence.Persistence._binding] = binding; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 */ | 244 */ |
| 242 constructor(network, fileSystem, exactMatch) { | 245 constructor(network, fileSystem, exactMatch) { |
| 243 this.network = network; | 246 this.network = network; |
| 244 this.fileSystem = fileSystem; | 247 this.fileSystem = fileSystem; |
| 245 this.exactMatch = exactMatch; | 248 this.exactMatch = exactMatch; |
| 246 } | 249 } |
| 247 }; | 250 }; |
| 248 | 251 |
| 249 /** @type {!Persistence.Persistence} */ | 252 /** @type {!Persistence.Persistence} */ |
| 250 Persistence.persistence; | 253 Persistence.persistence; |
| OLD | NEW |