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

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

Issue 2522753002: DevTools: [Persistence] properly copy breakpoints to filesystem during reload (Closed)
Patch Set: fix test 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 | « third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js ('k') | 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 binding.network[Persistence.Persistence._binding] = null; 66 binding.network[Persistence.Persistence._binding] = null;
67 binding.fileSystem[Persistence.Persistence._binding] = null; 67 binding.fileSystem[Persistence.Persistence._binding] = null;
68 68
69 binding.network.removeEventListener( 69 binding.network.removeEventListener(
70 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyC ommitted, this); 70 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyC ommitted, this);
71 binding.fileSystem.removeEventListener( 71 binding.fileSystem.removeEventListener(
72 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyC ommitted, this); 72 Workspace.UISourceCode.Events.WorkingCopyCommitted, this._onWorkingCopyC ommitted, this);
73 73
74 this._removeFilePathBindingPrefixes(binding.fileSystem.url()); 74 this._removeFilePathBindingPrefixes(binding.fileSystem.url());
75 75
76 this._copyBreakpoints(binding.network, binding.fileSystem); 76 this._breakpointManager.copyBreakpoints(binding.network.url(), binding.fileS ystem);
77 this.dispatchEventToListeners(Persistence.Persistence.Events.BindingRemoved, binding); 77 this.dispatchEventToListeners(Persistence.Persistence.Events.BindingRemoved, binding);
78 } 78 }
79 79
80 /** 80 /**
81 * @param {!Common.Event} event 81 * @param {!Common.Event} event
82 */ 82 */
83 _onWorkingCopyCommitted(event) { 83 _onWorkingCopyCommitted(event) {
84 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target); 84 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target);
85 var binding = uiSourceCode[Persistence.Persistence._binding]; 85 var binding = uiSourceCode[Persistence.Persistence._binding];
86 if (!binding || binding[Persistence.Persistence._muteCommit]) 86 if (!binding || binding[Persistence.Persistence._muteCommit])
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 _moveBreakpoints(from, to) { 137 _moveBreakpoints(from, to) {
138 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(from); 138 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(from);
139 for (var breakpoint of breakpoints) { 139 for (var breakpoint of breakpoints) {
140 breakpoint.remove(); 140 breakpoint.remove();
141 this._breakpointManager.setBreakpoint( 141 this._breakpointManager.setBreakpoint(
142 to, breakpoint.lineNumber(), breakpoint.columnNumber(), breakpoint.con dition(), breakpoint.enabled()); 142 to, breakpoint.lineNumber(), breakpoint.columnNumber(), breakpoint.con dition(), breakpoint.enabled());
143 } 143 }
144 } 144 }
145 145
146 /** 146 /**
147 * @param {!Workspace.UISourceCode} from
148 * @param {!Workspace.UISourceCode} to
149 */
150 _copyBreakpoints(from, to) {
151 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(from);
152 for (var breakpoint of breakpoints) {
153 this._breakpointManager.setBreakpoint(
154 to, breakpoint.lineNumber(), breakpoint.columnNumber(), breakpoint.con dition(), breakpoint.enabled());
155 }
156 }
157
158 /**
159 * @param {!Workspace.UISourceCode} uiSourceCode 147 * @param {!Workspace.UISourceCode} uiSourceCode
160 * @return {boolean} 148 * @return {boolean}
161 */ 149 */
162 hasUnsavedCommittedChanges(uiSourceCode) { 150 hasUnsavedCommittedChanges(uiSourceCode) {
163 if (this._workspace.hasResourceContentTrackingExtensions()) 151 if (this._workspace.hasResourceContentTrackingExtensions())
164 return false; 152 return false;
165 if (uiSourceCode.url() && Workspace.fileManager.isURLSaved(uiSourceCode.url( ))) 153 if (uiSourceCode.url() && Workspace.fileManager.isURLSaved(uiSourceCode.url( )))
166 return false; 154 return false;
167 if (uiSourceCode.project().canSetFileContent()) 155 if (uiSourceCode.project().canSetFileContent())
168 return false; 156 return false;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 */ 241 */
254 constructor(network, fileSystem, exactMatch) { 242 constructor(network, fileSystem, exactMatch) {
255 this.network = network; 243 this.network = network;
256 this.fileSystem = fileSystem; 244 this.fileSystem = fileSystem;
257 this.exactMatch = exactMatch; 245 this.exactMatch = exactMatch;
258 } 246 }
259 }; 247 };
260 248
261 /** @type {!Persistence.Persistence} */ 249 /** @type {!Persistence.Persistence} */
262 Persistence.persistence; 250 Persistence.persistence;
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698