| 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 */ |
| 11 WebInspector.FormatterScriptMapping = function(debuggerModel, editorAction) | 11 WebInspector.FormatterScriptMapping = function(debuggerModel, editorAction) |
| 12 { | 12 { |
| 13 this._debuggerModel = debuggerModel; | 13 this._debuggerModel = debuggerModel; |
| 14 this._editorAction = editorAction; | 14 this._editorAction = editorAction; |
| 15 } | 15 }; |
| 16 | 16 |
| 17 WebInspector.FormatterScriptMapping.prototype = { | 17 WebInspector.FormatterScriptMapping.prototype = { |
| 18 /** | 18 /** |
| 19 * @override | 19 * @override |
| 20 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 20 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
| 21 * @return {?WebInspector.UILocation} | 21 * @return {?WebInspector.UILocation} |
| 22 */ | 22 */ |
| 23 rawLocationToUILocation: function(rawLocation) | 23 rawLocationToUILocation: function(rawLocation) |
| 24 { | 24 { |
| 25 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); | 25 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 /** | 72 /** |
| 73 * @override | 73 * @override |
| 74 * @param {!WebInspector.UISourceCode} uiSourceCode | 74 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 75 * @param {number} lineNumber | 75 * @param {number} lineNumber |
| 76 * @return {boolean} | 76 * @return {boolean} |
| 77 */ | 77 */ |
| 78 uiLineHasMapping: function(uiSourceCode, lineNumber) | 78 uiLineHasMapping: function(uiSourceCode, lineNumber) |
| 79 { | 79 { |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 } | 82 }; |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * @constructor | 85 * @constructor |
| 86 * @param {string} projectId | 86 * @param {string} projectId |
| 87 * @param {string} path | 87 * @param {string} path |
| 88 * @param {!WebInspector.FormatterSourceMapping} mapping | 88 * @param {!WebInspector.FormatterSourceMapping} mapping |
| 89 * @param {!Array.<!WebInspector.Script>} scripts | 89 * @param {!Array.<!WebInspector.Script>} scripts |
| 90 */ | 90 */ |
| 91 WebInspector.FormatterScriptMapping.FormatData = function(projectId, path, mappi
ng, scripts) | 91 WebInspector.FormatterScriptMapping.FormatData = function(projectId, path, mappi
ng, scripts) |
| 92 { | 92 { |
| 93 this.projectId = projectId; | 93 this.projectId = projectId; |
| 94 this.path = path; | 94 this.path = path; |
| 95 this.mapping = mapping; | 95 this.mapping = mapping; |
| 96 this.scripts = scripts; | 96 this.scripts = scripts; |
| 97 } | 97 }; |
| 98 | 98 |
| 99 /** | 99 /** |
| 100 * @constructor | 100 * @constructor |
| 101 * @implements {WebInspector.SourcesView.EditorAction} | 101 * @implements {WebInspector.SourcesView.EditorAction} |
| 102 * @implements {WebInspector.TargetManager.Observer} | 102 * @implements {WebInspector.TargetManager.Observer} |
| 103 */ | 103 */ |
| 104 WebInspector.ScriptFormatterEditorAction = function() | 104 WebInspector.ScriptFormatterEditorAction = function() |
| 105 { | 105 { |
| 106 this._projectId = "formatter:"; | 106 this._projectId = "formatter:"; |
| 107 this._project = new WebInspector.ContentProviderBasedProject(WebInspector.wo
rkspace, this._projectId, WebInspector.projectTypes.Formatter, "formatter"); | 107 this._project = new WebInspector.ContentProviderBasedProject(WebInspector.wo
rkspace, this._projectId, WebInspector.projectTypes.Formatter, "formatter"); |
| 108 | 108 |
| 109 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ | 109 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ |
| 110 this._uiSourceCodes = new Map(); | 110 this._uiSourceCodes = new Map(); |
| 111 /** @type {!Map.<string, string>} */ | 111 /** @type {!Map.<string, string>} */ |
| 112 this._formattedPaths = new Map(); | 112 this._formattedPaths = new Map(); |
| 113 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScriptMa
pping.FormatData>} */ | 113 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScriptMa
pping.FormatData>} */ |
| 114 this._formatData = new Map(); | 114 this._formatData = new Map(); |
| 115 | 115 |
| 116 /** @type {!Set.<string>} */ | 116 /** @type {!Set.<string>} */ |
| 117 this._pathsToFormatOnLoad = new Set(); | 117 this._pathsToFormatOnLoad = new Set(); |
| 118 | 118 |
| 119 /** @type {!Map.<!WebInspector.Target, !WebInspector.FormatterScriptMapping>
} */ | 119 /** @type {!Map.<!WebInspector.Target, !WebInspector.FormatterScriptMapping>
} */ |
| 120 this._scriptMappingByTarget = new Map(); | 120 this._scriptMappingByTarget = new Map(); |
| 121 this._workspace = WebInspector.workspace; | 121 this._workspace = WebInspector.workspace; |
| 122 WebInspector.targetManager.observeTargets(this); | 122 WebInspector.targetManager.observeTargets(this); |
| 123 } | 123 }; |
| 124 | 124 |
| 125 WebInspector.ScriptFormatterEditorAction.prototype = { | 125 WebInspector.ScriptFormatterEditorAction.prototype = { |
| 126 /** | 126 /** |
| 127 * @override | 127 * @override |
| 128 * @param {!WebInspector.Target} target | 128 * @param {!WebInspector.Target} target |
| 129 */ | 129 */ |
| 130 targetAdded: function(target) | 130 targetAdded: function(target) |
| 131 { | 131 { |
| 132 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 132 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
| 133 if (!debuggerModel) | 133 if (!debuggerModel) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |