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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 this._sourceMapForURL = new Map(); | 55 this._sourceMapForURL = new Map(); |
56 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ | 56 /** @type {!Map.<string, !WebInspector.UISourceCode>} */ |
57 this._stubUISourceCodes = new Map(); | 57 this._stubUISourceCodes = new Map(); |
58 | 58 |
59 var projectId = WebInspector.CompilerScriptMapping.projectIdForTarget(this._
target); | 59 var projectId = WebInspector.CompilerScriptMapping.projectIdForTarget(this._
target); |
60 this._stubProject = new WebInspector.ContentProviderBasedProject(workspace,
projectId, WebInspector.projectTypes.Service, ""); | 60 this._stubProject = new WebInspector.ContentProviderBasedProject(workspace,
projectId, WebInspector.projectTypes.Service, ""); |
61 this._eventListeners = [ | 61 this._eventListeners = [ |
62 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdd
ed, this._uiSourceCodeAddedToWorkspace, this), | 62 workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeAdd
ed, this._uiSourceCodeAddedToWorkspace, this), |
63 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalO
bjectCleared, this._debuggerReset, this) | 63 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalO
bjectCleared, this._debuggerReset, this) |
64 ]; | 64 ]; |
65 } | 65 }; |
66 | 66 |
67 WebInspector.CompilerScriptMapping._originSymbol = Symbol("origin"); | 67 WebInspector.CompilerScriptMapping._originSymbol = Symbol("origin"); |
68 | 68 |
69 /** | 69 /** |
70 * @param {!WebInspector.UISourceCode} uiSourceCode | 70 * @param {!WebInspector.UISourceCode} uiSourceCode |
71 * @return {?string} | 71 * @return {?string} |
72 */ | 72 */ |
73 WebInspector.CompilerScriptMapping.uiSourceCodeOrigin = function(uiSourceCode) | 73 WebInspector.CompilerScriptMapping.uiSourceCodeOrigin = function(uiSourceCode) |
74 { | 74 { |
75 return uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] || nul
l; | 75 return uiSourceCode[WebInspector.CompilerScriptMapping._originSymbol] || nul
l; |
76 } | 76 }; |
77 | 77 |
78 WebInspector.CompilerScriptMapping.prototype = { | 78 WebInspector.CompilerScriptMapping.prototype = { |
79 /** | 79 /** |
80 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 80 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
81 * @return {boolean} | 81 * @return {boolean} |
82 */ | 82 */ |
83 mapsToSourceCode: function(rawLocation) { | 83 mapsToSourceCode: function(rawLocation) { |
84 var sourceMap = this._sourceMapForScriptId.get(rawLocation.scriptId); | 84 var sourceMap = this._sourceMapForScriptId.get(rawLocation.scriptId); |
85 if (!sourceMap) { | 85 if (!sourceMap) { |
86 return true; | 86 return true; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 for (var sourceURL of sourceMap.sourceURLs()) { | 366 for (var sourceURL of sourceMap.sourceURLs()) { |
367 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL
(sourceURL, script); | 367 var uiSourceCode = this._networkMapping.uiSourceCodeForScriptURL
(sourceURL, script); |
368 if (uiSourceCode) | 368 if (uiSourceCode) |
369 this._unbindUISourceCode(uiSourceCode); | 369 this._unbindUISourceCode(uiSourceCode); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
373 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind(
this)); | 373 this._sourceMapForURL.valuesArray().forEach(unbindSourceMapSources.bind(
this)); |
374 | 374 |
375 this._sourceMapLoadingPromises.clear(); | 375 this._sourceMapLoadingPromises.clear(); |
376 this._sourceMapForScriptId.clear() | 376 this._sourceMapForScriptId.clear(); |
377 this._scriptForSourceMap.clear(); | 377 this._scriptForSourceMap.clear(); |
378 this._sourceMapForURL.clear(); | 378 this._sourceMapForURL.clear(); |
379 }, | 379 }, |
380 | 380 |
381 dispose: function() | 381 dispose: function() |
382 { | 382 { |
383 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 383 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
384 this._debuggerReset(); | 384 this._debuggerReset(); |
385 this._stubProject.dispose(); | 385 this._stubProject.dispose(); |
386 } | 386 } |
387 } | 387 }; |
388 | 388 |
389 /** | 389 /** |
390 * @param {!WebInspector.Target} target | 390 * @param {!WebInspector.Target} target |
391 * @return {string} | 391 * @return {string} |
392 */ | 392 */ |
393 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) | 393 WebInspector.CompilerScriptMapping.projectIdForTarget = function(target) |
394 { | 394 { |
395 return "compiler-script-project:" + target.id(); | 395 return "compiler-script-project:" + target.id(); |
396 } | 396 }; |
OLD | NEW |