| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * @param {!Common.Event} event | 130 * @param {!Common.Event} event |
| 131 */ | 131 */ |
| 132 _onWorkingCopyChanged(event) { | 132 _onWorkingCopyChanged(event) { |
| 133 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); | 133 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data); |
| 134 var binding = uiSourceCode[Persistence.Persistence._binding]; | 134 var binding = uiSourceCode[Persistence.Persistence._binding]; |
| 135 if (!binding || binding[Persistence.Persistence._muteWorkingCopy]) | 135 if (!binding || binding[Persistence.Persistence._muteWorkingCopy]) |
| 136 return; | 136 return; |
| 137 var other = binding.network === uiSourceCode ? binding.fileSystem : binding.
network; | 137 var other = binding.network === uiSourceCode ? binding.fileSystem : binding.
network; |
| 138 if (!uiSourceCode.isDirty()) { |
| 139 binding[Persistence.Persistence._muteWorkingCopy] = true; |
| 140 other.resetWorkingCopy(); |
| 141 binding[Persistence.Persistence._muteWorkingCopy] = false; |
| 142 this._contentSyncedForTest(); |
| 143 return; |
| 144 } |
| 145 |
| 138 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); | 146 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); |
| 139 if (target.isNodeJS()) { | 147 if (target.isNodeJS()) { |
| 140 var newContent = uiSourceCode.workingCopy(); | 148 var newContent = uiSourceCode.workingCopy(); |
| 141 other.requestContent().then(() => { | 149 other.requestContent().then(() => { |
| 142 var nodeJSContent = | 150 var nodeJSContent = |
| 143 Persistence.Persistence._rewrapNodeJSContent(binding, other, other.w
orkingCopy(), newContent); | 151 Persistence.Persistence._rewrapNodeJSContent(binding, other, other.w
orkingCopy(), newContent); |
| 144 setWorkingCopy.call(this, () => nodeJSContent); | 152 setWorkingCopy.call(this, () => nodeJSContent); |
| 145 }); | 153 }); |
| 146 return; | 154 return; |
| 147 } | 155 } |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 constructor(network, fileSystem, exactMatch) { | 342 constructor(network, fileSystem, exactMatch) { |
| 335 this.network = network; | 343 this.network = network; |
| 336 this.fileSystem = fileSystem; | 344 this.fileSystem = fileSystem; |
| 337 this.exactMatch = exactMatch; | 345 this.exactMatch = exactMatch; |
| 338 this._removed = false; | 346 this._removed = false; |
| 339 } | 347 } |
| 340 }; | 348 }; |
| 341 | 349 |
| 342 /** @type {!Persistence.Persistence} */ | 350 /** @type {!Persistence.Persistence} */ |
| 343 Persistence.persistence; | 351 Persistence.persistence; |
| OLD | NEW |