| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 return null; | 101 return null; |
| 102 var debuggerModel = location.debuggerModel; | 102 var debuggerModel = location.debuggerModel; |
| 103 this._ensureInfoForScript(script); | 103 this._ensureInfoForScript(script); |
| 104 var liveLocation = this.createLiveLocation(location, updateDelegate, locatio
nPool); | 104 var liveLocation = this.createLiveLocation(location, updateDelegate, locatio
nPool); |
| 105 this._registerCallFrameLiveLocation(debuggerModel, liveLocation); | 105 this._registerCallFrameLiveLocation(debuggerModel, liveLocation); |
| 106 return liveLocation; | 106 return liveLocation; |
| 107 } | 107 } |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * @param {!SDK.DebuggerModel.Location} rawLocation | 110 * @param {!SDK.DebuggerModel.Location} rawLocation |
| 111 * @return {!Workspace.UILocation} | 111 * @return {?Workspace.UILocation} |
| 112 */ | 112 */ |
| 113 rawLocationToUILocation(rawLocation) { | 113 rawLocationToUILocation(rawLocation) { |
| 114 for (var i = 0; i < this._sourceMappings.length; ++i) { | 114 for (var i = 0; i < this._sourceMappings.length; ++i) { |
| 115 var uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLocati
on); | 115 var uiLocation = this._sourceMappings[i].rawLocationToUILocation(rawLocati
on); |
| 116 if (uiLocation) | 116 if (uiLocation) |
| 117 return uiLocation; | 117 return uiLocation; |
| 118 } | 118 } |
| 119 var modelData = this._debuggerModelToData.get(rawLocation.debuggerModel); | 119 var modelData = this._debuggerModelToData.get(rawLocation.debuggerModel); |
| 120 return modelData._rawLocationToUILocation(rawLocation); | 120 return modelData._rawLocationToUILocation(rawLocation); |
| 121 } | 121 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * @param {!Workspace.UILocation} uiLocation | 157 * @param {!Workspace.UILocation} uiLocation |
| 158 * @return {!Workspace.UILocation} | 158 * @return {!Workspace.UILocation} |
| 159 */ | 159 */ |
| 160 normalizeUILocation(uiLocation) { | 160 normalizeUILocation(uiLocation) { |
| 161 var rawLocation = | 161 var rawLocation = |
| 162 this.uiLocationToRawLocation(uiLocation.uiSourceCode, uiLocation.lineNum
ber, uiLocation.columnNumber); | 162 this.uiLocationToRawLocation(uiLocation.uiSourceCode, uiLocation.lineNum
ber, uiLocation.columnNumber); |
| 163 if (rawLocation) | 163 if (rawLocation) |
| 164 return this.rawLocationToUILocation(rawLocation); | 164 return this.rawLocationToUILocation(rawLocation) || uiLocation; |
| 165 return uiLocation; | 165 return uiLocation; |
| 166 } | 166 } |
| 167 | 167 |
| 168 /** | 168 /** |
| 169 * @param {!Workspace.UISourceCode} uiSourceCode | 169 * @param {!Workspace.UISourceCode} uiSourceCode |
| 170 * @param {!SDK.DebuggerModel} debuggerModel | 170 * @param {!SDK.DebuggerModel} debuggerModel |
| 171 * @return {?Bindings.ResourceScriptFile} | 171 * @return {?Bindings.ResourceScriptFile} |
| 172 */ | 172 */ |
| 173 scriptFile(uiSourceCode, debuggerModel) { | 173 scriptFile(uiSourceCode, debuggerModel) { |
| 174 var modelData = this._debuggerModelToData.get(debuggerModel); | 174 var modelData = this._debuggerModelToData.get(debuggerModel); |
| (...skipping 116 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} | 301 * @return {?Workspace.UILocation} |
| 302 */ | 302 */ |
| 303 _rawLocationToUILocation(rawLocation) { | 303 _rawLocationToUILocation(rawLocation) { |
| 304 var uiLocation = null; | 304 var uiLocation = null; |
| 305 uiLocation = uiLocation || this._compilerMapping.rawLocationToUILocation(raw
Location); | 305 uiLocation = uiLocation || this._compilerMapping.rawLocationToUILocation(raw
Location); |
| 306 uiLocation = uiLocation || this._resourceMapping.rawLocationToUILocation(raw
Location); | 306 uiLocation = uiLocation || this._resourceMapping.rawLocationToUILocation(raw
Location); |
| 307 uiLocation = uiLocation || this._defaultMapping.rawLocationToUILocation(rawL
ocation); | 307 uiLocation = uiLocation || this._defaultMapping.rawLocationToUILocation(rawL
ocation); |
| 308 // DefaultMapping ensures uiLocation for every rawLocation. | |
| 309 console.assert(uiLocation); | |
| 310 return /** @type {!Workspace.UILocation} */ (uiLocation); | 308 return /** @type {!Workspace.UILocation} */ (uiLocation); |
| 311 } | 309 } |
| 312 | 310 |
| 313 /** | 311 /** |
| 314 * @param {!Workspace.UISourceCode} uiSourceCode | 312 * @param {!Workspace.UISourceCode} uiSourceCode |
| 315 * @param {number} lineNumber | 313 * @param {number} lineNumber |
| 316 * @param {number} columnNumber | 314 * @param {number} columnNumber |
| 317 * @return {?SDK.DebuggerModel.Location} | 315 * @return {?SDK.DebuggerModel.Location} |
| 318 */ | 316 */ |
| 319 _uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { | 317 _uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 */ | 410 */ |
| 413 constructor(script, rawLocation, binding, updateDelegate, locationPool) { | 411 constructor(script, rawLocation, binding, updateDelegate, locationPool) { |
| 414 super(updateDelegate, locationPool); | 412 super(updateDelegate, locationPool); |
| 415 this._script = script; | 413 this._script = script; |
| 416 this._rawLocation = rawLocation; | 414 this._rawLocation = rawLocation; |
| 417 this._binding = binding; | 415 this._binding = binding; |
| 418 } | 416 } |
| 419 | 417 |
| 420 /** | 418 /** |
| 421 * @override | 419 * @override |
| 422 * @return {!Workspace.UILocation} | 420 * @return {?Workspace.UILocation} |
| 423 */ | 421 */ |
| 424 uiLocation() { | 422 uiLocation() { |
| 425 var debuggerModelLocation = this._rawLocation; | 423 var debuggerModelLocation = this._rawLocation; |
| 426 return this._binding.rawLocationToUILocation(debuggerModelLocation); | 424 return this._binding.rawLocationToUILocation(debuggerModelLocation); |
| 427 } | 425 } |
| 428 | 426 |
| 429 /** | 427 /** |
| 430 * @override | 428 * @override |
| 431 */ | 429 */ |
| 432 dispose() { | 430 dispose() { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 459 this._updateScheduled = true; | 457 this._updateScheduled = true; |
| 460 /** @type {!Set<!Bindings.LiveLocation>} */ | 458 /** @type {!Set<!Bindings.LiveLocation>} */ |
| 461 this._locations = new Set(); | 459 this._locations = new Set(); |
| 462 for (var location of rawLocations) | 460 for (var location of rawLocations) |
| 463 this._locations.add(binding.createLiveLocation(location, this._scheduleUpd
ate.bind(this), locationPool)); | 461 this._locations.add(binding.createLiveLocation(location, this._scheduleUpd
ate.bind(this), locationPool)); |
| 464 this._updateLocation(); | 462 this._updateLocation(); |
| 465 } | 463 } |
| 466 | 464 |
| 467 /** | 465 /** |
| 468 * @override | 466 * @override |
| 469 * @return {!Workspace.UILocation} | 467 * @return {?Workspace.UILocation} |
| 470 */ | 468 */ |
| 471 uiLocation() { | 469 uiLocation() { |
| 472 return this._current.uiLocation(); | 470 return this._current.uiLocation(); |
| 473 } | 471 } |
| 474 | 472 |
| 475 /** | 473 /** |
| 476 * @override | 474 * @override |
| 477 * @return {boolean} | 475 * @return {boolean} |
| 478 */ | 476 */ |
| 479 isBlackboxed() { | 477 isBlackboxed() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 * @param {number} columnNumber | 525 * @param {number} columnNumber |
| 528 * @return {?SDK.DebuggerModel.Location} | 526 * @return {?SDK.DebuggerModel.Location} |
| 529 */ | 527 */ |
| 530 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {}, | 528 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) {}, |
| 531 }; | 529 }; |
| 532 | 530 |
| 533 /** | 531 /** |
| 534 * @type {!Bindings.DebuggerWorkspaceBinding} | 532 * @type {!Bindings.DebuggerWorkspaceBinding} |
| 535 */ | 533 */ |
| 536 Bindings.debuggerWorkspaceBinding; | 534 Bindings.debuggerWorkspaceBinding; |
| OLD | NEW |