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 21 matching lines...) Expand all Loading... |
32 * @constructor | 32 * @constructor |
33 * @implements {WebInspector.DebuggerSourceMapping} | 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.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 36 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
37 */ | 37 */ |
38 WebInspector.DefaultScriptMapping = function(debuggerModel, workspace, debuggerW
orkspaceBinding) | 38 WebInspector.DefaultScriptMapping = function(debuggerModel, workspace, debuggerW
orkspaceBinding) |
39 { | 39 { |
40 this._debuggerModel = debuggerModel; | 40 this._debuggerModel = debuggerModel; |
41 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 41 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
42 this._workspace = workspace; | 42 var projectId = WebInspector.DefaultScriptMapping.projectIdForTarget(debugge
rModel.target()); |
43 this._projectId = WebInspector.DefaultScriptMapping.projectIdForTarget(debug
gerModel.target()); | 43 this._project = new WebInspector.ContentProviderBasedProject(workspace, proj
ectId, WebInspector.projectTypes.Debugger, ""); |
44 this._project = new WebInspector.ContentProviderBasedProject(this._workspace
, this._projectId, WebInspector.projectTypes.Debugger, ""); | 44 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ |
45 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._debuggerReset, this); | 45 this._uiSourceCodeForScriptId = new Map(); |
46 this._debuggerReset(); | 46 /** @type {!Map.<!WebInspector.UISourceCode, string>} */ |
| 47 this._scriptIdForUISourceCode = new Map(); |
| 48 this._eventListeners = [ |
| 49 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalO
bjectCleared, this._debuggerReset, this) |
| 50 ]; |
47 } | 51 } |
48 | 52 |
49 WebInspector.DefaultScriptMapping._scriptSymbol = Symbol("symbol"); | 53 WebInspector.DefaultScriptMapping._scriptSymbol = Symbol("symbol"); |
50 | 54 |
51 /** | 55 /** |
52 * @param {!WebInspector.UISourceCode} uiSourceCode | 56 * @param {!WebInspector.UISourceCode} uiSourceCode |
53 * @return {?WebInspector.Script} | 57 * @return {?WebInspector.Script} |
54 */ | 58 */ |
55 WebInspector.DefaultScriptMapping.scriptForUISourceCode = function(uiSourceCode) | 59 WebInspector.DefaultScriptMapping.scriptForUISourceCode = function(uiSourceCode) |
56 { | 60 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 * @param {number} lineNumber | 128 * @param {number} lineNumber |
125 * @return {boolean} | 129 * @return {boolean} |
126 */ | 130 */ |
127 uiLineHasMapping: function(uiSourceCode, lineNumber) | 131 uiLineHasMapping: function(uiSourceCode, lineNumber) |
128 { | 132 { |
129 return true; | 133 return true; |
130 }, | 134 }, |
131 | 135 |
132 _debuggerReset: function() | 136 _debuggerReset: function() |
133 { | 137 { |
134 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ | 138 this._uiSourceCodeForScriptId.clear(); |
135 this._uiSourceCodeForScriptId = new Map(); | 139 this._scriptIdForUISourceCode.clear(); |
136 this._scriptIdForUISourceCode = new Map(); | |
137 this._project.reset(); | 140 this._project.reset(); |
138 }, | 141 }, |
139 | 142 |
140 dispose: function() | 143 dispose: function() |
141 { | 144 { |
| 145 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
| 146 this._debuggerReset(); |
142 this._project.dispose(); | 147 this._project.dispose(); |
143 } | 148 } |
144 } | 149 } |
145 | 150 |
146 /** | 151 /** |
147 * @param {!WebInspector.Target} target | 152 * @param {!WebInspector.Target} target |
148 * @return {string} | 153 * @return {string} |
149 */ | 154 */ |
150 WebInspector.DefaultScriptMapping.projectIdForTarget = function(target) | 155 WebInspector.DefaultScriptMapping.projectIdForTarget = function(target) |
151 { | 156 { |
152 return "debugger:" + target.id(); | 157 return "debugger:" + target.id(); |
153 } | 158 } |
OLD | NEW |