| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 if (pendingMessages.length) | 150 if (pendingMessages.length) |
| 151 this._pendingConsoleMessages[script.sourceURL] = pendingMessages; | 151 this._pendingConsoleMessages[script.sourceURL] = pendingMessages; |
| 152 else | 152 else |
| 153 delete this._pendingConsoleMessages[script.sourceURL]; | 153 delete this._pendingConsoleMessages[script.sourceURL]; |
| 154 } | 154 } |
| 155 | 155 |
| 156 _consoleCleared() { | 156 _consoleCleared() { |
| 157 this._pendingConsoleMessages = {}; | 157 this._pendingConsoleMessages = {}; |
| 158 for (var i = 0; i < this._presentationConsoleMessages.length; ++i) | 158 |
| 159 this._presentationConsoleMessages[i].dispose(); | 159 var messageUISourceCodes = new Set(); |
| 160 var uiMessagesToRemove = new Set(); |
| 161 for (var i = 0; i < this._presentationConsoleMessages.length; ++i) { |
| 162 var uiMessage = this._presentationConsoleMessages[i].uiMessage(); |
| 163 if (uiMessage) { |
| 164 messageUISourceCodes.add(uiMessage.uiSourceCode()); |
| 165 uiMessagesToRemove.add(uiMessage); |
| 166 } |
| 167 } |
| 168 |
| 169 for (var uiSourceCode of messageUISourceCodes) |
| 170 uiSourceCode.removeMessages(uiMessagesToRemove); |
| 171 |
| 160 this._presentationConsoleMessages = []; | 172 this._presentationConsoleMessages = []; |
| 161 this._locationPool.disposeAll(); | 173 this._locationPool.disposeAll(); |
| 162 } | 174 } |
| 163 | 175 |
| 164 _debuggerReset() { | 176 _debuggerReset() { |
| 165 this._consoleCleared(); | 177 this._consoleCleared(); |
| 166 } | 178 } |
| 167 }; | 179 }; |
| 168 | 180 |
| 169 /** | 181 /** |
| 170 * @unrestricted | 182 * @unrestricted |
| 171 */ | 183 */ |
| 172 Bindings.PresentationConsoleMessage = class { | 184 Bindings.PresentationConsoleMessage = class { |
| 173 /** | 185 /** |
| 174 * @param {!SDK.ConsoleMessage} message | 186 * @param {!SDK.ConsoleMessage} message |
| 175 * @param {!SDK.DebuggerModel.Location} rawLocation | 187 * @param {!SDK.DebuggerModel.Location} rawLocation |
| 176 * @param {!Bindings.LiveLocationPool} locationPool | 188 * @param {!Bindings.LiveLocationPool} locationPool |
| 177 */ | 189 */ |
| 178 constructor(message, rawLocation, locationPool) { | 190 constructor(message, rawLocation, locationPool) { |
| 179 this._text = message.messageText; | 191 this._text = message.messageText; |
| 180 this._level = message.level === SDK.ConsoleMessage.MessageLevel.Error ? | 192 this._level = message.level === SDK.ConsoleMessage.MessageLevel.Error ? |
| 181 Workspace.UISourceCode.Message.Level.Error : | 193 Workspace.UISourceCode.Message.Level.Error : |
| 182 Workspace.UISourceCode.Message.Level.Warning; | 194 Workspace.UISourceCode.Message.Level.Warning; |
| 183 Bindings.debuggerWorkspaceBinding.createLiveLocation(rawLocation, this._upda
teLocation.bind(this), locationPool); | 195 Bindings.debuggerWorkspaceBinding.createLiveLocation(rawLocation, this._upda
teLocation.bind(this), locationPool); |
| 196 |
| 197 /** @type {!Workspace.UISourceCode.Message|undefined} */ |
| 198 this._uiMessage; |
| 184 } | 199 } |
| 185 | 200 |
| 186 /** | 201 /** |
| 187 * @param {!Bindings.LiveLocation} liveLocation | 202 * @param {!Bindings.LiveLocation} liveLocation |
| 188 */ | 203 */ |
| 189 _updateLocation(liveLocation) { | 204 _updateLocation(liveLocation) { |
| 190 if (this._uiMessage) | 205 if (this._uiMessage) |
| 191 this._uiMessage.remove(); | 206 this._uiMessage.remove(); |
| 192 var uiLocation = liveLocation.uiLocation(); | 207 var uiLocation = liveLocation.uiLocation(); |
| 193 if (!uiLocation) | 208 if (!uiLocation) |
| 194 return; | 209 return; |
| 195 this._uiMessage = | 210 this._uiMessage = |
| 196 uiLocation.uiSourceCode.addLineMessage(this._level, this._text, uiLocati
on.lineNumber, uiLocation.columnNumber); | 211 uiLocation.uiSourceCode.addLineMessage(this._level, this._text, uiLocati
on.lineNumber, uiLocation.columnNumber); |
| 197 } | 212 } |
| 198 | 213 |
| 199 dispose() { | 214 /** |
| 200 if (this._uiMessage) | 215 * @return {!Workspace.UISourceCode.Message|undefined} |
| 201 this._uiMessage.remove(); | 216 */ |
| 217 uiMessage() { |
| 218 return this._uiMessage; |
| 202 } | 219 } |
| 203 }; | 220 }; |
| 204 | 221 |
| 205 /** @type {!Bindings.PresentationConsoleMessageHelper} */ | 222 /** @type {!Bindings.PresentationConsoleMessageHelper} */ |
| 206 Bindings.presentationConsoleMessageHelper; | 223 Bindings.presentationConsoleMessageHelper; |
| OLD | NEW |