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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 2474073005: DevTools: add the logging aspect into the PerformanceMonitor (Closed)
Patch Set: test fixed Created 4 years, 1 month 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 * @param {!WebInspector.ConsoleViewMessage} viewMessage 504 * @param {!WebInspector.ConsoleViewMessage} viewMessage
505 */ 505 */
506 _consoleMessageAddedForTest(viewMessage) { 506 _consoleMessageAddedForTest(viewMessage) {
507 } 507 }
508 508
509 /** 509 /**
510 * @param {!WebInspector.ConsoleViewMessage} viewMessage 510 * @param {!WebInspector.ConsoleViewMessage} viewMessage
511 */ 511 */
512 _appendMessageToEnd(viewMessage) { 512 _appendMessageToEnd(viewMessage) {
513 if (!this._filter.shouldBeVisible(viewMessage)) { 513 if (!this._filter.shouldBeVisible(viewMessage)) {
514 this._hiddenByFilterCount++; 514 if (this._filter.shouldBeVisibleByDefault(viewMessage))
515 this._hiddenByFilterCount++;
515 return; 516 return;
516 } 517 }
517 518
518 if (this._tryToCollapseMessages(viewMessage, this._visibleViewMessages.peekL ast())) 519 if (this._tryToCollapseMessages(viewMessage, this._visibleViewMessages.peekL ast()))
519 return; 520 return;
520 521
521 var lastMessage = this._visibleViewMessages.peekLast(); 522 var lastMessage = this._visibleViewMessages.peekLast();
522 if (viewMessage.consoleMessage().type === WebInspector.ConsoleMessage.Messag eType.EndGroup) { 523 if (viewMessage.consoleMessage().type === WebInspector.ConsoleMessage.Messag eType.EndGroup) {
523 if (lastMessage && !this._currentGroup.messagesHidden()) 524 if (lastMessage && !this._currentGroup.messagesHidden())
524 lastMessage.incrementCloseGroupDecorationCount(); 525 lastMessage.incrementCloseGroupDecorationCount();
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 this._messageURLFilters = this._messageURLFiltersSetting.get(); 1064 this._messageURLFilters = this._messageURLFiltersSetting.get();
1064 this._filterChanged = this.dispatchEventToListeners.bind(this, WebInspector. ConsoleViewFilter.Events.FilterChanged); 1065 this._filterChanged = this.dispatchEventToListeners.bind(this, WebInspector. ConsoleViewFilter.Events.FilterChanged);
1065 } 1066 }
1066 1067
1067 addFilters(filterBar) { 1068 addFilters(filterBar) {
1068 this._textFilterUI = new WebInspector.TextFilterUI(true); 1069 this._textFilterUI = new WebInspector.TextFilterUI(true);
1069 this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChang ed, this._textFilterChanged, this); 1070 this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChang ed, this._textFilterChanged, this);
1070 filterBar.addFilter(this._textFilterUI); 1071 filterBar.addFilter(this._textFilterUI);
1071 1072
1072 this._hideNetworkMessagesCheckbox = new WebInspector.CheckboxFilterUI( 1073 this._hideNetworkMessagesCheckbox = new WebInspector.CheckboxFilterUI(
1073 'hide-network-messages', WebInspector.UIString('Hide network messages'), true, 1074 '', WebInspector.UIString('Hide network'), true,
1074 WebInspector.moduleSetting('hideNetworkMessages')); 1075 WebInspector.moduleSetting('hideNetworkMessages'));
1075 this._hideNetworkMessagesCheckbox.addEventListener( 1076 this._hideViolationMessagesCheckbox = new WebInspector.CheckboxFilterUI(
1076 WebInspector.FilterUI.Events.FilterChanged, this._filterChanged.bind(thi s), this); 1077 '', WebInspector.UIString('Hide violations'), false,
1078 WebInspector.moduleSetting('hideViolationMessages'));
1079 WebInspector.moduleSetting('hideNetworkMessages').addChangeListener(this._fi lterChanged, this);
1080 WebInspector.moduleSetting('hideViolationMessages').addChangeListener(this._ filterChanged, this);
1077 filterBar.addFilter(this._hideNetworkMessagesCheckbox); 1081 filterBar.addFilter(this._hideNetworkMessagesCheckbox);
1082 filterBar.addFilter(this._hideViolationMessagesCheckbox);
1078 1083
1079 var levels = [ 1084 var levels = [
1080 {name: WebInspector.ConsoleMessage.MessageLevel.Error, label: WebInspector .UIString('Errors')}, 1085 {name: WebInspector.ConsoleMessage.MessageLevel.Error, label: WebInspector .UIString('Errors')},
1081 {name: WebInspector.ConsoleMessage.MessageLevel.Warning, label: WebInspect or.UIString('Warnings')}, 1086 {name: WebInspector.ConsoleMessage.MessageLevel.Warning, label: WebInspect or.UIString('Warnings')},
1082 {name: WebInspector.ConsoleMessage.MessageLevel.Info, label: WebInspector. UIString('Info')}, 1087 {name: WebInspector.ConsoleMessage.MessageLevel.Info, label: WebInspector. UIString('Info')},
1083 {name: WebInspector.ConsoleMessage.MessageLevel.Log, label: WebInspector.U IString('Logs')}, 1088 {name: WebInspector.ConsoleMessage.MessageLevel.Log, label: WebInspector.U IString('Logs')},
1084 {name: WebInspector.ConsoleMessage.MessageLevel.Debug, label: WebInspector .UIString('Debug')}, 1089 {name: WebInspector.ConsoleMessage.MessageLevel.Debug, label: WebInspector .UIString('Debug')},
1085 {name: WebInspector.ConsoleMessage.MessageLevel.RevokedError, label: WebIn spector.UIString('Handled')} 1090 {name: WebInspector.ConsoleMessage.MessageLevel.RevokedError, label: WebIn spector.UIString('Handled')}
1086 ]; 1091 ];
1087 this._levelFilterUI = new WebInspector.NamedBitSetFilterUI(levels, this._mes sageLevelFiltersSetting); 1092 this._levelFilterUI = new WebInspector.NamedBitSetFilterUI(levels, this._mes sageLevelFiltersSetting);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 return false; 1144 return false;
1140 if (message.executionContextId && message.executionContextId !== execution Context.id) { 1145 if (message.executionContextId && message.executionContextId !== execution Context.id) {
1141 return false; 1146 return false;
1142 } 1147 }
1143 } 1148 }
1144 1149
1145 if (WebInspector.moduleSetting('hideNetworkMessages').get() && 1150 if (WebInspector.moduleSetting('hideNetworkMessages').get() &&
1146 viewMessage.consoleMessage().source === WebInspector.ConsoleMessage.Mess ageSource.Network) 1151 viewMessage.consoleMessage().source === WebInspector.ConsoleMessage.Mess ageSource.Network)
1147 return false; 1152 return false;
1148 1153
1154 if (WebInspector.moduleSetting('hideViolationMessages').get() &&
1155 viewMessage.consoleMessage().source === WebInspector.ConsoleMessage.Mess ageSource.Violation)
1156 return false;
1157
1149 if (viewMessage.consoleMessage().isGroupMessage()) 1158 if (viewMessage.consoleMessage().isGroupMessage())
1150 return true; 1159 return true;
1151 1160
1152 if (message.type === WebInspector.ConsoleMessage.MessageType.Result || 1161 if (message.type === WebInspector.ConsoleMessage.MessageType.Result ||
1153 message.type === WebInspector.ConsoleMessage.MessageType.Command) 1162 message.type === WebInspector.ConsoleMessage.MessageType.Command)
1154 return true; 1163 return true;
1155 1164
1156 if (message.url && this._messageURLFilters[message.url]) 1165 if (message.url && this._messageURLFilters[message.url])
1157 return false; 1166 return false;
1158 1167
1159 if (message.level && !this._levelFilterUI.accept(message.level)) 1168 if (message.level && !this._levelFilterUI.accept(message.level))
1160 return false; 1169 return false;
1161 1170
1162 if (this._filterRegex) { 1171 if (this._filterRegex) {
1163 this._filterRegex.lastIndex = 0; 1172 this._filterRegex.lastIndex = 0;
1164 if (!viewMessage.matchesFilterRegex(this._filterRegex)) 1173 if (!viewMessage.matchesFilterRegex(this._filterRegex))
1165 return false; 1174 return false;
1166 } 1175 }
1167 1176
1168 return true; 1177 return true;
1169 } 1178 }
1170 1179
1180 /**
1181 * @return {boolean}
1182 */
1183 shouldBeVisibleByDefault(viewMessage) {
1184 return viewMessage.consoleMessage().source !==
1185 WebInspector.ConsoleMessage.MessageSource.Violation;
1186 }
1187
1171 reset() { 1188 reset() {
1172 this._messageURLFilters = {}; 1189 this._messageURLFilters = {};
1173 this._messageURLFiltersSetting.set(this._messageURLFilters); 1190 this._messageURLFiltersSetting.set(this._messageURLFilters);
1174 this._messageLevelFiltersSetting.set({}); 1191 this._messageLevelFiltersSetting.set({});
1175 this._view._showAllMessagesCheckbox.inputElement.checked = true; 1192 this._view._showAllMessagesCheckbox.inputElement.checked = true;
1176 WebInspector.moduleSetting('hideNetworkMessages').set(false); 1193 WebInspector.moduleSetting('hideNetworkMessages').set(false);
1194 WebInspector.moduleSetting('hideViolationMessages').set(true);
1177 this._textFilterUI.setValue(''); 1195 this._textFilterUI.setValue('');
1178 this._filterChanged(); 1196 this._filterChanged();
1179 } 1197 }
1180 }; 1198 };
1181 1199
1182 /** @enum {symbol} */ 1200 /** @enum {symbol} */
1183 WebInspector.ConsoleViewFilter.Events = { 1201 WebInspector.ConsoleViewFilter.Events = {
1184 FilterChanged: Symbol('FilterChanged') 1202 FilterChanged: Symbol('FilterChanged')
1185 }; 1203 };
1186 1204
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 return true; 1344 return true;
1327 } 1345 }
1328 return false; 1346 return false;
1329 } 1347 }
1330 }; 1348 };
1331 1349
1332 /** 1350 /**
1333 * @typedef {{messageIndex: number, matchIndex: number}} 1351 * @typedef {{messageIndex: number, matchIndex: number}}
1334 */ 1352 */
1335 WebInspector.ConsoleView.RegexMatchRange; 1353 WebInspector.ConsoleView.RegexMatchRange;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698