| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 this._presentationConsoleMessages = []; | 43 this._presentationConsoleMessages = []; |
| 44 | 44 |
| 45 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._consoleCleared, this); | 45 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._consoleCleared, this); |
| 46 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._onConsoleMessageAdded, this); | 46 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._onConsoleMessageAdded, this); |
| 47 WebInspector.multitargetConsoleModel.messages().forEach(this._consoleMessage
Added, this); | 47 WebInspector.multitargetConsoleModel.messages().forEach(this._consoleMessage
Added, this); |
| 48 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this
); | 48 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this
); |
| 49 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSourc
e, this); | 49 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSourc
e, this); |
| 50 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); | 50 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
| 51 | 51 |
| 52 this._locationPool = new WebInspector.LiveLocationPool(); | 52 this._locationPool = new WebInspector.LiveLocationPool(); |
| 53 } | 53 }; |
| 54 | 54 |
| 55 WebInspector.PresentationConsoleMessageHelper.prototype = { | 55 WebInspector.PresentationConsoleMessageHelper.prototype = { |
| 56 /** | 56 /** |
| 57 * @param {!WebInspector.Event} event | 57 * @param {!WebInspector.Event} event |
| 58 */ | 58 */ |
| 59 _onConsoleMessageAdded: function(event) | 59 _onConsoleMessageAdded: function(event) |
| 60 { | 60 { |
| 61 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); | 61 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); |
| 62 this._consoleMessageAdded(message); | 62 this._consoleMessageAdded(message); |
| 63 }, | 63 }, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 for (var i = 0; i < this._presentationConsoleMessages.length; ++i) | 152 for (var i = 0; i < this._presentationConsoleMessages.length; ++i) |
| 153 this._presentationConsoleMessages[i].dispose(); | 153 this._presentationConsoleMessages[i].dispose(); |
| 154 this._presentationConsoleMessages = []; | 154 this._presentationConsoleMessages = []; |
| 155 this._locationPool.disposeAll(); | 155 this._locationPool.disposeAll(); |
| 156 }, | 156 }, |
| 157 | 157 |
| 158 _debuggerReset: function() | 158 _debuggerReset: function() |
| 159 { | 159 { |
| 160 this._consoleCleared(); | 160 this._consoleCleared(); |
| 161 } | 161 } |
| 162 } | 162 }; |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * @constructor | 165 * @constructor |
| 166 * @param {!WebInspector.ConsoleMessage} message | 166 * @param {!WebInspector.ConsoleMessage} message |
| 167 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 167 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
| 168 * @param {!WebInspector.LiveLocationPool} locationPool | 168 * @param {!WebInspector.LiveLocationPool} locationPool |
| 169 */ | 169 */ |
| 170 WebInspector.PresentationConsoleMessage = function(message, rawLocation, locatio
nPool) | 170 WebInspector.PresentationConsoleMessage = function(message, rawLocation, locatio
nPool) |
| 171 { | 171 { |
| 172 this._text = message.messageText; | 172 this._text = message.messageText; |
| 173 this._level = message.level === WebInspector.ConsoleMessage.MessageLevel.Err
or ? WebInspector.UISourceCode.Message.Level.Error : WebInspector.UISourceCode.M
essage.Level.Warning; | 173 this._level = message.level === WebInspector.ConsoleMessage.MessageLevel.Err
or ? WebInspector.UISourceCode.Message.Level.Error : WebInspector.UISourceCode.M
essage.Level.Warning; |
| 174 WebInspector.debuggerWorkspaceBinding.createLiveLocation(rawLocation, this._
updateLocation.bind(this), locationPool); | 174 WebInspector.debuggerWorkspaceBinding.createLiveLocation(rawLocation, this._
updateLocation.bind(this), locationPool); |
| 175 } | 175 }; |
| 176 | 176 |
| 177 WebInspector.PresentationConsoleMessage.prototype = { | 177 WebInspector.PresentationConsoleMessage.prototype = { |
| 178 /** | 178 /** |
| 179 * @param {!WebInspector.LiveLocation} liveLocation | 179 * @param {!WebInspector.LiveLocation} liveLocation |
| 180 */ | 180 */ |
| 181 _updateLocation: function(liveLocation) | 181 _updateLocation: function(liveLocation) |
| 182 { | 182 { |
| 183 if (this._uiMessage) | 183 if (this._uiMessage) |
| 184 this._uiMessage.remove(); | 184 this._uiMessage.remove(); |
| 185 var uiLocation = liveLocation.uiLocation(); | 185 var uiLocation = liveLocation.uiLocation(); |
| 186 if (!uiLocation) | 186 if (!uiLocation) |
| 187 return; | 187 return; |
| 188 this._uiMessage = uiLocation.uiSourceCode.addLineMessage(this._level, th
is._text, uiLocation.lineNumber, uiLocation.columnNumber); | 188 this._uiMessage = uiLocation.uiSourceCode.addLineMessage(this._level, th
is._text, uiLocation.lineNumber, uiLocation.columnNumber); |
| 189 }, | 189 }, |
| 190 | 190 |
| 191 dispose: function() | 191 dispose: function() |
| 192 { | 192 { |
| 193 if (this._uiMessage) | 193 if (this._uiMessage) |
| 194 this._uiMessage.remove(); | 194 this._uiMessage.remove(); |
| 195 } | 195 } |
| 196 } | 196 }; |
| 197 | 197 |
| 198 /** @type {!WebInspector.PresentationConsoleMessageHelper} */ | 198 /** @type {!WebInspector.PresentationConsoleMessageHelper} */ |
| 199 WebInspector.presentationConsoleMessageHelper; | 199 WebInspector.presentationConsoleMessageHelper; |
| OLD | NEW |