OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @implements {SDK.SDKModelObserver<!SDK.DebuggerModel>} | 6 * @implements {SDK.SDKModelObserver<!SDK.DebuggerModel>} |
7 */ | 7 */ |
8 Bindings.DebuggerWorkspaceBinding = class { | 8 Bindings.DebuggerWorkspaceBinding = class { |
9 /** | 9 /** |
10 * @param {!SDK.TargetManager} targetManager | 10 * @param {!SDK.TargetManager} targetManager |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource , this._parsedScriptSource, this), | 291 debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource , this._parsedScriptSource, this), |
292 debuggerModel.addEventListener( | 292 debuggerModel.addEventListener( |
293 SDK.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScript Source, this), | 293 SDK.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScript Source, this), |
294 debuggerModel.addEventListener( | 294 debuggerModel.addEventListener( |
295 SDK.DebuggerModel.Events.DiscardedAnonymousScriptSource, this._discard edScriptSource, this) | 295 SDK.DebuggerModel.Events.DiscardedAnonymousScriptSource, this._discard edScriptSource, this) |
296 ]; | 296 ]; |
297 } | 297 } |
298 | 298 |
299 /** | 299 /** |
300 * @param {!SDK.DebuggerModel.Location} rawLocation | 300 * @param {!SDK.DebuggerModel.Location} rawLocation |
301 * @return {?Workspace.UILocation} | |
302 */ | |
303 _htmlUILocation(rawLocation) { | |
304 var script = rawLocation.script(); | |
305 if (!script) | |
306 return null; | |
307 var uiSourceCode = | |
308 Bindings.resourceBindingManager.uiSourceCodeForURL(script.debuggerModel. target(), script.sourceURL); | |
309 return uiSourceCode ? uiSourceCode.uiLocation(rawLocation.lineNumber, rawLoc ation.columnNumber) : null; | |
310 } | |
311 | |
312 /** | |
313 * @param {!Workspace.UISourceCode} uiSourceCode | |
314 * @param {number} lineNumber | |
315 * @param {number} columnNumber | |
316 * @return {?SDK.DebuggerModel.Location} | |
317 */ | |
318 _htmlRawLocation(uiSourceCode, lineNumber, columnNumber) { | |
319 if (!Bindings.resourceBindingManager.ownsUISourceCode(this._debuggerModel.ta rget(), uiSourceCode)) | |
dgozman
2017/06/12 18:48:50
uiLocationToJSLocation
lushnikov
2017/06/12 22:05:56
Turns out this is not needed - simply calling this
| |
320 return null; | |
321 return this._debuggerModel.createRawLocationByURL(uiSourceCode.url(), lineNu mber, columnNumber); | |
322 } | |
323 | |
324 /** | |
325 * @param {!SDK.DebuggerModel.Location} rawLocation | |
301 * @return {!Workspace.UILocation} | 326 * @return {!Workspace.UILocation} |
302 */ | 327 */ |
303 _rawLocationToUILocation(rawLocation) { | 328 _rawLocationToUILocation(rawLocation) { |
304 var uiLocation = null; | 329 var uiLocation = null; |
305 uiLocation = uiLocation || this._compilerMapping.rawLocationToUILocation(raw Location); | 330 uiLocation = uiLocation || this._compilerMapping.rawLocationToUILocation(raw Location); |
306 uiLocation = uiLocation || this._resourceMapping.rawLocationToUILocation(raw Location); | 331 uiLocation = uiLocation || this._resourceMapping.rawLocationToUILocation(raw Location); |
332 uiLocation = uiLocation || this._htmlUILocation(rawLocation); | |
307 uiLocation = uiLocation || this._defaultMapping.rawLocationToUILocation(rawL ocation); | 333 uiLocation = uiLocation || this._defaultMapping.rawLocationToUILocation(rawL ocation); |
308 // DefaultMapping ensures uiLocation for every rawLocation. | 334 // DefaultMapping ensures uiLocation for every rawLocation. |
309 console.assert(uiLocation); | 335 console.assert(uiLocation); |
310 return /** @type {!Workspace.UILocation} */ (uiLocation); | 336 return /** @type {!Workspace.UILocation} */ (uiLocation); |
311 } | 337 } |
312 | 338 |
313 /** | 339 /** |
314 * @param {!Workspace.UISourceCode} uiSourceCode | 340 * @param {!Workspace.UISourceCode} uiSourceCode |
315 * @param {number} lineNumber | 341 * @param {number} lineNumber |
316 * @param {number} columnNumber | 342 * @param {number} columnNumber |
317 * @return {?SDK.DebuggerModel.Location} | 343 * @return {?SDK.DebuggerModel.Location} |
318 */ | 344 */ |
319 _uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { | 345 _uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { |
320 var rawLocation = null; | 346 var rawLocation = null; |
321 rawLocation = rawLocation || this._compilerMapping.uiLocationToRawLocation(u iSourceCode, lineNumber, columnNumber); | 347 rawLocation = rawLocation || this._compilerMapping.uiLocationToRawLocation(u iSourceCode, lineNumber, columnNumber); |
322 rawLocation = rawLocation || this._resourceMapping.uiLocationToRawLocation(u iSourceCode, lineNumber, columnNumber); | 348 rawLocation = rawLocation || this._resourceMapping.uiLocationToRawLocation(u iSourceCode, lineNumber, columnNumber); |
349 rawLocation = rawLocation || this._htmlRawLocation(uiSourceCode, lineNumber, columnNumber); | |
323 rawLocation = rawLocation || this._defaultMapping.uiLocationToRawLocation(ui SourceCode, lineNumber, columnNumber); | 350 rawLocation = rawLocation || this._defaultMapping.uiLocationToRawLocation(ui SourceCode, lineNumber, columnNumber); |
324 return rawLocation; | 351 return rawLocation; |
325 } | 352 } |
326 | 353 |
327 /** | 354 /** |
328 * @param {!SDK.DebuggerPausedDetails} debuggerPausedDetails | 355 * @param {!SDK.DebuggerPausedDetails} debuggerPausedDetails |
329 * @return {boolean} | 356 * @return {boolean} |
330 */ | 357 */ |
331 _beforePaused(debuggerPausedDetails) { | 358 _beforePaused(debuggerPausedDetails) { |
332 return !!this._compilerMapping.mapsToSourceCode(debuggerPausedDetails.callFr ames[0].location()); | 359 return !!this._compilerMapping.mapsToSourceCode(debuggerPausedDetails.callFr ames[0].location()); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
527 * @param {number} columnNumber | 554 * @param {number} columnNumber |
528 * @return {?SDK.DebuggerModel.Location} | 555 * @return {?SDK.DebuggerModel.Location} |
529 */ | 556 */ |
530 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {}, | 557 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {}, |
531 }; | 558 }; |
532 | 559 |
533 /** | 560 /** |
534 * @type {!Bindings.DebuggerWorkspaceBinding} | 561 * @type {!Bindings.DebuggerWorkspaceBinding} |
535 */ | 562 */ |
536 Bindings.debuggerWorkspaceBinding; | 563 Bindings.debuggerWorkspaceBinding; |
OLD | NEW |