| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 this._target = debuggerModel.target(); | 42 this._target = debuggerModel.target(); |
| 43 this._debuggerModel = debuggerModel; | 43 this._debuggerModel = debuggerModel; |
| 44 this._workspace = workspace; | 44 this._workspace = workspace; |
| 45 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAddedToWorkspace, this); | 45 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAddedToWorkspace, this); |
| 46 this._networkMapping = networkMapping; | 46 this._networkMapping = networkMapping; |
| 47 this._networkProject = networkProject; | 47 this._networkProject = networkProject; |
| 48 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; | 48 this._debuggerWorkspaceBinding = debuggerWorkspaceBinding; |
| 49 | 49 |
| 50 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 50 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
| 51 this._sourceMapForSourceMapURL = {}; | 51 this._sourceMapForSourceMapURL = {}; |
| 52 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>} */ | 52 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap, string
=)>>} */ |
| 53 this._pendingSourceMapLoadingCallbacks = {}; | 53 this._pendingSourceMapLoadingCallbacks = {}; |
| 54 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 54 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
| 55 this._sourceMapForScriptId = {}; | 55 this._sourceMapForScriptId = {}; |
| 56 /** @type {!Map.<!WebInspector.SourceMap, !WebInspector.Script>} */ | 56 /** @type {!Map.<!WebInspector.SourceMap, !WebInspector.Script>} */ |
| 57 this._scriptForSourceMap = new Map(); | 57 this._scriptForSourceMap = new Map(); |
| 58 /** @type {!Map.<string, !WebInspector.SourceMap>} */ | 58 /** @type {!Map.<string, !WebInspector.SourceMap>} */ |
| 59 this._sourceMapForURL = new Map(); | 59 this._sourceMapForURL = new Map(); |
| 60 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ | 60 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ |
| 61 this._stubUISourceCodes = new Map(); | 61 this._stubUISourceCodes = new Map(); |
| 62 | 62 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 callback(sourceMap); | 317 callback(sourceMap); |
| 318 return; | 318 return; |
| 319 } | 319 } |
| 320 | 320 |
| 321 var pendingCallbacks = this._pendingSourceMapLoadingCallbacks[sourceMapU
RL]; | 321 var pendingCallbacks = this._pendingSourceMapLoadingCallbacks[sourceMapU
RL]; |
| 322 if (pendingCallbacks) { | 322 if (pendingCallbacks) { |
| 323 pendingCallbacks.push(callback); | 323 pendingCallbacks.push(callback); |
| 324 return; | 324 return; |
| 325 } | 325 } |
| 326 | 326 |
| 327 pendingCallbacks = [callback]; | 327 pendingCallbacks = [ sourceMapContentLoaded.bind(this), callback ]; |
| 328 this._pendingSourceMapLoadingCallbacks[sourceMapURL] = pendingCallbacks; | 328 this._pendingSourceMapLoadingCallbacks[sourceMapURL] = pendingCallbacks; |
| 329 | 329 |
| 330 WebInspector.SourceMap.load(sourceMapURL, scriptURL, sourceMapLoaded.bin
d(this)); | 330 WebInspector.SourceMap.load(sourceMapURL, scriptURL, sourceMapLoaded.bin
d(this)); |
| 331 | 331 |
| 332 /** | 332 /** |
| 333 * @param {?WebInspector.SourceMap} sourceMap | 333 * @param {?WebInspector.SourceMap} sourceMap |
| 334 * @param {string=} content |
| 334 * @this {WebInspector.CompilerScriptMapping} | 335 * @this {WebInspector.CompilerScriptMapping} |
| 335 */ | 336 */ |
| 336 function sourceMapLoaded(sourceMap) | 337 function sourceMapLoaded(sourceMap, content) |
| 337 { | 338 { |
| 338 var url = /** @type {string} */ (sourceMapURL); | 339 var url = /** @type {string} */ (sourceMapURL); |
| 339 var callbacks = this._pendingSourceMapLoadingCallbacks[url]; | 340 var callbacks = this._pendingSourceMapLoadingCallbacks[url]; |
| 340 delete this._pendingSourceMapLoadingCallbacks[url]; | 341 delete this._pendingSourceMapLoadingCallbacks[url]; |
| 341 if (!callbacks) | 342 if (!callbacks) |
| 342 return; | 343 return; |
| 343 if (sourceMap) | 344 if (sourceMap) |
| 344 this._sourceMapForSourceMapURL[url] = sourceMap; | 345 this._sourceMapForSourceMapURL[url] = sourceMap; |
| 345 for (var i = 0; i < callbacks.length; ++i) | 346 for (var i = 0; i < callbacks.length; ++i) |
| 346 callbacks[i](sourceMap); | 347 callbacks[i](sourceMap, content); |
| 348 } |
| 349 |
| 350 /** |
| 351 * @param {?WebInspector.SourceMap} sourceMap |
| 352 * @param {string} content |
| 353 * @this {WebInspector.CompilerScriptMapping} |
| 354 */ |
| 355 function sourceMapContentLoaded(sourceMap, content) |
| 356 { |
| 357 if (!content) |
| 358 return; |
| 359 this._debuggerModel.setSourceMapContent(script.scriptId, scriptSourc
eMapURL, content); |
| 347 } | 360 } |
| 348 }, | 361 }, |
| 349 | 362 |
| 350 _debuggerReset: function() | 363 _debuggerReset: function() |
| 351 { | 364 { |
| 352 /** | 365 /** |
| 353 * @param {!WebInspector.SourceMap} sourceMap | 366 * @param {!WebInspector.SourceMap} sourceMap |
| 354 * @this {WebInspector.CompilerScriptMapping} | 367 * @this {WebInspector.CompilerScriptMapping} |
| 355 */ | 368 */ |
| 356 function unbindSourceMapSources(sourceMap) | 369 function unbindSourceMapSources(sourceMap) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 373 this._sourceMapForScriptId = {}; | 386 this._sourceMapForScriptId = {}; |
| 374 this._scriptForSourceMap.clear(); | 387 this._scriptForSourceMap.clear(); |
| 375 this._sourceMapForURL.clear(); | 388 this._sourceMapForURL.clear(); |
| 376 }, | 389 }, |
| 377 | 390 |
| 378 dispose: function() | 391 dispose: function() |
| 379 { | 392 { |
| 380 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); | 393 this._workspace.removeEventListener(WebInspector.Workspace.Events.UISour
ceCodeAdded, this._uiSourceCodeAddedToWorkspace, this); |
| 381 } | 394 } |
| 382 } | 395 } |
| OLD | NEW |