| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.DebuggerSourceMapping} | 7 * @implements {WebInspector.DebuggerSourceMapping} |
| 8 * @param {!WebInspector.DebuggerModel} debuggerModel | 8 * @param {!WebInspector.DebuggerModel} debuggerModel |
| 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction | 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction |
| 10 */ | 10 */ |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 /** | 363 /** |
| 364 * @this {WebInspector.ScriptFormatterEditorAction} | 364 * @this {WebInspector.ScriptFormatterEditorAction} |
| 365 * @param {string} formattedContent | 365 * @param {string} formattedContent |
| 366 * @param {!WebInspector.FormatterSourceMapping} formatterMapping | 366 * @param {!WebInspector.FormatterSourceMapping} formatterMapping |
| 367 */ | 367 */ |
| 368 function innerCallback(formattedContent, formatterMapping) | 368 function innerCallback(formattedContent, formatterMapping) |
| 369 { | 369 { |
| 370 var scripts = this._scriptsForUISourceCode(uiSourceCode); | 370 var scripts = this._scriptsForUISourceCode(uiSourceCode); |
| 371 var formattedURL = uiSourceCode.url() + ":formatted"; | 371 var formattedURL = uiSourceCode.url() + ":formatted"; |
| 372 var contentProvider = new WebInspector.StaticContentProvider(uiSourc
eCode.contentType(), formattedContent, formattedURL); | 372 var contentProvider = new WebInspector.StaticContentProvider(formatt
edURL, uiSourceCode.contentType(), Promise.resolve(formattedContent)); |
| 373 var formattedUISourceCode = this._project.addContentProvider(formatt
edURL, contentProvider); | 373 var formattedUISourceCode = this._project.addContentProvider(formatt
edURL, contentProvider); |
| 374 var formattedPath = formattedUISourceCode.url(); | 374 var formattedPath = formattedUISourceCode.url(); |
| 375 var formatData = new WebInspector.FormatterScriptMapping.FormatData(
uiSourceCode.project().id(), uiSourceCode.url(), formatterMapping, scripts); | 375 var formatData = new WebInspector.FormatterScriptMapping.FormatData(
uiSourceCode.project().id(), uiSourceCode.url(), formatterMapping, scripts); |
| 376 this._formatData.set(formattedUISourceCode, formatData); | 376 this._formatData.set(formattedUISourceCode, formatData); |
| 377 var path = uiSourceCode.project().id() + ":" + uiSourceCode.url(); | 377 var path = uiSourceCode.project().id() + ":" + uiSourceCode.url(); |
| 378 this._formattedPaths.set(path, formattedPath); | 378 this._formattedPaths.set(path, formattedPath); |
| 379 this._pathsToFormatOnLoad.add(path); | 379 this._pathsToFormatOnLoad.add(path); |
| 380 for (var i = 0; i < scripts.length; ++i) { | 380 for (var i = 0; i < scripts.length; ++i) { |
| 381 this._uiSourceCodes.set(scripts[i], formattedUISourceCode); | 381 this._uiSourceCodes.set(scripts[i], formattedUISourceCode); |
| 382 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp
ing} */(this._scriptMappingByTarget.get(scripts[i].target())); | 382 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp
ing} */(this._scriptMappingByTarget.get(scripts[i].target())); |
| 383 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(scripts[
i], scriptMapping); | 383 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(scripts[
i], scriptMapping); |
| 384 } | 384 } |
| 385 | 385 |
| 386 var targets = WebInspector.targetManager.targets(); | 386 var targets = WebInspector.targetManager.targets(); |
| 387 for (var i = 0; i < targets.length; ++i) { | 387 for (var i = 0; i < targets.length; ++i) { |
| 388 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp
ing} */(this._scriptMappingByTarget.get(targets[i])); | 388 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp
ing} */(this._scriptMappingByTarget.get(targets[i])); |
| 389 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i
], formattedUISourceCode, scriptMapping); | 389 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i
], formattedUISourceCode, scriptMapping); |
| 390 } | 390 } |
| 391 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap
ping); | 391 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap
ping); |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 } | 394 } |
| OLD | NEW |