| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 * @override | 122 * @override |
| 123 * @param {!WebInspector.UISourceCode} uiSourceCode | 123 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 124 * @param {number} lineNumber | 124 * @param {number} lineNumber |
| 125 * @param {number} columnNumber | 125 * @param {number} columnNumber |
| 126 * @return {?WebInspector.DebuggerModel.Location} | 126 * @return {?WebInspector.DebuggerModel.Location} |
| 127 */ | 127 */ |
| 128 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) | 128 uiLocationToRawLocation: function(uiSourceCode, lineNumber, columnNumber) |
| 129 { | 129 { |
| 130 if (uiSourceCode.project().type() === WebInspector.projectTypes.Service) | 130 if (uiSourceCode.project().type() === WebInspector.projectTypes.Service) |
| 131 return null; | 131 return null; |
| 132 var networkURL = this._networkMapping.networkURL(uiSourceCode); | 132 var sourceMap = this._sourceMapForURL.get(uiSourceCode.url()); |
| 133 if (!networkURL) | |
| 134 return null; | |
| 135 var sourceMap = this._sourceMapForURL.get(networkURL); | |
| 136 if (!sourceMap) | 133 if (!sourceMap) |
| 137 return null; | 134 return null; |
| 138 var script = /** @type {!WebInspector.Script} */ (this._scriptForSourceM
ap.get(sourceMap)); | 135 var script = /** @type {!WebInspector.Script} */ (this._scriptForSourceM
ap.get(sourceMap)); |
| 139 console.assert(script); | 136 console.assert(script); |
| 140 var entry = sourceMap.firstSourceLineMapping(networkURL, lineNumber); | 137 var entry = sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNum
ber); |
| 141 if (!entry) | 138 if (!entry) |
| 142 return null; | 139 return null; |
| 143 return this._debuggerModel.createRawLocation(script, entry.lineNumber, e
ntry.columnNumber); | 140 return this._debuggerModel.createRawLocation(script, entry.lineNumber, e
ntry.columnNumber); |
| 144 }, | 141 }, |
| 145 | 142 |
| 146 /** | 143 /** |
| 147 * @param {!WebInspector.Script} script | 144 * @param {!WebInspector.Script} script |
| 148 */ | 145 */ |
| 149 addScript: function(script) | 146 addScript: function(script) |
| 150 { | 147 { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 }, | 270 }, |
| 274 | 271 |
| 275 /** | 272 /** |
| 276 * @override | 273 * @override |
| 277 * @param {!WebInspector.UISourceCode} uiSourceCode | 274 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 278 * @param {number} lineNumber | 275 * @param {number} lineNumber |
| 279 * @return {boolean} | 276 * @return {boolean} |
| 280 */ | 277 */ |
| 281 uiLineHasMapping: function(uiSourceCode, lineNumber) | 278 uiLineHasMapping: function(uiSourceCode, lineNumber) |
| 282 { | 279 { |
| 283 var networkURL = this._networkMapping.networkURL(uiSourceCode); | 280 var sourceMap = this._sourceMapForURL.get(uiSourceCode.url()); |
| 284 if (!networkURL) | |
| 285 return true; | |
| 286 var sourceMap = this._sourceMapForURL.get(networkURL); | |
| 287 if (!sourceMap) | 281 if (!sourceMap) |
| 288 return true; | 282 return true; |
| 289 return !!sourceMap.firstSourceLineMapping(networkURL, lineNumber); | 283 return !!sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber
); |
| 290 }, | 284 }, |
| 291 | 285 |
| 292 /** | 286 /** |
| 293 * @param {!WebInspector.UISourceCode} uiSourceCode | 287 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 294 */ | 288 */ |
| 295 _bindUISourceCode: function(uiSourceCode) | 289 _bindUISourceCode: function(uiSourceCode) |
| 296 { | 290 { |
| 297 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, this); | 291 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, this); |
| 298 }, | 292 }, |
| 299 | 293 |
| 300 /** | 294 /** |
| 301 * @param {!WebInspector.UISourceCode} uiSourceCode | 295 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 302 */ | 296 */ |
| 303 _unbindUISourceCode: function(uiSourceCode) | 297 _unbindUISourceCode: function(uiSourceCode) |
| 304 { | 298 { |
| 305 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, null); | 299 this._debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCo
de, null); |
| 306 }, | 300 }, |
| 307 | 301 |
| 308 /** | 302 /** |
| 309 * @param {!WebInspector.Event} event | 303 * @param {!WebInspector.Event} event |
| 310 */ | 304 */ |
| 311 _uiSourceCodeAddedToWorkspace: function(event) | 305 _uiSourceCodeAddedToWorkspace: function(event) |
| 312 { | 306 { |
| 313 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); | 307 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); |
| 314 var networkURL = this._networkMapping.networkURL(uiSourceCode); | 308 if (!this._sourceMapForURL.get(uiSourceCode.url())) |
| 315 if (!networkURL || !this._sourceMapForURL.get(networkURL)) | |
| 316 return; | 309 return; |
| 317 this._bindUISourceCode(uiSourceCode); | 310 this._bindUISourceCode(uiSourceCode); |
| 318 }, | 311 }, |
| 319 | 312 |
| 320 /** | 313 /** |
| 321 * @param {!WebInspector.Script} script | 314 * @param {!WebInspector.Script} script |
| 322 * @return {!Promise<?WebInspector.TextSourceMap>} | 315 * @return {!Promise<?WebInspector.TextSourceMap>} |
| 323 */ | 316 */ |
| 324 _loadSourceMapForScript: function(script) | 317 _loadSourceMapForScript: function(script) |
| 325 { | 318 { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 } | 388 } |
| 396 | 389 |
| 397 /** | 390 /** |
| 398 * @param {!WebInspector.Target} target | 391 * @param {!WebInspector.Target} target |
| 399 * @return {string} | 392 * @return {string} |
| 400 */ | 393 */ |
| 401 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) | 394 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) |
| 402 { | 395 { |
| 403 return "compiler-script-project:" + target.id(); | 396 return "compiler-script-project:" + target.id(); |
| 404 } | 397 } |
| OLD | NEW |