| 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 22 matching lines...) Expand all Loading... |
| 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.NetworkMapping} networkMapping | 36 * @param {!WebInspector.NetworkMapping} networkMapping |
| 37 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding | 37 * @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
| 38 */ | 38 */ |
| 39 WebInspector.ResourceScriptMapping = function(debuggerModel, workspace, networkM
apping, debuggerWorkspaceBinding) | 39 WebInspector.ResourceScriptMapping = function(debuggerModel, workspace, networkM
apping, 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; | |
| 44 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAdded, this); | |
| 45 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR
emoved, this._uiSourceCodeRemoved, this); | |
| 46 this._networkMapping = networkMapping; | 43 this._networkMapping = networkMapping; |
| 47 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 44 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
| 48 /** @type {!Array.<!WebInspector.UISourceCode>} */ | 45 /** @type {!Array.<!WebInspector.UISourceCode>} */ |
| 49 this._boundUISourceCodes = []; | 46 this._boundUISourceCodes = []; |
| 50 | 47 |
| 51 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.ResourceScriptFil
e>} */ | 48 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.ResourceScriptFil
e>} */ |
| 52 this._uiSourceCodeToScriptFile = new Map(); | 49 this._uiSourceCodeToScriptFile = new Map(); |
| 53 | 50 |
| 54 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._debuggerReset, this); | 51 this._eventListeners = [ |
| 52 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalO
bjectCleared, this._debuggerReset, this), |
| 53 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdd
ed, this._uiSourceCodeAdded, this), |
| 54 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeRem
oved, this._uiSourceCodeRemoved, this) |
| 55 ]; |
| 55 } | 56 } |
| 56 | 57 |
| 57 WebInspector.ResourceScriptMapping.prototype = { | 58 WebInspector.ResourceScriptMapping.prototype = { |
| 58 /** | 59 /** |
| 59 * @override | 60 * @override |
| 60 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 61 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
| 61 * @return {?WebInspector.UILocation} | 62 * @return {?WebInspector.UILocation} |
| 62 */ | 63 */ |
| 63 rawLocationToUILocation: function(rawLocation) | 64 rawLocationToUILocation: function(rawLocation) |
| 64 { | 65 { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 _debuggerReset: function() | 261 _debuggerReset: function() |
| 261 { | 262 { |
| 262 var sourceCodes = this._boundUISourceCodes; | 263 var sourceCodes = this._boundUISourceCodes; |
| 263 this._boundUISourceCodes = []; | 264 this._boundUISourceCodes = []; |
| 264 sourceCodes.forEach(this._unbindUISourceCode.bind(this)); | 265 sourceCodes.forEach(this._unbindUISourceCode.bind(this)); |
| 265 console.assert(!this._uiSourceCodeToScriptFile.size); | 266 console.assert(!this._uiSourceCodeToScriptFile.size); |
| 266 }, | 267 }, |
| 267 | 268 |
| 268 dispose: function() | 269 dispose: function() |
| 269 { | 270 { |
| 271 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
| 270 this._debuggerReset(); | 272 this._debuggerReset(); |
| 271 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAdded, this); | |
| 272 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeRemoved, this._uiSourceCodeRemoved, this); | |
| 273 } | 273 } |
| 274 | |
| 275 } | 274 } |
| 276 | 275 |
| 277 /** | 276 /** |
| 278 * @constructor | 277 * @constructor |
| 279 * @extends {WebInspector.Object} | 278 * @extends {WebInspector.Object} |
| 280 * @param {!WebInspector.ResourceScriptMapping} resourceScriptMapping | 279 * @param {!WebInspector.ResourceScriptMapping} resourceScriptMapping |
| 281 * @param {!WebInspector.UISourceCode} uiSourceCode | 280 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 282 * @param {!Array.<!WebInspector.Script>} scripts | 281 * @param {!Array.<!WebInspector.Script>} scripts |
| 283 */ | 282 */ |
| 284 WebInspector.ResourceScriptFile = function(resourceScriptMapping, uiSourceCode,
scripts) | 283 WebInspector.ResourceScriptFile = function(resourceScriptMapping, uiSourceCode,
scripts) |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 /** | 481 /** |
| 483 * @return {boolean} | 482 * @return {boolean} |
| 484 */ | 483 */ |
| 485 hasSourceMapURL: function() | 484 hasSourceMapURL: function() |
| 486 { | 485 { |
| 487 return this._script && !!this._script.sourceMapURL; | 486 return this._script && !!this._script.sourceMapURL; |
| 488 }, | 487 }, |
| 489 | 488 |
| 490 __proto__: WebInspector.Object.prototype | 489 __proto__: WebInspector.Object.prototype |
| 491 } | 490 } |
| OLD | NEW |