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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @implements {WebInspector.SourceMapping} | 7 * @implements {WebInspector.SourceMapping} |
8 * @param {!WebInspector.Workspace} workspace | 8 * @param {!WebInspector.Workspace} workspace |
9 * @param {!WebInspector.DebuggerModel} debuggerModel | 9 * @param {!WebInspector.DebuggerModel} debuggerModel |
10 */ | 10 */ |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 WebInspector.FormatterScriptMapping.prototype = { | 24 WebInspector.FormatterScriptMapping.prototype = { |
25 /** | 25 /** |
26 * @param {!WebInspector.RawLocation} rawLocation | 26 * @param {!WebInspector.RawLocation} rawLocation |
27 * @return {?WebInspector.UILocation} | 27 * @return {?WebInspector.UILocation} |
28 */ | 28 */ |
29 rawLocationToUILocation: function(rawLocation) | 29 rawLocationToUILocation: function(rawLocation) |
30 { | 30 { |
31 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); | 31 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); |
32 var script = this._debuggerModel.scriptForId(debuggerModelLocation.scrip
tId); | 32 var script = debuggerModelLocation.script(); |
33 var uiSourceCode = this._uiSourceCodes.get(script); | 33 var uiSourceCode = this._uiSourceCodes.get(script); |
34 if (!uiSourceCode) | 34 if (!uiSourceCode) |
35 return null; | 35 return null; |
36 | 36 |
37 var formatData = this._formatData.get(uiSourceCode); | 37 var formatData = this._formatData.get(uiSourceCode); |
38 if (!formatData) | 38 if (!formatData) |
39 return null; | 39 return null; |
40 var mapping = formatData.mapping; | 40 var mapping = formatData.mapping; |
41 var lineNumber = debuggerModelLocation.lineNumber; | 41 var lineNumber = debuggerModelLocation.lineNumber; |
42 var columnNumber = debuggerModelLocation.columnNumber || 0; | 42 var columnNumber = debuggerModelLocation.columnNumber || 0; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 * @return {boolean} | 78 * @return {boolean} |
79 */ | 79 */ |
80 function isInlineScript(script) | 80 function isInlineScript(script) |
81 { | 81 { |
82 return script.isInlineScript(); | 82 return script.isInlineScript(); |
83 } | 83 } |
84 | 84 |
85 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) | 85 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document) |
86 return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url).fil
ter(isInlineScript); | 86 return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url).fil
ter(isInlineScript); |
87 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) { | 87 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) { |
88 var rawLocation = uiSourceCode.uiLocationToRawLocation(0, 0); | 88 var rawLocation = /** @type {!WebInspector.DebuggerModel.Location} *
/ (uiSourceCode.uiLocationToRawLocation(0, 0)); |
89 return rawLocation ? [this._debuggerModel.scriptForId(rawLocation.sc
riptId)] : []; | 89 return rawLocation ? [rawLocation.script()] : []; |
90 } | 90 } |
91 return []; | 91 return []; |
92 }, | 92 }, |
93 | 93 |
94 _init: function() | 94 _init: function() |
95 { | 95 { |
96 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ | 96 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ |
97 this._uiSourceCodes = new Map(); | 97 this._uiSourceCodes = new Map(); |
98 /** @type {!StringMap.<string>} */ | 98 /** @type {!StringMap.<string>} */ |
99 this._formattedPaths = new StringMap(); | 99 this._formattedPaths = new StringMap(); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 }, | 377 }, |
378 | 378 |
379 /** | 379 /** |
380 * @param {!WebInspector.UISourceCode} uiSourceCode | 380 * @param {!WebInspector.UISourceCode} uiSourceCode |
381 */ | 381 */ |
382 _discardFormattedUISourceCodeScript: function(uiSourceCode) | 382 _discardFormattedUISourceCodeScript: function(uiSourceCode) |
383 { | 383 { |
384 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode); | 384 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode); |
385 } | 385 } |
386 } | 386 } |
OLD | NEW |