Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/ConsoleModel.js

Issue 2345873002: [Devtools] Add capability for the log domain (Closed)
Patch Set: [Devtools] Add capability for the log domain Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
35 */ 36 */
36 WebInspector.ConsoleModel = function(target) 37 WebInspector.ConsoleModel = function(target, logAgent)
37 { 38 {
38 WebInspector.SDKModel.call(this, WebInspector.ConsoleModel, target); 39 WebInspector.SDKModel.call(this, WebInspector.ConsoleModel, target);
39 40
40 /** @type {!Array.<!WebInspector.ConsoleMessage>} */ 41 /** @type {!Array.<!WebInspector.ConsoleMessage>} */
41 this._messages = []; 42 this._messages = [];
42 /** @type {!Map<number, !WebInspector.ConsoleMessage>} */ 43 /** @type {!Map<number, !WebInspector.ConsoleMessage>} */
43 this._messageByExceptionId = new Map(); 44 this._messageByExceptionId = new Map();
44 this._warnings = 0; 45 this._warnings = 0;
45 this._errors = 0; 46 this._errors = 0;
46 this._revokedErrors = 0; 47 this._revokedErrors = 0;
47 this._logAgent = target.logAgent(); 48 this._logAgent = logAgent;
48 target.registerLogDispatcher(new WebInspector.LogDispatcher(this)); 49 if (this._logAgent) {
49 this._logAgent.enable(); 50 target.registerLogDispatcher(new WebInspector.LogDispatcher(this));
51 this._logAgent.enable();
52 }
50 } 53 }
51 54
52 /** @enum {symbol} */ 55 /** @enum {symbol} */
53 WebInspector.ConsoleModel.Events = { 56 WebInspector.ConsoleModel.Events = {
54 ConsoleCleared: Symbol("ConsoleCleared"), 57 ConsoleCleared: Symbol("ConsoleCleared"),
55 MessageAdded: Symbol("MessageAdded"), 58 MessageAdded: Symbol("MessageAdded"),
56 MessageUpdated: Symbol("MessageUpdated"), 59 MessageUpdated: Symbol("MessageUpdated"),
57 CommandEvaluated: Symbol("CommandEvaluated") 60 CommandEvaluated: Symbol("CommandEvaluated")
58 } 61 }
59 62
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 /** 130 /**
128 * @return {!Array.<!WebInspector.ConsoleMessage>} 131 * @return {!Array.<!WebInspector.ConsoleMessage>}
129 */ 132 */
130 messages: function() 133 messages: function()
131 { 134 {
132 return this._messages; 135 return this._messages;
133 }, 136 },
134 137
135 requestClearMessages: function() 138 requestClearMessages: function()
136 { 139 {
137 this._logAgent.clear(); 140 this._logAgent && this._logAgent.clear();
138 this.clear(); 141 this.clear();
139 }, 142 },
140 143
141 clear: function() 144 clear: function()
142 { 145 {
143 this._messages = []; 146 this._messages = [];
144 this._messageByExceptionId.clear(); 147 this._messageByExceptionId.clear();
145 this._errors = 0; 148 this._errors = 0;
146 this._revokedErrors = 0; 149 this._revokedErrors = 0;
147 this._warnings = 0; 150 this._warnings = 0;
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEv aluated, event.data); 660 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEv aluated, event.data);
658 }, 661 },
659 662
660 __proto__: WebInspector.Object.prototype 663 __proto__: WebInspector.Object.prototype
661 } 664 }
662 665
663 /** 666 /**
664 * @type {!WebInspector.MultitargetConsoleModel} 667 * @type {!WebInspector.MultitargetConsoleModel}
665 */ 668 */
666 WebInspector.multitargetConsoleModel; 669 WebInspector.multitargetConsoleModel;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698