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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/BreakpointManager.js

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10 matching lines...) Expand all
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 /** 30 /**
31 * @implements {WebInspector.TargetManager.Observer} 31 * @implements {SDK.TargetManager.Observer}
32 * @unrestricted 32 * @unrestricted
33 */ 33 */
34 WebInspector.BreakpointManager = class extends WebInspector.Object { 34 Bindings.BreakpointManager = class extends Common.Object {
35 /** 35 /**
36 * @param {?WebInspector.Setting} breakpointsSetting 36 * @param {?Common.Setting} breakpointsSetting
37 * @param {!WebInspector.Workspace} workspace 37 * @param {!Workspace.Workspace} workspace
38 * @param {!WebInspector.TargetManager} targetManager 38 * @param {!SDK.TargetManager} targetManager
39 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding 39 * @param {!Bindings.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
40 */ 40 */
41 constructor(breakpointsSetting, workspace, targetManager, debuggerWorkspaceBin ding) { 41 constructor(breakpointsSetting, workspace, targetManager, debuggerWorkspaceBin ding) {
42 super(); 42 super();
43 this._storage = new WebInspector.BreakpointManager.Storage(this, breakpoints Setting); 43 this._storage = new Bindings.BreakpointManager.Storage(this, breakpointsSett ing);
44 this._workspace = workspace; 44 this._workspace = workspace;
45 this._targetManager = targetManager; 45 this._targetManager = targetManager;
46 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; 46 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;
47 47
48 this._breakpointsActive = true; 48 this._breakpointsActive = true;
49 /** @type {!Map<!WebInspector.UISourceCode, !Map<number, !Map<number, !Array <!WebInspector.BreakpointManager.Breakpoint>>>>} */ 49 /** @type {!Map<!Workspace.UISourceCode, !Map<number, !Map<number, !Array<!B indings.BreakpointManager.Breakpoint>>>>} */
50 this._breakpointsForUISourceCode = new Map(); 50 this._breakpointsForUISourceCode = new Map();
51 /** @type {!Map<!WebInspector.UISourceCode, !Array<!WebInspector.BreakpointM anager.Breakpoint>>} */ 51 /** @type {!Map<!Workspace.UISourceCode, !Array<!Bindings.BreakpointManager. Breakpoint>>} */
52 this._breakpointsForPrimaryUISourceCode = new Map(); 52 this._breakpointsForPrimaryUISourceCode = new Map();
53 /** @type {!Multimap.<string, !WebInspector.BreakpointManager.Breakpoint>} * / 53 /** @type {!Multimap.<string, !Bindings.BreakpointManager.Breakpoint>} */
54 this._provisionalBreakpoints = new Multimap(); 54 this._provisionalBreakpoints = new Multimap();
55 55
56 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectRemove d, this._projectRemoved, this); 56 this._workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved, this._projectRemoved, this);
57 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA dded, this._uiSourceCodeAdded, this); 57 this._workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdde d, this._uiSourceCodeAdded, this);
58 this._workspace.addEventListener( 58 this._workspace.addEventListener(
59 WebInspector.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRem oved, this); 59 Workspace.Workspace.Events.UISourceCodeRemoved, this._uiSourceCodeRemove d, this);
60 60
61 targetManager.observeTargets(this, WebInspector.Target.Capability.JS); 61 targetManager.observeTargets(this, SDK.Target.Capability.JS);
62 } 62 }
63 63
64 /** 64 /**
65 * @param {string} sourceFileId 65 * @param {string} sourceFileId
66 * @param {number} lineNumber 66 * @param {number} lineNumber
67 * @param {number} columnNumber 67 * @param {number} columnNumber
68 * @return {string} 68 * @return {string}
69 */ 69 */
70 static _breakpointStorageId(sourceFileId, lineNumber, columnNumber) { 70 static _breakpointStorageId(sourceFileId, lineNumber, columnNumber) {
71 if (!sourceFileId) 71 if (!sourceFileId)
72 return ''; 72 return '';
73 return sourceFileId + ':' + lineNumber + ':' + columnNumber; 73 return sourceFileId + ':' + lineNumber + ':' + columnNumber;
74 } 74 }
75 75
76 /** 76 /**
77 * @param {!WebInspector.UISourceCode} uiSourceCode 77 * @param {!Workspace.UISourceCode} uiSourceCode
78 * @return {string} 78 * @return {string}
79 */ 79 */
80 _sourceFileId(uiSourceCode) { 80 _sourceFileId(uiSourceCode) {
81 // TODO(lushnikov): _sourceFileId is not needed any more. 81 // TODO(lushnikov): _sourceFileId is not needed any more.
82 return uiSourceCode.url(); 82 return uiSourceCode.url();
83 } 83 }
84 84
85 /** 85 /**
86 * @override 86 * @override
87 * @param {!WebInspector.Target} target 87 * @param {!SDK.Target} target
88 */ 88 */
89 targetAdded(target) { 89 targetAdded(target) {
90 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 90 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
91 if (debuggerModel && !this._breakpointsActive) 91 if (debuggerModel && !this._breakpointsActive)
92 debuggerModel.setBreakpointsActive(this._breakpointsActive); 92 debuggerModel.setBreakpointsActive(this._breakpointsActive);
93 } 93 }
94 94
95 /** 95 /**
96 * @override 96 * @override
97 * @param {!WebInspector.Target} target 97 * @param {!SDK.Target} target
98 */ 98 */
99 targetRemoved(target) { 99 targetRemoved(target) {
100 } 100 }
101 101
102 /** 102 /**
103 * @param {string} sourceFileId 103 * @param {string} sourceFileId
104 * @return {!Map.<string, !WebInspector.BreakpointManager.Breakpoint>} 104 * @return {!Map.<string, !Bindings.BreakpointManager.Breakpoint>}
105 */ 105 */
106 _provisionalBreakpointsForSourceFileId(sourceFileId) { 106 _provisionalBreakpointsForSourceFileId(sourceFileId) {
107 var result = new Map(); 107 var result = new Map();
108 var breakpoints = this._provisionalBreakpoints.get(sourceFileId).valuesArray (); 108 var breakpoints = this._provisionalBreakpoints.get(sourceFileId).valuesArray ();
109 for (var i = 0; i < breakpoints.length; ++i) 109 for (var i = 0; i < breakpoints.length; ++i)
110 result.set(breakpoints[i]._breakpointStorageId(), breakpoints[i]); 110 result.set(breakpoints[i]._breakpointStorageId(), breakpoints[i]);
111 return result; 111 return result;
112 } 112 }
113 113
114 removeProvisionalBreakpointsForTest() { 114 removeProvisionalBreakpointsForTest() {
115 var breakpoints = this._provisionalBreakpoints.valuesArray(); 115 var breakpoints = this._provisionalBreakpoints.valuesArray();
116 for (var i = 0; i < breakpoints.length; ++i) 116 for (var i = 0; i < breakpoints.length; ++i)
117 breakpoints[i].remove(); 117 breakpoints[i].remove();
118 this._provisionalBreakpoints.clear(); 118 this._provisionalBreakpoints.clear();
119 } 119 }
120 120
121 /** 121 /**
122 * @param {!WebInspector.UISourceCode} uiSourceCode 122 * @param {!Workspace.UISourceCode} uiSourceCode
123 */ 123 */
124 _restoreBreakpoints(uiSourceCode) { 124 _restoreBreakpoints(uiSourceCode) {
125 var sourceFileId = this._sourceFileId(uiSourceCode); 125 var sourceFileId = this._sourceFileId(uiSourceCode);
126 if (!sourceFileId) 126 if (!sourceFileId)
127 return; 127 return;
128 128
129 this._storage.mute(); 129 this._storage.mute();
130 var breakpointItems = this._storage.breakpointItems(this._sourceFileId(uiSou rceCode)); 130 var breakpointItems = this._storage.breakpointItems(this._sourceFileId(uiSou rceCode));
131 var provisionalBreakpoints = this._provisionalBreakpointsForSourceFileId(sou rceFileId); 131 var provisionalBreakpoints = this._provisionalBreakpointsForSourceFileId(sou rceFileId);
132 for (var i = 0; i < breakpointItems.length; ++i) { 132 for (var i = 0; i < breakpointItems.length; ++i) {
133 var breakpointItem = breakpointItems[i]; 133 var breakpointItem = breakpointItems[i];
134 var itemStorageId = WebInspector.BreakpointManager._breakpointStorageId( 134 var itemStorageId = Bindings.BreakpointManager._breakpointStorageId(
135 breakpointItem.sourceFileId, breakpointItem.lineNumber, breakpointItem .columnNumber); 135 breakpointItem.sourceFileId, breakpointItem.lineNumber, breakpointItem .columnNumber);
136 var provisionalBreakpoint = provisionalBreakpoints.get(itemStorageId); 136 var provisionalBreakpoint = provisionalBreakpoints.get(itemStorageId);
137 if (provisionalBreakpoint) { 137 if (provisionalBreakpoint) {
138 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)) 138 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
139 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []); 139 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []);
140 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provision alBreakpoint); 140 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(provision alBreakpoint);
141 provisionalBreakpoint._updateBreakpoint(); 141 provisionalBreakpoint._updateBreakpoint();
142 } else { 142 } else {
143 this._innerSetBreakpoint( 143 this._innerSetBreakpoint(
144 uiSourceCode, breakpointItem.lineNumber, breakpointItem.columnNumber , breakpointItem.condition, 144 uiSourceCode, breakpointItem.lineNumber, breakpointItem.columnNumber , breakpointItem.condition,
145 breakpointItem.enabled); 145 breakpointItem.enabled);
146 } 146 }
147 } 147 }
148 this._provisionalBreakpoints.removeAll(sourceFileId); 148 this._provisionalBreakpoints.removeAll(sourceFileId);
149 this._storage.unmute(); 149 this._storage.unmute();
150 } 150 }
151 151
152 /** 152 /**
153 * @param {!WebInspector.Event} event 153 * @param {!Common.Event} event
154 */ 154 */
155 _uiSourceCodeAdded(event) { 155 _uiSourceCodeAdded(event) {
156 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 156 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
157 this._restoreBreakpoints(uiSourceCode); 157 this._restoreBreakpoints(uiSourceCode);
158 if (uiSourceCode.contentType().hasScripts()) { 158 if (uiSourceCode.contentType().hasScripts()) {
159 uiSourceCode.addEventListener( 159 uiSourceCode.addEventListener(
160 WebInspector.UISourceCode.Events.SourceMappingChanged, this._uiSourceC odeMappingChanged, this); 160 Workspace.UISourceCode.Events.SourceMappingChanged, this._uiSourceCode MappingChanged, this);
161 } 161 }
162 } 162 }
163 163
164 /** 164 /**
165 * @param {!WebInspector.Event} event 165 * @param {!Common.Event} event
166 */ 166 */
167 _uiSourceCodeRemoved(event) { 167 _uiSourceCodeRemoved(event) {
168 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data); 168 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data);
169 this._removeUISourceCode(uiSourceCode); 169 this._removeUISourceCode(uiSourceCode);
170 } 170 }
171 171
172 /** 172 /**
173 * @param {!WebInspector.Event} event 173 * @param {!Common.Event} event
174 */ 174 */
175 _uiSourceCodeMappingChanged(event) { 175 _uiSourceCodeMappingChanged(event) {
176 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.target); 176 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target);
177 var isIdentity = /** @type {boolean} */ (event.data.isIdentity); 177 var isIdentity = /** @type {boolean} */ (event.data.isIdentity);
178 var target = /** @type {!WebInspector.Target} */ (event.data.target); 178 var target = /** @type {!SDK.Target} */ (event.data.target);
179 if (isIdentity) 179 if (isIdentity)
180 return; 180 return;
181 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode) || []; 181 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode) || [];
182 for (var i = 0; i < breakpoints.length; ++i) 182 for (var i = 0; i < breakpoints.length; ++i)
183 breakpoints[i]._updateInDebuggerForTarget(target); 183 breakpoints[i]._updateInDebuggerForTarget(target);
184 } 184 }
185 185
186 /** 186 /**
187 * @param {!WebInspector.UISourceCode} uiSourceCode 187 * @param {!Workspace.UISourceCode} uiSourceCode
188 */ 188 */
189 _removeUISourceCode(uiSourceCode) { 189 _removeUISourceCode(uiSourceCode) {
190 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode) || []; 190 var breakpoints = this._breakpointsForPrimaryUISourceCode.get(uiSourceCode) || [];
191 var sourceFileId = this._sourceFileId(uiSourceCode); 191 var sourceFileId = this._sourceFileId(uiSourceCode);
192 for (var i = 0; i < breakpoints.length; ++i) { 192 for (var i = 0; i < breakpoints.length; ++i) {
193 breakpoints[i]._resetLocations(); 193 breakpoints[i]._resetLocations();
194 if (breakpoints[i].enabled()) 194 if (breakpoints[i].enabled())
195 this._provisionalBreakpoints.set(sourceFileId, breakpoints[i]); 195 this._provisionalBreakpoints.set(sourceFileId, breakpoints[i]);
196 } 196 }
197 uiSourceCode.removeEventListener( 197 uiSourceCode.removeEventListener(
198 WebInspector.UISourceCode.Events.SourceMappingChanged, this._uiSourceCod eMappingChanged, this); 198 Workspace.UISourceCode.Events.SourceMappingChanged, this._uiSourceCodeMa ppingChanged, this);
199 this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode); 199 this._breakpointsForPrimaryUISourceCode.remove(uiSourceCode);
200 } 200 }
201 201
202 /** 202 /**
203 * @param {!WebInspector.UISourceCode} uiSourceCode 203 * @param {!Workspace.UISourceCode} uiSourceCode
204 * @param {number} lineNumber 204 * @param {number} lineNumber
205 * @param {number} columnNumber 205 * @param {number} columnNumber
206 * @param {string} condition 206 * @param {string} condition
207 * @param {boolean} enabled 207 * @param {boolean} enabled
208 * @return {!WebInspector.BreakpointManager.Breakpoint} 208 * @return {!Bindings.BreakpointManager.Breakpoint}
209 */ 209 */
210 setBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled) { 210 setBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled) {
211 var uiLocation = new WebInspector.UILocation(uiSourceCode, lineNumber, colum nNumber); 211 var uiLocation = new Workspace.UILocation(uiSourceCode, lineNumber, columnNu mber);
212 var normalizedLocation = this._debuggerWorkspaceBinding.normalizeUILocation( uiLocation); 212 var normalizedLocation = this._debuggerWorkspaceBinding.normalizeUILocation( uiLocation);
213 if (normalizedLocation.id() !== uiLocation.id()) { 213 if (normalizedLocation.id() !== uiLocation.id()) {
214 WebInspector.Revealer.reveal(normalizedLocation); 214 Common.Revealer.reveal(normalizedLocation);
215 uiLocation = normalizedLocation; 215 uiLocation = normalizedLocation;
216 } 216 }
217 this.setBreakpointsActive(true); 217 this.setBreakpointsActive(true);
218 return this._innerSetBreakpoint( 218 return this._innerSetBreakpoint(
219 uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, condition, enabled); 219 uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, condition, enabled);
220 } 220 }
221 221
222 /** 222 /**
223 * @param {!WebInspector.UISourceCode} uiSourceCode 223 * @param {!Workspace.UISourceCode} uiSourceCode
224 * @param {number} lineNumber 224 * @param {number} lineNumber
225 * @param {number} columnNumber 225 * @param {number} columnNumber
226 * @param {string} condition 226 * @param {string} condition
227 * @param {boolean} enabled 227 * @param {boolean} enabled
228 * @return {!WebInspector.BreakpointManager.Breakpoint} 228 * @return {!Bindings.BreakpointManager.Breakpoint}
229 */ 229 */
230 _innerSetBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled ) { 230 _innerSetBreakpoint(uiSourceCode, lineNumber, columnNumber, condition, enabled ) {
231 var breakpoint = this.findBreakpoint(uiSourceCode, lineNumber, columnNumber) ; 231 var breakpoint = this.findBreakpoint(uiSourceCode, lineNumber, columnNumber) ;
232 if (breakpoint) { 232 if (breakpoint) {
233 breakpoint._updateState(condition, enabled); 233 breakpoint._updateState(condition, enabled);
234 return breakpoint; 234 return breakpoint;
235 } 235 }
236 var projectId = uiSourceCode.project().id(); 236 var projectId = uiSourceCode.project().id();
237 var path = uiSourceCode.url(); 237 var path = uiSourceCode.url();
238 var sourceFileId = this._sourceFileId(uiSourceCode); 238 var sourceFileId = this._sourceFileId(uiSourceCode);
239 breakpoint = new WebInspector.BreakpointManager.Breakpoint( 239 breakpoint = new Bindings.BreakpointManager.Breakpoint(
240 this, projectId, path, sourceFileId, lineNumber, columnNumber, condition , enabled); 240 this, projectId, path, sourceFileId, lineNumber, columnNumber, condition , enabled);
241 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode)) 241 if (!this._breakpointsForPrimaryUISourceCode.get(uiSourceCode))
242 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []); 242 this._breakpointsForPrimaryUISourceCode.set(uiSourceCode, []);
243 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint); 243 this._breakpointsForPrimaryUISourceCode.get(uiSourceCode).push(breakpoint);
244 return breakpoint; 244 return breakpoint;
245 } 245 }
246 246
247 /** 247 /**
248 * @param {!WebInspector.UISourceCode} uiSourceCode 248 * @param {!Workspace.UISourceCode} uiSourceCode
249 * @param {number} lineNumber 249 * @param {number} lineNumber
250 * @return {!Array<!WebInspector.BreakpointManager.Breakpoint>} 250 * @return {!Array<!Bindings.BreakpointManager.Breakpoint>}
251 */ 251 */
252 findBreakpoints(uiSourceCode, lineNumber) { 252 findBreakpoints(uiSourceCode, lineNumber) {
253 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode); 253 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode);
254 var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null; 254 var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null;
255 return lineBreakpoints ? lineBreakpoints.valuesArray()[0] : []; 255 return lineBreakpoints ? lineBreakpoints.valuesArray()[0] : [];
256 } 256 }
257 257
258 /** 258 /**
259 * @param {!WebInspector.UISourceCode} uiSourceCode 259 * @param {!Workspace.UISourceCode} uiSourceCode
260 * @param {number} lineNumber 260 * @param {number} lineNumber
261 * @param {number} columnNumber 261 * @param {number} columnNumber
262 * @return {?WebInspector.BreakpointManager.Breakpoint} 262 * @return {?Bindings.BreakpointManager.Breakpoint}
263 */ 263 */
264 findBreakpoint(uiSourceCode, lineNumber, columnNumber) { 264 findBreakpoint(uiSourceCode, lineNumber, columnNumber) {
265 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode); 265 var breakpoints = this._breakpointsForUISourceCode.get(uiSourceCode);
266 var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null; 266 var lineBreakpoints = breakpoints ? breakpoints.get(lineNumber) : null;
267 var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber) : null; 267 var columnBreakpoints = lineBreakpoints ? lineBreakpoints.get(columnNumber) : null;
268 return columnBreakpoints ? columnBreakpoints[0] : null; 268 return columnBreakpoints ? columnBreakpoints[0] : null;
269 } 269 }
270 270
271 /** 271 /**
272 * @param {!WebInspector.UISourceCode} uiSourceCode 272 * @param {!Workspace.UISourceCode} uiSourceCode
273 * @param {!WebInspector.TextRange} textRange 273 * @param {!Common.TextRange} textRange
274 * @return {!Promise<!Array<!WebInspector.UILocation>>} 274 * @return {!Promise<!Array<!Workspace.UILocation>>}
275 */ 275 */
276 possibleBreakpoints(uiSourceCode, textRange) { 276 possibleBreakpoints(uiSourceCode, textRange) {
277 var targets = this._targetManager.targets(WebInspector.Target.Capability.JS) ; 277 var targets = this._targetManager.targets(SDK.Target.Capability.JS);
278 if (!targets.length) 278 if (!targets.length)
279 return Promise.resolve([]); 279 return Promise.resolve([]);
280 for (var target of targets) { 280 for (var target of targets) {
281 var startLocation = this._debuggerWorkspaceBinding.uiLocationToRawLocation (target, uiSourceCode, textRange.startLine, textRange.startColumn); 281 var startLocation = this._debuggerWorkspaceBinding.uiLocationToRawLocation (target, uiSourceCode, textRange.startLine, textRange.startColumn);
282 if (!startLocation) 282 if (!startLocation)
283 continue; 283 continue;
284 var endLocation = this._debuggerWorkspaceBinding.uiLocationToRawLocation(t arget, uiSourceCode, textRange.endLine, textRange.endColumn); 284 var endLocation = this._debuggerWorkspaceBinding.uiLocationToRawLocation(t arget, uiSourceCode, textRange.endLine, textRange.endColumn);
285 if (!endLocation) 285 if (!endLocation)
286 continue; 286 continue;
287 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 287 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
288 return debuggerModel.getPossibleBreakpoints(startLocation, endLocation).th en(toUILocations.bind(this)); 288 return debuggerModel.getPossibleBreakpoints(startLocation, endLocation).th en(toUILocations.bind(this));
289 } 289 }
290 return Promise.resolve([]); 290 return Promise.resolve([]);
291 291
292 /** 292 /**
293 * @this {!WebInspector.BreakpointManager} 293 * @this {!Bindings.BreakpointManager}
294 * @param {!Array<!WebInspector.DebuggerModel.Location>} locations 294 * @param {!Array<!SDK.DebuggerModel.Location>} locations
295 * @return {!Array<!WebInspector.UILocation>} 295 * @return {!Array<!Workspace.UILocation>}
296 */ 296 */
297 function toUILocations(locations) { 297 function toUILocations(locations) {
298 var sortedLocations = locations.map(location => this._debuggerWorkspaceBin ding.rawLocationToUILocation(location)); 298 var sortedLocations = locations.map(location => this._debuggerWorkspaceBin ding.rawLocationToUILocation(location));
299 sortedLocations = sortedLocations.filter(location => location && location. uiSourceCode === uiSourceCode); 299 sortedLocations = sortedLocations.filter(location => location && location. uiSourceCode === uiSourceCode);
300 sortedLocations.sort(WebInspector.UILocation.comparator); 300 sortedLocations.sort(Workspace.UILocation.comparator);
301 if (!sortedLocations.length) 301 if (!sortedLocations.length)
302 return []; 302 return [];
303 var result = [ sortedLocations[0] ]; 303 var result = [ sortedLocations[0] ];
304 var lastLocation = sortedLocations[0]; 304 var lastLocation = sortedLocations[0];
305 for (var i = 1; i < sortedLocations.length; ++i) { 305 for (var i = 1; i < sortedLocations.length; ++i) {
306 if (sortedLocations[i].id() === lastLocation.id()) 306 if (sortedLocations[i].id() === lastLocation.id())
307 continue; 307 continue;
308 result.push(sortedLocations[i]); 308 result.push(sortedLocations[i]);
309 lastLocation = sortedLocations[i]; 309 lastLocation = sortedLocations[i];
310 } 310 }
311 return result; 311 return result;
312 } 312 }
313 } 313 }
314 314
315 /** 315 /**
316 * @param {!WebInspector.UISourceCode} uiSourceCode 316 * @param {!Workspace.UISourceCode} uiSourceCode
317 * @return {!Array.<!WebInspector.BreakpointManager.Breakpoint>} 317 * @return {!Array.<!Bindings.BreakpointManager.Breakpoint>}
318 */ 318 */
319 breakpointsForUISourceCode(uiSourceCode) { 319 breakpointsForUISourceCode(uiSourceCode) {
320 var result = []; 320 var result = [];
321 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode); 321 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode);
322 var breakpoints = uiSourceCodeBreakpoints ? uiSourceCodeBreakpoints.valuesAr ray() : []; 322 var breakpoints = uiSourceCodeBreakpoints ? uiSourceCodeBreakpoints.valuesAr ray() : [];
323 for (var i = 0; i < breakpoints.length; ++i) { 323 for (var i = 0; i < breakpoints.length; ++i) {
324 var lineBreakpoints = breakpoints[i]; 324 var lineBreakpoints = breakpoints[i];
325 var columnBreakpointArrays = lineBreakpoints ? lineBreakpoints.valuesArray () : []; 325 var columnBreakpointArrays = lineBreakpoints ? lineBreakpoints.valuesArray () : [];
326 result = result.concat.apply(result, columnBreakpointArrays); 326 result = result.concat.apply(result, columnBreakpointArrays);
327 } 327 }
328 return result; 328 return result;
329 } 329 }
330 330
331 /** 331 /**
332 * @return {!Array.<!WebInspector.BreakpointManager.Breakpoint>} 332 * @return {!Array.<!Bindings.BreakpointManager.Breakpoint>}
333 */ 333 */
334 allBreakpoints() { 334 allBreakpoints() {
335 var result = []; 335 var result = [];
336 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray(); 336 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray();
337 for (var i = 0; i < uiSourceCodes.length; ++i) 337 for (var i = 0; i < uiSourceCodes.length; ++i)
338 result = result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i])); 338 result = result.concat(this.breakpointsForUISourceCode(uiSourceCodes[i]));
339 return result; 339 return result;
340 } 340 }
341 341
342 /** 342 /**
343 * @param {!WebInspector.UISourceCode} uiSourceCode 343 * @param {!Workspace.UISourceCode} uiSourceCode
344 * @return {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint, uiLocation: !WebInspector.UILocation}>} 344 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>}
345 */ 345 */
346 breakpointLocationsForUISourceCode(uiSourceCode) { 346 breakpointLocationsForUISourceCode(uiSourceCode) {
347 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode); 347 var uiSourceCodeBreakpoints = this._breakpointsForUISourceCode.get(uiSourceC ode);
348 var lineNumbers = uiSourceCodeBreakpoints ? uiSourceCodeBreakpoints.keysArra y() : []; 348 var lineNumbers = uiSourceCodeBreakpoints ? uiSourceCodeBreakpoints.keysArra y() : [];
349 var result = []; 349 var result = [];
350 for (var i = 0; i < lineNumbers.length; ++i) { 350 for (var i = 0; i < lineNumbers.length; ++i) {
351 var lineBreakpoints = uiSourceCodeBreakpoints.get(lineNumbers[i]); 351 var lineBreakpoints = uiSourceCodeBreakpoints.get(lineNumbers[i]);
352 var columnNumbers = lineBreakpoints.keysArray(); 352 var columnNumbers = lineBreakpoints.keysArray();
353 for (var j = 0; j < columnNumbers.length; ++j) { 353 for (var j = 0; j < columnNumbers.length; ++j) {
354 var columnBreakpoints = lineBreakpoints.get(columnNumbers[j]); 354 var columnBreakpoints = lineBreakpoints.get(columnNumbers[j]);
355 var lineNumber = parseInt(lineNumbers[i], 10); 355 var lineNumber = parseInt(lineNumbers[i], 10);
356 var columnNumber = parseInt(columnNumbers[j], 10); 356 var columnNumber = parseInt(columnNumbers[j], 10);
357 for (var k = 0; k < columnBreakpoints.length; ++k) { 357 for (var k = 0; k < columnBreakpoints.length; ++k) {
358 var breakpoint = columnBreakpoints[k]; 358 var breakpoint = columnBreakpoints[k];
359 var uiLocation = uiSourceCode.uiLocation(lineNumber, columnNumber); 359 var uiLocation = uiSourceCode.uiLocation(lineNumber, columnNumber);
360 result.push({breakpoint: breakpoint, uiLocation: uiLocation}); 360 result.push({breakpoint: breakpoint, uiLocation: uiLocation});
361 } 361 }
362 } 362 }
363 } 363 }
364 return result; 364 return result;
365 } 365 }
366 366
367 /** 367 /**
368 * @return {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint, uiLocation: !WebInspector.UILocation}>} 368 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo cation: !Workspace.UILocation}>}
369 */ 369 */
370 allBreakpointLocations() { 370 allBreakpointLocations() {
371 var result = []; 371 var result = [];
372 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray(); 372 var uiSourceCodes = this._breakpointsForUISourceCode.keysArray();
373 for (var i = 0; i < uiSourceCodes.length; ++i) 373 for (var i = 0; i < uiSourceCodes.length; ++i)
374 result = result.concat(this.breakpointLocationsForUISourceCode(uiSourceCod es[i])); 374 result = result.concat(this.breakpointLocationsForUISourceCode(uiSourceCod es[i]));
375 return result; 375 return result;
376 } 376 }
377 377
378 /** 378 /**
379 * @param {boolean} toggleState 379 * @param {boolean} toggleState
380 */ 380 */
381 toggleAllBreakpoints(toggleState) { 381 toggleAllBreakpoints(toggleState) {
382 var breakpoints = this.allBreakpoints(); 382 var breakpoints = this.allBreakpoints();
383 for (var i = 0; i < breakpoints.length; ++i) 383 for (var i = 0; i < breakpoints.length; ++i)
384 breakpoints[i].setEnabled(toggleState); 384 breakpoints[i].setEnabled(toggleState);
385 } 385 }
386 386
387 removeAllBreakpoints() { 387 removeAllBreakpoints() {
388 var breakpoints = this.allBreakpoints(); 388 var breakpoints = this.allBreakpoints();
389 for (var i = 0; i < breakpoints.length; ++i) 389 for (var i = 0; i < breakpoints.length; ++i)
390 breakpoints[i].remove(); 390 breakpoints[i].remove();
391 } 391 }
392 392
393 _projectRemoved(event) { 393 _projectRemoved(event) {
394 var project = /** @type {!WebInspector.Project} */ (event.data); 394 var project = /** @type {!Workspace.Project} */ (event.data);
395 var uiSourceCodes = project.uiSourceCodes(); 395 var uiSourceCodes = project.uiSourceCodes();
396 for (var i = 0; i < uiSourceCodes.length; ++i) 396 for (var i = 0; i < uiSourceCodes.length; ++i)
397 this._removeUISourceCode(uiSourceCodes[i]); 397 this._removeUISourceCode(uiSourceCodes[i]);
398 } 398 }
399 399
400 /** 400 /**
401 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 401 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
402 * @param {boolean} removeFromStorage 402 * @param {boolean} removeFromStorage
403 */ 403 */
404 _removeBreakpoint(breakpoint, removeFromStorage) { 404 _removeBreakpoint(breakpoint, removeFromStorage) {
405 var uiSourceCode = breakpoint.uiSourceCode(); 405 var uiSourceCode = breakpoint.uiSourceCode();
406 var breakpoints = uiSourceCode ? this._breakpointsForPrimaryUISourceCode.get (uiSourceCode) || [] : []; 406 var breakpoints = uiSourceCode ? this._breakpointsForPrimaryUISourceCode.get (uiSourceCode) || [] : [];
407 breakpoints.remove(breakpoint); 407 breakpoints.remove(breakpoint);
408 if (removeFromStorage) 408 if (removeFromStorage)
409 this._storage._removeBreakpoint(breakpoint); 409 this._storage._removeBreakpoint(breakpoint);
410 this._provisionalBreakpoints.remove(breakpoint._sourceFileId, breakpoint); 410 this._provisionalBreakpoints.remove(breakpoint._sourceFileId, breakpoint);
411 } 411 }
412 412
413 /** 413 /**
414 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 414 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
415 * @param {!WebInspector.UILocation} uiLocation 415 * @param {!Workspace.UILocation} uiLocation
416 */ 416 */
417 _uiLocationAdded(breakpoint, uiLocation) { 417 _uiLocationAdded(breakpoint, uiLocation) {
418 var breakpoints = this._breakpointsForUISourceCode.get(uiLocation.uiSourceCo de); 418 var breakpoints = this._breakpointsForUISourceCode.get(uiLocation.uiSourceCo de);
419 if (!breakpoints) { 419 if (!breakpoints) {
420 breakpoints = new Map(); 420 breakpoints = new Map();
421 this._breakpointsForUISourceCode.set(uiLocation.uiSourceCode, breakpoints) ; 421 this._breakpointsForUISourceCode.set(uiLocation.uiSourceCode, breakpoints) ;
422 } 422 }
423 var lineBreakpoints = breakpoints.get(uiLocation.lineNumber); 423 var lineBreakpoints = breakpoints.get(uiLocation.lineNumber);
424 if (!lineBreakpoints) { 424 if (!lineBreakpoints) {
425 lineBreakpoints = new Map(); 425 lineBreakpoints = new Map();
426 breakpoints.set(uiLocation.lineNumber, lineBreakpoints); 426 breakpoints.set(uiLocation.lineNumber, lineBreakpoints);
427 } 427 }
428 var columnBreakpoints = lineBreakpoints.get(uiLocation.columnNumber); 428 var columnBreakpoints = lineBreakpoints.get(uiLocation.columnNumber);
429 if (!columnBreakpoints) { 429 if (!columnBreakpoints) {
430 columnBreakpoints = []; 430 columnBreakpoints = [];
431 lineBreakpoints.set(uiLocation.columnNumber, columnBreakpoints); 431 lineBreakpoints.set(uiLocation.columnNumber, columnBreakpoints);
432 } 432 }
433 columnBreakpoints.push(breakpoint); 433 columnBreakpoints.push(breakpoint);
434 this.dispatchEventToListeners( 434 this.dispatchEventToListeners(
435 WebInspector.BreakpointManager.Events.BreakpointAdded, {breakpoint: brea kpoint, uiLocation: uiLocation}); 435 Bindings.BreakpointManager.Events.BreakpointAdded, {breakpoint: breakpoi nt, uiLocation: uiLocation});
436 } 436 }
437 437
438 /** 438 /**
439 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 439 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
440 * @param {!WebInspector.UILocation} uiLocation 440 * @param {!Workspace.UILocation} uiLocation
441 */ 441 */
442 _uiLocationRemoved(breakpoint, uiLocation) { 442 _uiLocationRemoved(breakpoint, uiLocation) {
443 var breakpoints = this._breakpointsForUISourceCode.get(uiLocation.uiSourceCo de); 443 var breakpoints = this._breakpointsForUISourceCode.get(uiLocation.uiSourceCo de);
444 if (!breakpoints) 444 if (!breakpoints)
445 return; 445 return;
446 446
447 var lineBreakpoints = breakpoints.get(uiLocation.lineNumber); 447 var lineBreakpoints = breakpoints.get(uiLocation.lineNumber);
448 if (!lineBreakpoints) 448 if (!lineBreakpoints)
449 return; 449 return;
450 var columnBreakpoints = lineBreakpoints.get(uiLocation.columnNumber); 450 var columnBreakpoints = lineBreakpoints.get(uiLocation.columnNumber);
451 if (!columnBreakpoints) 451 if (!columnBreakpoints)
452 return; 452 return;
453 columnBreakpoints.remove(breakpoint); 453 columnBreakpoints.remove(breakpoint);
454 if (!columnBreakpoints.length) 454 if (!columnBreakpoints.length)
455 lineBreakpoints.remove(uiLocation.columnNumber); 455 lineBreakpoints.remove(uiLocation.columnNumber);
456 if (!lineBreakpoints.size) 456 if (!lineBreakpoints.size)
457 breakpoints.remove(uiLocation.lineNumber); 457 breakpoints.remove(uiLocation.lineNumber);
458 if (!breakpoints.size) 458 if (!breakpoints.size)
459 this._breakpointsForUISourceCode.remove(uiLocation.uiSourceCode); 459 this._breakpointsForUISourceCode.remove(uiLocation.uiSourceCode);
460 this.dispatchEventToListeners( 460 this.dispatchEventToListeners(
461 WebInspector.BreakpointManager.Events.BreakpointRemoved, {breakpoint: br eakpoint, uiLocation: uiLocation}); 461 Bindings.BreakpointManager.Events.BreakpointRemoved, {breakpoint: breakp oint, uiLocation: uiLocation});
462 } 462 }
463 463
464 /** 464 /**
465 * @param {boolean} active 465 * @param {boolean} active
466 */ 466 */
467 setBreakpointsActive(active) { 467 setBreakpointsActive(active) {
468 if (this._breakpointsActive === active) 468 if (this._breakpointsActive === active)
469 return; 469 return;
470 470
471 this._breakpointsActive = active; 471 this._breakpointsActive = active;
472 var debuggerModels = WebInspector.DebuggerModel.instances(); 472 var debuggerModels = SDK.DebuggerModel.instances();
473 for (var i = 0; i < debuggerModels.length; ++i) 473 for (var i = 0; i < debuggerModels.length; ++i)
474 debuggerModels[i].setBreakpointsActive(active); 474 debuggerModels[i].setBreakpointsActive(active);
475 475
476 this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.Breakpoi ntsActiveStateChanged, active); 476 this.dispatchEventToListeners(Bindings.BreakpointManager.Events.BreakpointsA ctiveStateChanged, active);
477 } 477 }
478 478
479 /** 479 /**
480 * @return {boolean} 480 * @return {boolean}
481 */ 481 */
482 breakpointsActive() { 482 breakpointsActive() {
483 return this._breakpointsActive; 483 return this._breakpointsActive;
484 } 484 }
485 }; 485 };
486 486
487 /** @enum {symbol} */ 487 /** @enum {symbol} */
488 WebInspector.BreakpointManager.Events = { 488 Bindings.BreakpointManager.Events = {
489 BreakpointAdded: Symbol('breakpoint-added'), 489 BreakpointAdded: Symbol('breakpoint-added'),
490 BreakpointRemoved: Symbol('breakpoint-removed'), 490 BreakpointRemoved: Symbol('breakpoint-removed'),
491 BreakpointsActiveStateChanged: Symbol('BreakpointsActiveStateChanged') 491 BreakpointsActiveStateChanged: Symbol('BreakpointsActiveStateChanged')
492 }; 492 };
493 493
494 494
495 /** 495 /**
496 * @implements {WebInspector.TargetManager.Observer} 496 * @implements {SDK.TargetManager.Observer}
497 * @unrestricted 497 * @unrestricted
498 */ 498 */
499 WebInspector.BreakpointManager.Breakpoint = class { 499 Bindings.BreakpointManager.Breakpoint = class {
500 /** 500 /**
501 * @param {!WebInspector.BreakpointManager} breakpointManager 501 * @param {!Bindings.BreakpointManager} breakpointManager
502 * @param {string} projectId 502 * @param {string} projectId
503 * @param {string} path 503 * @param {string} path
504 * @param {string} sourceFileId 504 * @param {string} sourceFileId
505 * @param {number} lineNumber 505 * @param {number} lineNumber
506 * @param {number} columnNumber 506 * @param {number} columnNumber
507 * @param {string} condition 507 * @param {string} condition
508 * @param {boolean} enabled 508 * @param {boolean} enabled
509 */ 509 */
510 constructor(breakpointManager, projectId, path, sourceFileId, lineNumber, colu mnNumber, condition, enabled) { 510 constructor(breakpointManager, projectId, path, sourceFileId, lineNumber, colu mnNumber, condition, enabled) {
511 this._breakpointManager = breakpointManager; 511 this._breakpointManager = breakpointManager;
512 this._projectId = projectId; 512 this._projectId = projectId;
513 this._path = path; 513 this._path = path;
514 this._lineNumber = lineNumber; 514 this._lineNumber = lineNumber;
515 this._columnNumber = columnNumber; 515 this._columnNumber = columnNumber;
516 this._sourceFileId = sourceFileId; 516 this._sourceFileId = sourceFileId;
517 517
518 /** @type {!Map<string, number>} */ 518 /** @type {!Map<string, number>} */
519 this._numberOfDebuggerLocationForUILocation = new Map(); 519 this._numberOfDebuggerLocationForUILocation = new Map();
520 520
521 // Force breakpoint update. 521 // Force breakpoint update.
522 /** @type {string} */ this._condition; 522 /** @type {string} */ this._condition;
523 /** @type {boolean} */ this._enabled; 523 /** @type {boolean} */ this._enabled;
524 /** @type {boolean} */ this._isRemoved; 524 /** @type {boolean} */ this._isRemoved;
525 /** @type {!WebInspector.UILocation|undefined} */ this._fakePrimaryLocation; 525 /** @type {!Workspace.UILocation|undefined} */ this._fakePrimaryLocation;
526 526
527 this._currentState = null; 527 this._currentState = null;
528 /** @type {!Map.<!WebInspector.Target, !WebInspector.BreakpointManager.Targe tBreakpoint>}*/ 528 /** @type {!Map.<!SDK.Target, !Bindings.BreakpointManager.TargetBreakpoint>} */
529 this._targetBreakpoints = new Map(); 529 this._targetBreakpoints = new Map();
530 this._updateState(condition, enabled); 530 this._updateState(condition, enabled);
531 this._breakpointManager._targetManager.observeTargets(this); 531 this._breakpointManager._targetManager.observeTargets(this);
532 } 532 }
533 533
534 /** 534 /**
535 * @override 535 * @override
536 * @param {!WebInspector.Target} target 536 * @param {!SDK.Target} target
537 */ 537 */
538 targetAdded(target) { 538 targetAdded(target) {
539 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 539 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
540 if (!debuggerModel) 540 if (!debuggerModel)
541 return; 541 return;
542 var debuggerWorkspaceBinding = this._breakpointManager._debuggerWorkspaceBin ding; 542 var debuggerWorkspaceBinding = this._breakpointManager._debuggerWorkspaceBin ding;
543 this._targetBreakpoints.set( 543 this._targetBreakpoints.set(
544 target, new WebInspector.BreakpointManager.TargetBreakpoint(debuggerMode l, this, debuggerWorkspaceBinding)); 544 target, new Bindings.BreakpointManager.TargetBreakpoint(debuggerModel, t his, debuggerWorkspaceBinding));
545 } 545 }
546 546
547 /** 547 /**
548 * @override 548 * @override
549 * @param {!WebInspector.Target} target 549 * @param {!SDK.Target} target
550 */ 550 */
551 targetRemoved(target) { 551 targetRemoved(target) {
552 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 552 var debuggerModel = SDK.DebuggerModel.fromTarget(target);
553 if (!debuggerModel) 553 if (!debuggerModel)
554 return; 554 return;
555 var targetBreakpoint = this._targetBreakpoints.remove(target); 555 var targetBreakpoint = this._targetBreakpoints.remove(target);
556 targetBreakpoint._cleanUpAfterDebuggerIsGone(); 556 targetBreakpoint._cleanUpAfterDebuggerIsGone();
557 targetBreakpoint._removeEventListeners(); 557 targetBreakpoint._removeEventListeners();
558 } 558 }
559 559
560 /** 560 /**
561 * @return {string} 561 * @return {string}
562 */ 562 */
(...skipping 16 matching lines...) Expand all
579 } 579 }
580 580
581 /** 581 /**
582 * @return {number} 582 * @return {number}
583 */ 583 */
584 columnNumber() { 584 columnNumber() {
585 return this._columnNumber; 585 return this._columnNumber;
586 } 586 }
587 587
588 /** 588 /**
589 * @return {?WebInspector.UISourceCode} 589 * @return {?Workspace.UISourceCode}
590 */ 590 */
591 uiSourceCode() { 591 uiSourceCode() {
592 return this._breakpointManager._workspace.uiSourceCode(this._projectId, this ._path); 592 return this._breakpointManager._workspace.uiSourceCode(this._projectId, this ._path);
593 } 593 }
594 594
595 /** 595 /**
596 * @param {?WebInspector.UILocation} oldUILocation 596 * @param {?Workspace.UILocation} oldUILocation
597 * @param {!WebInspector.UILocation} newUILocation 597 * @param {!Workspace.UILocation} newUILocation
598 */ 598 */
599 _replaceUILocation(oldUILocation, newUILocation) { 599 _replaceUILocation(oldUILocation, newUILocation) {
600 if (this._isRemoved) 600 if (this._isRemoved)
601 return; 601 return;
602 602
603 this._removeUILocation(oldUILocation, true); 603 this._removeUILocation(oldUILocation, true);
604 this._removeFakeBreakpointAtPrimaryLocation(); 604 this._removeFakeBreakpointAtPrimaryLocation();
605 605
606 var current = (this._numberOfDebuggerLocationForUILocation.get(newUILocation .id()) || 0) + 1; 606 var current = (this._numberOfDebuggerLocationForUILocation.get(newUILocation .id()) || 0) + 1;
607 this._numberOfDebuggerLocationForUILocation.set(newUILocation.id(), current) ; 607 this._numberOfDebuggerLocationForUILocation.set(newUILocation.id(), current) ;
608 if (current === 1) 608 if (current === 1)
609 this._breakpointManager._uiLocationAdded(this, newUILocation); 609 this._breakpointManager._uiLocationAdded(this, newUILocation);
610 } 610 }
611 611
612 /** 612 /**
613 * @param {?WebInspector.UILocation} uiLocation 613 * @param {?Workspace.UILocation} uiLocation
614 * @param {boolean=} muteCreationFakeBreakpoint 614 * @param {boolean=} muteCreationFakeBreakpoint
615 */ 615 */
616 _removeUILocation(uiLocation, muteCreationFakeBreakpoint) { 616 _removeUILocation(uiLocation, muteCreationFakeBreakpoint) {
617 if (!uiLocation || !this._numberOfDebuggerLocationForUILocation.has(uiLocati on.id())) 617 if (!uiLocation || !this._numberOfDebuggerLocationForUILocation.has(uiLocati on.id()))
618 return; 618 return;
619 var current = (this._numberOfDebuggerLocationForUILocation.get(uiLocation.id ()) || 0) - 1; 619 var current = (this._numberOfDebuggerLocationForUILocation.get(uiLocation.id ()) || 0) - 1;
620 this._numberOfDebuggerLocationForUILocation.set(uiLocation.id(), current); 620 this._numberOfDebuggerLocationForUILocation.set(uiLocation.id(), current);
621 if (current !== 0) 621 if (current !== 0)
622 return; 622 return;
623 623
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 for (var i = 0; i < targetBreakpoints.length; ++i) { 687 for (var i = 0; i < targetBreakpoints.length; ++i) {
688 targetBreakpoints[i]._scheduleUpdateInDebugger(); 688 targetBreakpoints[i]._scheduleUpdateInDebugger();
689 targetBreakpoints[i]._removeEventListeners(); 689 targetBreakpoints[i]._removeEventListeners();
690 } 690 }
691 691
692 this._breakpointManager._removeBreakpoint(this, removeFromStorage); 692 this._breakpointManager._removeBreakpoint(this, removeFromStorage);
693 this._breakpointManager._targetManager.unobserveTargets(this); 693 this._breakpointManager._targetManager.unobserveTargets(this);
694 } 694 }
695 695
696 /** 696 /**
697 * @param {!WebInspector.Target} target 697 * @param {!SDK.Target} target
698 */ 698 */
699 _updateInDebuggerForTarget(target) { 699 _updateInDebuggerForTarget(target) {
700 this._targetBreakpoints.get(target)._scheduleUpdateInDebugger(); 700 this._targetBreakpoints.get(target)._scheduleUpdateInDebugger();
701 } 701 }
702 702
703 /** 703 /**
704 * @return {string} 704 * @return {string}
705 */ 705 */
706 _breakpointStorageId() { 706 _breakpointStorageId() {
707 return WebInspector.BreakpointManager._breakpointStorageId( 707 return Bindings.BreakpointManager._breakpointStorageId(
708 this._sourceFileId, this._lineNumber, this._columnNumber); 708 this._sourceFileId, this._lineNumber, this._columnNumber);
709 } 709 }
710 710
711 _fakeBreakpointAtPrimaryLocation() { 711 _fakeBreakpointAtPrimaryLocation() {
712 if (this._isRemoved || this._numberOfDebuggerLocationForUILocation.size || t his._fakePrimaryLocation) 712 if (this._isRemoved || this._numberOfDebuggerLocationForUILocation.size || t his._fakePrimaryLocation)
713 return; 713 return;
714 714
715 var uiSourceCode = this._breakpointManager._workspace.uiSourceCode(this._pro jectId, this._path); 715 var uiSourceCode = this._breakpointManager._workspace.uiSourceCode(this._pro jectId, this._path);
716 if (!uiSourceCode) 716 if (!uiSourceCode)
717 return; 717 return;
(...skipping 14 matching lines...) Expand all
732 this._removeFakeBreakpointAtPrimaryLocation(); 732 this._removeFakeBreakpointAtPrimaryLocation();
733 var targetBreakpoints = this._targetBreakpoints.valuesArray(); 733 var targetBreakpoints = this._targetBreakpoints.valuesArray();
734 for (var i = 0; i < targetBreakpoints.length; ++i) 734 for (var i = 0; i < targetBreakpoints.length; ++i)
735 targetBreakpoints[i]._resetLocations(); 735 targetBreakpoints[i]._resetLocations();
736 } 736 }
737 }; 737 };
738 738
739 /** 739 /**
740 * @unrestricted 740 * @unrestricted
741 */ 741 */
742 WebInspector.BreakpointManager.TargetBreakpoint = class extends WebInspector.SDK Object { 742 Bindings.BreakpointManager.TargetBreakpoint = class extends SDK.SDKObject {
743 /** 743 /**
744 * @param {!WebInspector.DebuggerModel} debuggerModel 744 * @param {!SDK.DebuggerModel} debuggerModel
745 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 745 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
746 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding 746 * @param {!Bindings.DebuggerWorkspaceBinding} debuggerWorkspaceBinding
747 */ 747 */
748 constructor(debuggerModel, breakpoint, debuggerWorkspaceBinding) { 748 constructor(debuggerModel, breakpoint, debuggerWorkspaceBinding) {
749 super(debuggerModel.target()); 749 super(debuggerModel.target());
750 this._debuggerModel = debuggerModel; 750 this._debuggerModel = debuggerModel;
751 this._breakpoint = breakpoint; 751 this._breakpoint = breakpoint;
752 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; 752 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding;
753 753
754 this._liveLocations = new WebInspector.LiveLocationPool(); 754 this._liveLocations = new Bindings.LiveLocationPool();
755 755
756 /** @type {!Map<string, !WebInspector.UILocation>} */ 756 /** @type {!Map<string, !Workspace.UILocation>} */
757 this._uiLocations = new Map(); 757 this._uiLocations = new Map();
758 this._debuggerModel.addEventListener( 758 this._debuggerModel.addEventListener(
759 WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._cleanUpAfte rDebuggerIsGone, this); 759 SDK.DebuggerModel.Events.DebuggerWasDisabled, this._cleanUpAfterDebugger IsGone, this);
760 this._debuggerModel.addEventListener( 760 this._debuggerModel.addEventListener(
761 WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._scheduleUpda teInDebugger, this); 761 SDK.DebuggerModel.Events.DebuggerWasEnabled, this._scheduleUpdateInDebug ger, this);
762 this._hasPendingUpdate = false; 762 this._hasPendingUpdate = false;
763 this._isUpdating = false; 763 this._isUpdating = false;
764 this._cancelCallback = false; 764 this._cancelCallback = false;
765 this._currentState = null; 765 this._currentState = null;
766 if (this._debuggerModel.debuggerEnabled()) 766 if (this._debuggerModel.debuggerEnabled())
767 this._scheduleUpdateInDebugger(); 767 this._scheduleUpdateInDebugger();
768 } 768 }
769 769
770 _resetLocations() { 770 _resetLocations() {
771 for (var uiLocation of this._uiLocations.values()) 771 for (var uiLocation of this._uiLocations.values())
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 821
822 var debuggerLocation = uiSourceCode ? 822 var debuggerLocation = uiSourceCode ?
823 this._debuggerWorkspaceBinding.uiLocationToRawLocation(this.target(), ui SourceCode, lineNumber, columnNumber) : 823 this._debuggerWorkspaceBinding.uiLocationToRawLocation(this.target(), ui SourceCode, lineNumber, columnNumber) :
824 null; 824 null;
825 var newState; 825 var newState;
826 if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scri ptDiverged()) 826 if (this._breakpoint._isRemoved || !this._breakpoint.enabled() || this._scri ptDiverged())
827 newState = null; 827 newState = null;
828 else if (debuggerLocation) { 828 else if (debuggerLocation) {
829 var script = debuggerLocation.script(); 829 var script = debuggerLocation.script();
830 if (script.sourceURL) 830 if (script.sourceURL)
831 newState = new WebInspector.BreakpointManager.Breakpoint.State( 831 newState = new Bindings.BreakpointManager.Breakpoint.State(
832 script.sourceURL, null, debuggerLocation.lineNumber, debuggerLocatio n.columnNumber, condition); 832 script.sourceURL, null, debuggerLocation.lineNumber, debuggerLocatio n.columnNumber, condition);
833 else 833 else
834 newState = new WebInspector.BreakpointManager.Breakpoint.State( 834 newState = new Bindings.BreakpointManager.Breakpoint.State(
835 null, debuggerLocation.scriptId, debuggerLocation.lineNumber, debugg erLocation.columnNumber, condition); 835 null, debuggerLocation.scriptId, debuggerLocation.lineNumber, debugg erLocation.columnNumber, condition);
836 } else if (this._breakpoint._currentState && this._breakpoint._currentState. url) { 836 } else if (this._breakpoint._currentState && this._breakpoint._currentState. url) {
837 var position = this._breakpoint._currentState; 837 var position = this._breakpoint._currentState;
838 newState = new WebInspector.BreakpointManager.Breakpoint.State( 838 newState = new Bindings.BreakpointManager.Breakpoint.State(
839 position.url, null, position.lineNumber, position.columnNumber, condit ion); 839 position.url, null, position.lineNumber, position.columnNumber, condit ion);
840 } else if (uiSourceCode) { 840 } else if (uiSourceCode) {
841 newState = new WebInspector.BreakpointManager.Breakpoint.State( 841 newState = new Bindings.BreakpointManager.Breakpoint.State(
842 uiSourceCode.url(), null, lineNumber, columnNumber, condition); 842 uiSourceCode.url(), null, lineNumber, columnNumber, condition);
843 } 843 }
844 if (this._debuggerId && WebInspector.BreakpointManager.Breakpoint.State.equa ls(newState, this._currentState)) { 844 if (this._debuggerId && Bindings.BreakpointManager.Breakpoint.State.equals(n ewState, this._currentState)) {
845 callback(); 845 callback();
846 return; 846 return;
847 } 847 }
848 848
849 this._breakpoint._currentState = newState; 849 this._breakpoint._currentState = newState;
850 850
851 if (this._debuggerId) { 851 if (this._debuggerId) {
852 this._resetLocations(); 852 this._resetLocations();
853 this._debuggerModel.removeBreakpoint(this._debuggerId, this._didRemoveFrom Debugger.bind(this, callback)); 853 this._debuggerModel.removeBreakpoint(this._debuggerId, this._didRemoveFrom Debugger.bind(this, callback));
854 this._scheduleUpdateInDebugger(); 854 this._scheduleUpdateInDebugger();
855 this._currentState = null; 855 this._currentState = null;
856 return; 856 return;
857 } 857 }
858 858
859 if (!newState) { 859 if (!newState) {
860 callback(); 860 callback();
861 return; 861 return;
862 } 862 }
863 863
864 var updateCallback = this._didSetBreakpointInDebugger.bind(this, callback); 864 var updateCallback = this._didSetBreakpointInDebugger.bind(this, callback);
865 if (newState.url) 865 if (newState.url)
866 this._debuggerModel.setBreakpointByURL( 866 this._debuggerModel.setBreakpointByURL(
867 newState.url, newState.lineNumber, newState.columnNumber, this._breakp oint.condition(), updateCallback); 867 newState.url, newState.lineNumber, newState.columnNumber, this._breakp oint.condition(), updateCallback);
868 else if (newState.scriptId) 868 else if (newState.scriptId)
869 this._debuggerModel.setBreakpointBySourceId( 869 this._debuggerModel.setBreakpointBySourceId(
870 /** @type {!WebInspector.DebuggerModel.Location} */ (debuggerLocation) , condition, updateCallback); 870 /** @type {!SDK.DebuggerModel.Location} */ (debuggerLocation), conditi on, updateCallback);
871 871
872 this._currentState = newState; 872 this._currentState = newState;
873 } 873 }
874 874
875 /** 875 /**
876 * @param {function()} callback 876 * @param {function()} callback
877 * @param {?Protocol.Debugger.BreakpointId} breakpointId 877 * @param {?Protocol.Debugger.BreakpointId} breakpointId
878 * @param {!Array.<!WebInspector.DebuggerModel.Location>} locations 878 * @param {!Array.<!SDK.DebuggerModel.Location>} locations
879 */ 879 */
880 _didSetBreakpointInDebugger(callback, breakpointId, locations) { 880 _didSetBreakpointInDebugger(callback, breakpointId, locations) {
881 if (this._cancelCallback) { 881 if (this._cancelCallback) {
882 this._cancelCallback = false; 882 this._cancelCallback = false;
883 callback(); 883 callback();
884 return; 884 return;
885 } 885 }
886 886
887 if (!breakpointId) { 887 if (!breakpointId) {
888 this._breakpoint.remove(true); 888 this._breakpoint.remove(true);
(...skipping 20 matching lines...) Expand all
909 return; 909 return;
910 } 910 }
911 911
912 this._resetLocations(); 912 this._resetLocations();
913 this._debuggerModel.removeBreakpointListener(this._debuggerId, this._breakpo intResolved, this); 913 this._debuggerModel.removeBreakpointListener(this._debuggerId, this._breakpo intResolved, this);
914 delete this._debuggerId; 914 delete this._debuggerId;
915 callback(); 915 callback();
916 } 916 }
917 917
918 /** 918 /**
919 * @param {!WebInspector.Event} event 919 * @param {!Common.Event} event
920 */ 920 */
921 _breakpointResolved(event) { 921 _breakpointResolved(event) {
922 this._addResolvedLocation(/** @type {!WebInspector.DebuggerModel.Location}*/ (event.data)); 922 this._addResolvedLocation(/** @type {!SDK.DebuggerModel.Location}*/ (event.d ata));
923 } 923 }
924 924
925 /** 925 /**
926 * @param {!WebInspector.DebuggerModel.Location} location 926 * @param {!SDK.DebuggerModel.Location} location
927 * @param {!WebInspector.LiveLocation} liveLocation 927 * @param {!Bindings.LiveLocation} liveLocation
928 */ 928 */
929 _locationUpdated(location, liveLocation) { 929 _locationUpdated(location, liveLocation) {
930 var uiLocation = liveLocation.uiLocation(); 930 var uiLocation = liveLocation.uiLocation();
931 if (!uiLocation) 931 if (!uiLocation)
932 return; 932 return;
933 var oldUILocation = this._uiLocations.get(location.id()) || null; 933 var oldUILocation = this._uiLocations.get(location.id()) || null;
934 this._uiLocations.set(location.id(), uiLocation); 934 this._uiLocations.set(location.id(), uiLocation);
935 this._breakpoint._replaceUILocation(oldUILocation, uiLocation); 935 this._breakpoint._replaceUILocation(oldUILocation, uiLocation);
936 } 936 }
937 937
938 /** 938 /**
939 * @param {!WebInspector.DebuggerModel.Location} location 939 * @param {!SDK.DebuggerModel.Location} location
940 * @return {boolean} 940 * @return {boolean}
941 */ 941 */
942 _addResolvedLocation(location) { 942 _addResolvedLocation(location) {
943 var uiLocation = this._debuggerWorkspaceBinding.rawLocationToUILocation(loca tion); 943 var uiLocation = this._debuggerWorkspaceBinding.rawLocationToUILocation(loca tion);
944 var breakpoint = this._breakpoint._breakpointManager.findBreakpoint( 944 var breakpoint = this._breakpoint._breakpointManager.findBreakpoint(
945 uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber) ; 945 uiLocation.uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber) ;
946 if (breakpoint && breakpoint !== this._breakpoint) { 946 if (breakpoint && breakpoint !== this._breakpoint) {
947 // location clash 947 // location clash
948 this._breakpoint.remove(); 948 this._breakpoint.remove();
949 return false; 949 return false;
950 } 950 }
951 this._debuggerWorkspaceBinding.createLiveLocation( 951 this._debuggerWorkspaceBinding.createLiveLocation(
952 location, this._locationUpdated.bind(this, location), this._liveLocation s); 952 location, this._locationUpdated.bind(this, location), this._liveLocation s);
953 return true; 953 return true;
954 } 954 }
955 955
956 _cleanUpAfterDebuggerIsGone() { 956 _cleanUpAfterDebuggerIsGone() {
957 if (this._isUpdating) 957 if (this._isUpdating)
958 this._cancelCallback = true; 958 this._cancelCallback = true;
959 959
960 this._resetLocations(); 960 this._resetLocations();
961 this._currentState = null; 961 this._currentState = null;
962 if (this._debuggerId) 962 if (this._debuggerId)
963 this._didRemoveFromDebugger(function() {}); 963 this._didRemoveFromDebugger(function() {});
964 } 964 }
965 965
966 _removeEventListeners() { 966 _removeEventListeners() {
967 this._debuggerModel.removeEventListener( 967 this._debuggerModel.removeEventListener(
968 WebInspector.DebuggerModel.Events.DebuggerWasDisabled, this._cleanUpAfte rDebuggerIsGone, this); 968 SDK.DebuggerModel.Events.DebuggerWasDisabled, this._cleanUpAfterDebugger IsGone, this);
969 this._debuggerModel.removeEventListener( 969 this._debuggerModel.removeEventListener(
970 WebInspector.DebuggerModel.Events.DebuggerWasEnabled, this._scheduleUpda teInDebugger, this); 970 SDK.DebuggerModel.Events.DebuggerWasEnabled, this._scheduleUpdateInDebug ger, this);
971 } 971 }
972 }; 972 };
973 973
974 /** 974 /**
975 * @unrestricted 975 * @unrestricted
976 */ 976 */
977 WebInspector.BreakpointManager.Breakpoint.State = class { 977 Bindings.BreakpointManager.Breakpoint.State = class {
978 /** 978 /**
979 * @param {?string} url 979 * @param {?string} url
980 * @param {?string} scriptId 980 * @param {?string} scriptId
981 * @param {number} lineNumber 981 * @param {number} lineNumber
982 * @param {number} columnNumber 982 * @param {number} columnNumber
983 * @param {string} condition 983 * @param {string} condition
984 */ 984 */
985 constructor(url, scriptId, lineNumber, columnNumber, condition) { 985 constructor(url, scriptId, lineNumber, columnNumber, condition) {
986 this.url = url; 986 this.url = url;
987 this.scriptId = scriptId; 987 this.scriptId = scriptId;
988 this.lineNumber = lineNumber; 988 this.lineNumber = lineNumber;
989 this.columnNumber = columnNumber; 989 this.columnNumber = columnNumber;
990 this.condition = condition; 990 this.condition = condition;
991 } 991 }
992 992
993 /** 993 /**
994 * @param {?WebInspector.BreakpointManager.Breakpoint.State|undefined} stateA 994 * @param {?Bindings.BreakpointManager.Breakpoint.State|undefined} stateA
995 * @param {?WebInspector.BreakpointManager.Breakpoint.State|undefined} stateB 995 * @param {?Bindings.BreakpointManager.Breakpoint.State|undefined} stateB
996 * @return {boolean} 996 * @return {boolean}
997 */ 997 */
998 static equals(stateA, stateB) { 998 static equals(stateA, stateB) {
999 if (!stateA || !stateB) 999 if (!stateA || !stateB)
1000 return false; 1000 return false;
1001 1001
1002 if (stateA.scriptId || stateB.scriptId) 1002 if (stateA.scriptId || stateB.scriptId)
1003 return false; 1003 return false;
1004 1004
1005 return stateA.url === stateB.url && stateA.lineNumber === stateB.lineNumber && 1005 return stateA.url === stateB.url && stateA.lineNumber === stateB.lineNumber &&
1006 stateA.columnNumber === stateB.columnNumber && stateA.condition === stat eB.condition; 1006 stateA.columnNumber === stateB.columnNumber && stateA.condition === stat eB.condition;
1007 } 1007 }
1008 }; 1008 };
1009 1009
1010 1010
1011 /** 1011 /**
1012 * @unrestricted 1012 * @unrestricted
1013 */ 1013 */
1014 WebInspector.BreakpointManager.Storage = class { 1014 Bindings.BreakpointManager.Storage = class {
1015 /** 1015 /**
1016 * @param {!WebInspector.BreakpointManager} breakpointManager 1016 * @param {!Bindings.BreakpointManager} breakpointManager
1017 * @param {?WebInspector.Setting} setting 1017 * @param {?Common.Setting} setting
1018 */ 1018 */
1019 constructor(breakpointManager, setting) { 1019 constructor(breakpointManager, setting) {
1020 this._breakpointManager = breakpointManager; 1020 this._breakpointManager = breakpointManager;
1021 this._setting = setting || WebInspector.settings.createLocalSetting('breakpo ints', []); 1021 this._setting = setting || Common.settings.createLocalSetting('breakpoints', []);
1022 var breakpoints = this._setting.get(); 1022 var breakpoints = this._setting.get();
1023 /** @type {!Object.<string, !WebInspector.BreakpointManager.Storage.Item>} * / 1023 /** @type {!Object.<string, !Bindings.BreakpointManager.Storage.Item>} */
1024 this._breakpoints = {}; 1024 this._breakpoints = {};
1025 for (var i = 0; i < breakpoints.length; ++i) { 1025 for (var i = 0; i < breakpoints.length; ++i) {
1026 var breakpoint = /** @type {!WebInspector.BreakpointManager.Storage.Item} */ (breakpoints[i]); 1026 var breakpoint = /** @type {!Bindings.BreakpointManager.Storage.Item} */ ( breakpoints[i]);
1027 breakpoint.columnNumber = breakpoint.columnNumber || 0; 1027 breakpoint.columnNumber = breakpoint.columnNumber || 0;
1028 this._breakpoints[breakpoint.sourceFileId + ':' + breakpoint.lineNumber + ':' + breakpoint.columnNumber] = 1028 this._breakpoints[breakpoint.sourceFileId + ':' + breakpoint.lineNumber + ':' + breakpoint.columnNumber] =
1029 breakpoint; 1029 breakpoint;
1030 } 1030 }
1031 } 1031 }
1032 1032
1033 mute() { 1033 mute() {
1034 this._muted = true; 1034 this._muted = true;
1035 } 1035 }
1036 1036
1037 unmute() { 1037 unmute() {
1038 delete this._muted; 1038 delete this._muted;
1039 } 1039 }
1040 1040
1041 /** 1041 /**
1042 * @param {string} sourceFileId 1042 * @param {string} sourceFileId
1043 * @return {!Array.<!WebInspector.BreakpointManager.Storage.Item>} 1043 * @return {!Array.<!Bindings.BreakpointManager.Storage.Item>}
1044 */ 1044 */
1045 breakpointItems(sourceFileId) { 1045 breakpointItems(sourceFileId) {
1046 var result = []; 1046 var result = [];
1047 for (var id in this._breakpoints) { 1047 for (var id in this._breakpoints) {
1048 var breakpoint = this._breakpoints[id]; 1048 var breakpoint = this._breakpoints[id];
1049 if (breakpoint.sourceFileId === sourceFileId) 1049 if (breakpoint.sourceFileId === sourceFileId)
1050 result.push(breakpoint); 1050 result.push(breakpoint);
1051 } 1051 }
1052 return result; 1052 return result;
1053 } 1053 }
1054 1054
1055 /** 1055 /**
1056 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 1056 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
1057 */ 1057 */
1058 _updateBreakpoint(breakpoint) { 1058 _updateBreakpoint(breakpoint) {
1059 if (this._muted || !breakpoint._breakpointStorageId()) 1059 if (this._muted || !breakpoint._breakpointStorageId())
1060 return; 1060 return;
1061 this._breakpoints[breakpoint._breakpointStorageId()] = new WebInspector.Brea kpointManager.Storage.Item(breakpoint); 1061 this._breakpoints[breakpoint._breakpointStorageId()] = new Bindings.Breakpoi ntManager.Storage.Item(breakpoint);
1062 this._save(); 1062 this._save();
1063 } 1063 }
1064 1064
1065 /** 1065 /**
1066 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 1066 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
1067 */ 1067 */
1068 _removeBreakpoint(breakpoint) { 1068 _removeBreakpoint(breakpoint) {
1069 if (this._muted) 1069 if (this._muted)
1070 return; 1070 return;
1071 delete this._breakpoints[breakpoint._breakpointStorageId()]; 1071 delete this._breakpoints[breakpoint._breakpointStorageId()];
1072 this._save(); 1072 this._save();
1073 } 1073 }
1074 1074
1075 _save() { 1075 _save() {
1076 var breakpointsArray = []; 1076 var breakpointsArray = [];
1077 for (var id in this._breakpoints) 1077 for (var id in this._breakpoints)
1078 breakpointsArray.push(this._breakpoints[id]); 1078 breakpointsArray.push(this._breakpoints[id]);
1079 this._setting.set(breakpointsArray); 1079 this._setting.set(breakpointsArray);
1080 } 1080 }
1081 }; 1081 };
1082 1082
1083 /** 1083 /**
1084 * @unrestricted 1084 * @unrestricted
1085 */ 1085 */
1086 WebInspector.BreakpointManager.Storage.Item = class { 1086 Bindings.BreakpointManager.Storage.Item = class {
1087 /** 1087 /**
1088 * @param {!WebInspector.BreakpointManager.Breakpoint} breakpoint 1088 * @param {!Bindings.BreakpointManager.Breakpoint} breakpoint
1089 */ 1089 */
1090 constructor(breakpoint) { 1090 constructor(breakpoint) {
1091 this.sourceFileId = breakpoint._sourceFileId; 1091 this.sourceFileId = breakpoint._sourceFileId;
1092 this.lineNumber = breakpoint.lineNumber(); 1092 this.lineNumber = breakpoint.lineNumber();
1093 this.columnNumber = breakpoint.columnNumber(); 1093 this.columnNumber = breakpoint.columnNumber();
1094 this.condition = breakpoint.condition(); 1094 this.condition = breakpoint.condition();
1095 this.enabled = breakpoint.enabled(); 1095 this.enabled = breakpoint.enabled();
1096 } 1096 }
1097 }; 1097 };
1098 1098
1099 /** @type {!WebInspector.BreakpointManager} */ 1099 /** @type {!Bindings.BreakpointManager} */
1100 WebInspector.breakpointManager; 1100 Bindings.breakpointManager;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698