Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/Persistence.js

Issue 2546583003: DevTools: [Persistence] guard against multiple UISourceCodes with similar URL (Closed)
Patch Set: add fixme Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698