| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 14 matching lines...) Expand all Loading... |
| 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 * @extends {WebInspector.SDKModel} | 33 * @extends {WebInspector.SDKModel} |
| 34 * @param {!WebInspector.Target} target | 34 * @param {!WebInspector.Target} target |
| 35 * @param {?Protocol.LogAgent} logAgent | |
| 36 */ | 35 */ |
| 37 WebInspector.ConsoleModel = function(target, logAgent) | 36 WebInspector.ConsoleModel = function(target) |
| 38 { | 37 { |
| 39 WebInspector.SDKModel.call(this, WebInspector.ConsoleModel, target); | 38 WebInspector.SDKModel.call(this, WebInspector.ConsoleModel, target); |
| 40 | 39 |
| 41 /** @type {!Array.<!WebInspector.ConsoleMessage>} */ | 40 /** @type {!Array.<!WebInspector.ConsoleMessage>} */ |
| 42 this._messages = []; | 41 this._messages = []; |
| 43 /** @type {!Map<number, !WebInspector.ConsoleMessage>} */ | 42 /** @type {!Map<number, !WebInspector.ConsoleMessage>} */ |
| 44 this._messageByExceptionId = new Map(); | 43 this._messageByExceptionId = new Map(); |
| 45 this._warnings = 0; | 44 this._warnings = 0; |
| 46 this._errors = 0; | 45 this._errors = 0; |
| 47 this._revokedErrors = 0; | 46 this._revokedErrors = 0; |
| 48 this._logAgent = logAgent; | 47 this._logAgent = target.logAgent(); |
| 49 if (this._logAgent) { | 48 target.registerLogDispatcher(new WebInspector.LogDispatcher(this)); |
| 50 target.registerLogDispatcher(new WebInspector.LogDispatcher(this)); | 49 this._logAgent.enable(); |
| 51 this._logAgent.enable(); | |
| 52 } | |
| 53 } | 50 } |
| 54 | 51 |
| 55 /** @enum {symbol} */ | 52 /** @enum {symbol} */ |
| 56 WebInspector.ConsoleModel.Events = { | 53 WebInspector.ConsoleModel.Events = { |
| 57 ConsoleCleared: Symbol("ConsoleCleared"), | 54 ConsoleCleared: Symbol("ConsoleCleared"), |
| 58 MessageAdded: Symbol("MessageAdded"), | 55 MessageAdded: Symbol("MessageAdded"), |
| 59 MessageUpdated: Symbol("MessageUpdated"), | 56 MessageUpdated: Symbol("MessageUpdated"), |
| 60 CommandEvaluated: Symbol("CommandEvaluated") | 57 CommandEvaluated: Symbol("CommandEvaluated") |
| 61 } | 58 } |
| 62 | 59 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 /** | 127 /** |
| 131 * @return {!Array.<!WebInspector.ConsoleMessage>} | 128 * @return {!Array.<!WebInspector.ConsoleMessage>} |
| 132 */ | 129 */ |
| 133 messages: function() | 130 messages: function() |
| 134 { | 131 { |
| 135 return this._messages; | 132 return this._messages; |
| 136 }, | 133 }, |
| 137 | 134 |
| 138 requestClearMessages: function() | 135 requestClearMessages: function() |
| 139 { | 136 { |
| 140 this._logAgent && this._logAgent.clear(); | 137 this._logAgent.clear(); |
| 141 this.clear(); | 138 this.clear(); |
| 142 }, | 139 }, |
| 143 | 140 |
| 144 clear: function() | 141 clear: function() |
| 145 { | 142 { |
| 146 this._messages = []; | 143 this._messages = []; |
| 147 this._messageByExceptionId.clear(); | 144 this._messageByExceptionId.clear(); |
| 148 this._errors = 0; | 145 this._errors = 0; |
| 149 this._revokedErrors = 0; | 146 this._revokedErrors = 0; |
| 150 this._warnings = 0; | 147 this._warnings = 0; |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEv
aluated, event.data); | 657 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEv
aluated, event.data); |
| 661 }, | 658 }, |
| 662 | 659 |
| 663 __proto__: WebInspector.Object.prototype | 660 __proto__: WebInspector.Object.prototype |
| 664 } | 661 } |
| 665 | 662 |
| 666 /** | 663 /** |
| 667 * @type {!WebInspector.MultitargetConsoleModel} | 664 * @type {!WebInspector.MultitargetConsoleModel} |
| 668 */ | 665 */ |
| 669 WebInspector.multitargetConsoleModel; | 666 WebInspector.multitargetConsoleModel; |
| OLD | NEW |