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 15 matching lines...) Expand all Loading... |
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.ScriptSourceMapping} |
34 * @param {!WebInspector.DebuggerModel} debuggerModel | 34 * @param {!WebInspector.DebuggerModel} debuggerModel |
35 * @param {!WebInspector.Workspace} workspace | 35 * @param {!WebInspector.Workspace} workspace |
| 36 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
36 */ | 37 */ |
37 WebInspector.ResourceScriptMapping = function(debuggerModel, workspace) | 38 WebInspector.ResourceScriptMapping = function(debuggerModel, workspace, debugger
WorkspaceBinding) |
38 { | 39 { |
39 this._target = debuggerModel.target(); | 40 this._target = debuggerModel.target(); |
40 this._debuggerModel = debuggerModel; | 41 this._debuggerModel = debuggerModel; |
41 this._workspace = workspace; | 42 this._workspace = workspace; |
42 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAddedToWorkspace, this); | 43 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAddedToWorkspace, this); |
| 44 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
43 this._boundURLs = new StringSet(); | 45 this._boundURLs = new StringSet(); |
44 | 46 |
45 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._debuggerReset, this); | 47 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._debuggerReset, this); |
46 } | 48 } |
47 | 49 |
48 WebInspector.ResourceScriptMapping.prototype = { | 50 WebInspector.ResourceScriptMapping.prototype = { |
49 /** | 51 /** |
50 * @param {!WebInspector.RawLocation} rawLocation | 52 * @param {!WebInspector.RawLocation} rawLocation |
51 * @return {?WebInspector.UILocation} | 53 * @return {?WebInspector.UILocation} |
52 */ | 54 */ |
(...skipping 23 matching lines...) Expand all Loading... |
76 return this._debuggerModel.createRawLocation(scripts[0], lineNumber, col
umnNumber); | 78 return this._debuggerModel.createRawLocation(scripts[0], lineNumber, col
umnNumber); |
77 }, | 79 }, |
78 | 80 |
79 /** | 81 /** |
80 * @param {!WebInspector.Script} script | 82 * @param {!WebInspector.Script} script |
81 */ | 83 */ |
82 addScript: function(script) | 84 addScript: function(script) |
83 { | 85 { |
84 if (script.isAnonymousScript()) | 86 if (script.isAnonymousScript()) |
85 return; | 87 return; |
86 script.pushSourceMapping(this); | 88 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); |
87 | 89 |
88 var uiSourceCode = this._workspaceUISourceCodeForScript(script); | 90 var uiSourceCode = this._workspaceUISourceCodeForScript(script); |
89 if (!uiSourceCode) | 91 if (!uiSourceCode) |
90 return; | 92 return; |
91 | 93 |
92 this._bindUISourceCodeToScripts(uiSourceCode, [script]); | 94 this._bindUISourceCodeToScripts(uiSourceCode, [script]); |
93 }, | 95 }, |
94 | 96 |
95 /** | 97 /** |
96 * @return {boolean} | 98 * @return {boolean} |
(...skipping 30 matching lines...) Expand all Loading... |
127 | 129 |
128 /** | 130 /** |
129 * @param {!WebInspector.UISourceCode} uiSourceCode | 131 * @param {!WebInspector.UISourceCode} uiSourceCode |
130 */ | 132 */ |
131 _hasMergedToVM: function(uiSourceCode) | 133 _hasMergedToVM: function(uiSourceCode) |
132 { | 134 { |
133 var scripts = this._scriptsForUISourceCode(uiSourceCode); | 135 var scripts = this._scriptsForUISourceCode(uiSourceCode); |
134 if (!scripts.length) | 136 if (!scripts.length) |
135 return; | 137 return; |
136 for (var i = 0; i < scripts.length; ++i) | 138 for (var i = 0; i < scripts.length; ++i) |
137 scripts[i].updateLocations(); | 139 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); |
138 }, | 140 }, |
139 | 141 |
140 /** | 142 /** |
141 * @param {!WebInspector.UISourceCode} uiSourceCode | 143 * @param {!WebInspector.UISourceCode} uiSourceCode |
142 */ | 144 */ |
143 _hasDivergedFromVM: function(uiSourceCode) | 145 _hasDivergedFromVM: function(uiSourceCode) |
144 { | 146 { |
145 var scripts = this._scriptsForUISourceCode(uiSourceCode); | 147 var scripts = this._scriptsForUISourceCode(uiSourceCode); |
146 if (!scripts.length) | 148 if (!scripts.length) |
147 return; | 149 return; |
148 for (var i = 0; i < scripts.length; ++i) | 150 for (var i = 0; i < scripts.length; ++i) |
149 scripts[i].updateLocations(); | 151 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); |
150 }, | 152 }, |
151 | 153 |
152 /** | 154 /** |
153 * @param {!WebInspector.Script} script | 155 * @param {!WebInspector.Script} script |
154 * @return {?WebInspector.UISourceCode} | 156 * @return {?WebInspector.UISourceCode} |
155 */ | 157 */ |
156 _workspaceUISourceCodeForScript: function(script) | 158 _workspaceUISourceCodeForScript: function(script) |
157 { | 159 { |
158 if (script.isAnonymousScript()) | 160 if (script.isAnonymousScript()) |
159 return null; | 161 return null; |
(...skipping 14 matching lines...) Expand all Loading... |
174 /** | 176 /** |
175 * @param {!WebInspector.UISourceCode} uiSourceCode | 177 * @param {!WebInspector.UISourceCode} uiSourceCode |
176 * @param {!Array.<!WebInspector.Script>} scripts | 178 * @param {!Array.<!WebInspector.Script>} scripts |
177 */ | 179 */ |
178 _bindUISourceCodeToScripts: function(uiSourceCode, scripts) | 180 _bindUISourceCodeToScripts: function(uiSourceCode, scripts) |
179 { | 181 { |
180 console.assert(scripts.length); | 182 console.assert(scripts.length); |
181 var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode,
scripts); | 183 var scriptFile = new WebInspector.ResourceScriptFile(this, uiSourceCode,
scripts); |
182 uiSourceCode.setScriptFileForTarget(this._target, scriptFile); | 184 uiSourceCode.setScriptFileForTarget(this._target, scriptFile); |
183 for (var i = 0; i < scripts.length; ++i) | 185 for (var i = 0; i < scripts.length; ++i) |
184 scripts[i].updateLocations(); | 186 this._debuggerWorkspaceBinding.updateLocations(scripts[i]); |
185 uiSourceCode.setSourceMappingForTarget(this._target, this); | 187 uiSourceCode.setSourceMappingForTarget(this._target, this); |
186 this._boundURLs.add(uiSourceCode.url); | 188 this._boundURLs.add(uiSourceCode.url); |
187 }, | 189 }, |
188 | 190 |
189 /** | 191 /** |
190 * @param {!WebInspector.UISourceCode} uiSourceCode | 192 * @param {!WebInspector.UISourceCode} uiSourceCode |
191 */ | 193 */ |
192 _unbindUISourceCode: function(uiSourceCode) | 194 _unbindUISourceCode: function(uiSourceCode) |
193 { | 195 { |
194 var scriptFile = /** @type {!WebInspector.ResourceScriptFile} */ (uiSour
ceCode.scriptFileForTarget(this._target)); | 196 var scriptFile = /** @type {!WebInspector.ResourceScriptFile} */ (uiSour
ceCode.scriptFileForTarget(this._target)); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 */ | 388 */ |
387 addSourceMapURL: function(sourceMapURL) | 389 addSourceMapURL: function(sourceMapURL) |
388 { | 390 { |
389 if (!this._script) | 391 if (!this._script) |
390 return; | 392 return; |
391 this._script.addSourceMapURL(sourceMapURL); | 393 this._script.addSourceMapURL(sourceMapURL); |
392 }, | 394 }, |
393 | 395 |
394 __proto__: WebInspector.Object.prototype | 396 __proto__: WebInspector.Object.prototype |
395 } | 397 } |
OLD | NEW |