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 12 matching lines...) Expand all Loading... |
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 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @implements {WebInspector.ScriptSourceMapping} | 33 * @implements {WebInspector.DebuggerSourceMapping} |
34 * @param {!WebInspector.DebuggerModel} debuggerModel | 34 * @param {!WebInspector.DebuggerModel} debuggerModel |
35 * @param {!WebInspector.Workspace} workspace | 35 * @param {!WebInspector.Workspace} workspace |
36 * @param {!WebInspector.NetworkWorkspaceBinding} networkWorkspaceBinding | 36 * @param {!WebInspector.NetworkWorkspaceBinding} networkWorkspaceBinding |
37 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 37 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
38 */ | 38 */ |
39 WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkW
orkspaceBinding, debuggerWorkspaceBinding) | 39 WebInspector.CompilerScriptMapping = function(debuggerModel, workspace, networkW
orkspaceBinding, debuggerWorkspaceBinding) |
40 { | 40 { |
41 this._target = debuggerModel.target(); | 41 this._target = debuggerModel.target(); |
42 this._debuggerModel = debuggerModel; | 42 this._debuggerModel = debuggerModel; |
43 this._workspace = workspace; | 43 this._workspace = workspace; |
44 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAddedToWorkspace, this); | 44 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAddedToWorkspace, this); |
45 this._networkWorkspaceBinding = networkWorkspaceBinding; | 45 this._networkWorkspaceBinding = networkWorkspaceBinding; |
46 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 46 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
47 | 47 |
48 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 48 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
49 this._sourceMapForSourceMapURL = {}; | 49 this._sourceMapForSourceMapURL = {}; |
50 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>} */ | 50 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>} */ |
51 this._pendingSourceMapLoadingCallbacks = {}; | 51 this._pendingSourceMapLoadingCallbacks = {}; |
52 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 52 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
53 this._sourceMapForScriptId = {}; | 53 this._sourceMapForScriptId = {}; |
54 /** @type {!Map.<!WebInspector.SourceMap, !WebInspector.Script>} */ | 54 /** @type {!Map.<!WebInspector.SourceMap, !WebInspector.Script>} */ |
55 this._scriptForSourceMap = new Map(); | 55 this._scriptForSourceMap = new Map(); |
56 /** @type {!StringMap.<!WebInspector.SourceMap>} */ | 56 /** @type {!StringMap.<!WebInspector.SourceMap>} */ |
57 this._sourceMapForURL = new StringMap(); | 57 this._sourceMapForURL = new StringMap(); |
58 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._debuggerReset, this); | 58 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._debuggerReset, this); |
59 } | 59 } |
60 | 60 |
61 WebInspector.CompilerScriptMapping.prototype = { | 61 WebInspector.CompilerScriptMapping.prototype = { |
62 /** | 62 /** |
63 * @param {!WebInspector.RawLocation} rawLocation | 63 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
64 * @return {?WebInspector.UILocation} | 64 * @return {?WebInspector.UILocation} |
65 */ | 65 */ |
66 rawLocationToUILocation: function(rawLocation) | 66 rawLocationToUILocation: function(rawLocation) |
67 { | 67 { |
68 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); | 68 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); |
69 var sourceMap = this._sourceMapForScriptId[debuggerModelLocation.scriptI
d]; | 69 var sourceMap = this._sourceMapForScriptId[debuggerModelLocation.scriptI
d]; |
70 if (!sourceMap) | 70 if (!sourceMap) |
71 return null; | 71 return null; |
72 var lineNumber = debuggerModelLocation.lineNumber; | 72 var lineNumber = debuggerModelLocation.lineNumber; |
73 var columnNumber = debuggerModelLocation.columnNumber || 0; | 73 var columnNumber = debuggerModelLocation.columnNumber || 0; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 this._sourceMapForScriptId = {}; | 297 this._sourceMapForScriptId = {}; |
298 this._scriptForSourceMap.clear(); | 298 this._scriptForSourceMap.clear(); |
299 this._sourceMapForURL.clear(); | 299 this._sourceMapForURL.clear(); |
300 }, | 300 }, |
301 | 301 |
302 dispose: function() | 302 dispose: function() |
303 { | 303 { |
304 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); | 304 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); |
305 } | 305 } |
306 } | 306 } |
OLD | NEW |