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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 this._removeFilePathBindingPrefixes(binding.fileSystem.url()); | 123 this._removeFilePathBindingPrefixes(binding.fileSystem.url()); |
124 | 124 |
125 this._breakpointManager.copyBreakpoints(binding.network.url(), binding.fileS
ystem); | 125 this._breakpointManager.copyBreakpoints(binding.network.url(), binding.fileS
ystem); |
126 this.dispatchEventToListeners(Persistence.Persistence.Events.BindingRemoved,
binding); | 126 this.dispatchEventToListeners(Persistence.Persistence.Events.BindingRemoved,
binding); |
127 } | 127 } |
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.target); | 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 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); | 138 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); |
139 if (target.isNodeJS()) { | 139 if (target.isNodeJS()) { |
140 var newContent = uiSourceCode.workingCopy(); | 140 var newContent = uiSourceCode.workingCopy(); |
141 other.requestContent().then(() => { | 141 other.requestContent().then(() => { |
142 var nodeJSContent = | 142 var nodeJSContent = |
143 Persistence.Persistence._rewrapNodeJSContent(binding, other, other.w
orkingCopy(), newContent); | 143 Persistence.Persistence._rewrapNodeJSContent(binding, other, other.w
orkingCopy(), newContent); |
(...skipping 13 matching lines...) Expand all Loading... |
157 other.setWorkingCopyGetter(workingCopyGetter); | 157 other.setWorkingCopyGetter(workingCopyGetter); |
158 binding[Persistence.Persistence._muteWorkingCopy] = false; | 158 binding[Persistence.Persistence._muteWorkingCopy] = false; |
159 this._contentSyncedForTest(); | 159 this._contentSyncedForTest(); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 /** | 163 /** |
164 * @param {!Common.Event} event | 164 * @param {!Common.Event} event |
165 */ | 165 */ |
166 _onWorkingCopyCommitted(event) { | 166 _onWorkingCopyCommitted(event) { |
167 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target); | 167 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data.uiSour
ceCode); |
168 var binding = uiSourceCode[Persistence.Persistence._binding]; | 168 var binding = uiSourceCode[Persistence.Persistence._binding]; |
169 if (!binding || binding[Persistence.Persistence._muteCommit]) | 169 if (!binding || binding[Persistence.Persistence._muteCommit]) |
170 return; | 170 return; |
171 var newContent = /** @type {string} */ (event.data.content); | 171 var newContent = /** @type {string} */ (event.data.content); |
172 var other = binding.network === uiSourceCode ? binding.fileSystem : binding.
network; | 172 var other = binding.network === uiSourceCode ? binding.fileSystem : binding.
network; |
173 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); | 173 var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); |
174 if (target.isNodeJS()) { | 174 if (target.isNodeJS()) { |
175 other.requestContent().then(currentContent => { | 175 other.requestContent().then(currentContent => { |
176 var nodeJSContent = Persistence.Persistence._rewrapNodeJSContent(binding
, other, currentContent, newContent); | 176 var nodeJSContent = Persistence.Persistence._rewrapNodeJSContent(binding
, other, currentContent, newContent); |
177 setContent.call(this, nodeJSContent); | 177 setContent.call(this, nodeJSContent); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 constructor(network, fileSystem, exactMatch) { | 334 constructor(network, fileSystem, exactMatch) { |
335 this.network = network; | 335 this.network = network; |
336 this.fileSystem = fileSystem; | 336 this.fileSystem = fileSystem; |
337 this.exactMatch = exactMatch; | 337 this.exactMatch = exactMatch; |
338 this._removed = false; | 338 this._removed = false; |
339 } | 339 } |
340 }; | 340 }; |
341 | 341 |
342 /** @type {!Persistence.Persistence} */ | 342 /** @type {!Persistence.Persistence} */ |
343 Persistence.persistence; | 343 Persistence.persistence; |
OLD | NEW |