| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @implements {WebInspector.TargetManager.Observer} | |
| 34 * @param {!WebInspector.Workspace} workspace | 33 * @param {!WebInspector.Workspace} workspace |
| 35 */ | 34 */ |
| 36 WebInspector.PresentationConsoleMessageHelper = function(workspace) | 35 WebInspector.PresentationConsoleMessageHelper = function(workspace) |
| 37 { | 36 { |
| 38 /** | 37 /** |
| 39 * @type {!Object.<string, !Array.<!WebInspector.ConsoleMessage>>} | 38 * @type {!Object.<string, !Array.<!WebInspector.ConsoleMessage>>} |
| 40 */ | 39 */ |
| 41 this._pendingConsoleMessages = {}; | 40 this._pendingConsoleMessages = {}; |
| 42 this._presentationConsoleMessages = []; | 41 this._presentationConsoleMessages = []; |
| 43 this._workspace = workspace; | 42 this._workspace = workspace; |
| 44 | 43 |
| 45 WebInspector.targetManager.observeTargets(this); | |
| 46 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._consoleCleared, this); | 44 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.ConsoleCleared, this._consoleCleared, this); |
| 47 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._onConsoleMessageAdded, this); | 45 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, this._onConsoleMessageAdded, this); |
| 48 WebInspector.multitargetConsoleModel.messages().forEach(this._consoleMessage
Added, this); | 46 WebInspector.multitargetConsoleModel.messages().forEach(this._consoleMessage
Added, this); |
| 47 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this
); |
| 48 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.FailedToParseScriptSource, this._parsedScriptSourc
e, this); |
| 49 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
| 49 } | 50 } |
| 50 | 51 |
| 51 WebInspector.PresentationConsoleMessageHelper.prototype = { | 52 WebInspector.PresentationConsoleMessageHelper.prototype = { |
| 52 /** | 53 /** |
| 53 * @param {!WebInspector.Target} target | |
| 54 */ | |
| 55 targetAdded: function(target) | |
| 56 { | |
| 57 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
ParsedScriptSource, this._parsedScriptSource, this); | |
| 58 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
FailedToParseScriptSource, this._parsedScriptSource, this); | |
| 59 target.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.
GlobalObjectCleared, this._debuggerReset, this); | |
| 60 }, | |
| 61 | |
| 62 /** | |
| 63 * @param {!WebInspector.Target} target | |
| 64 */ | |
| 65 targetRemoved: function(target) | |
| 66 { | |
| 67 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.ParsedScriptSource, this._parsedScriptSource, this); | |
| 68 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.FailedToParseScriptSource, this._parsedScriptSource, this); | |
| 69 target.debuggerModel.removeEventListener(WebInspector.DebuggerModel.Even
ts.GlobalObjectCleared, this._debuggerReset, this); | |
| 70 }, | |
| 71 | |
| 72 /** | |
| 73 * @param {!WebInspector.Event} event | 54 * @param {!WebInspector.Event} event |
| 74 */ | 55 */ |
| 75 _onConsoleMessageAdded: function(event) | 56 _onConsoleMessageAdded: function(event) |
| 76 { | 57 { |
| 77 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); | 58 var message = /** @type {!WebInspector.ConsoleMessage} */ (event.data); |
| 78 this._consoleMessageAdded(message) | 59 this._consoleMessageAdded(message) |
| 79 }, | 60 }, |
| 80 | 61 |
| 81 /** | 62 /** |
| 82 * @param {!WebInspector.ConsoleMessage} message | 63 * @param {!WebInspector.ConsoleMessage} message |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 get lineNumber() | 178 get lineNumber() |
| 198 { | 179 { |
| 199 return this._uiLocation.lineNumber; | 180 return this._uiLocation.lineNumber; |
| 200 }, | 181 }, |
| 201 | 182 |
| 202 dispose: function() | 183 dispose: function() |
| 203 { | 184 { |
| 204 this._liveLocation.dispose(); | 185 this._liveLocation.dispose(); |
| 205 } | 186 } |
| 206 } | 187 } |
| OLD | NEW |