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

Unified Diff: chrome/browser/resources/net_internals/capture_view.js

Issue 9585027: Limit the number of captured events held by about:net-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address mmenke comments Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/net_internals/capture_view.js
diff --git a/chrome/browser/resources/net_internals/capture_view.js b/chrome/browser/resources/net_internals/capture_view.js
index 2ac1ffa0b5fa49c73e00a8505c73672a936a8bd4..b79c71d23f32a6c2bfa0e0df2b537201c8201a24 100644
--- a/chrome/browser/resources/net_internals/capture_view.js
+++ b/chrome/browser/resources/net_internals/capture_view.js
@@ -21,8 +21,9 @@ var CaptureView = (function() {
superClass.call(this, CaptureView.MAIN_BOX_ID);
var byteLoggingCheckbox = $(CaptureView.BYTE_LOGGING_CHECKBOX_ID);
- byteLoggingCheckbox.onclick =
- this.onSetByteLogging_.bind(this, byteLoggingCheckbox);
+ byteLoggingCheckbox.onclick = this.onSetByteLogging_.bind(this);
+
+ $(CaptureView.LIMIT_CHECKBOX_ID).onclick = this.onChangeLimit_.bind(this);
$(CaptureView.TIP_ANCHOR_ID).onclick =
this.toggleCommandLineTip_.bind(this, CaptureView.TIP_DIV_ID);
@@ -33,6 +34,8 @@ var CaptureView = (function() {
// be updated.
throw 'Not expecting byte logging to be enabled!';
}
+
+ this.onChangeLimit_();
}
// ID for special HTML element in category_tabs.html
@@ -41,6 +44,7 @@ var CaptureView = (function() {
// IDs for special HTML elements in capture_view.html
CaptureView.MAIN_BOX_ID = 'capture-view-tab-content';
CaptureView.BYTE_LOGGING_CHECKBOX_ID = 'capture-view-byte-logging-checkbox';
+ CaptureView.LIMIT_CHECKBOX_ID = 'capture-view-limit-checkbox';
CaptureView.TIP_ANCHOR_ID = 'capture-view-tip-anchor';
CaptureView.TIP_DIV_ID = 'capture-view-tip-div';
@@ -73,7 +77,9 @@ var CaptureView = (function() {
* Depending on the value of the checkbox, enables or disables logging of
* actual bytes transferred.
*/
- onSetByteLogging_: function(byteLoggingCheckbox) {
+ onSetByteLogging_: function() {
+ var byteLoggingCheckbox = $(CaptureView.BYTE_LOGGING_CHECKBOX_ID);
+
if (byteLoggingCheckbox.checked) {
g_browser.setLogLevel(LogLevelType.LOG_ALL);
@@ -89,7 +95,33 @@ var CaptureView = (function() {
} else {
g_browser.setLogLevel(LogLevelType.LOG_ALL_BUT_BYTES);
}
- }
+ },
+
+ onChangeLimit_: function() {
+ var limitCheckbox = $(CaptureView.LIMIT_CHECKBOX_ID);
+
+ // Default to unlimited.
+ var softLimit = Infinity;
+ var hardLimit = Infinity;
+
+ if (limitCheckbox.checked) {
+ // The chosen limits are kind of arbitrary. I based it off the
+ // following observation:
+ // A user-submitted log file which spanned a 7 hour time period
+ // comprised 778,235 events and required 128MB of JSON.
+ //
+ // That feels too big. Assuming it was representative, then scaling
+ // by a factor of 4 should translate into a 32MB log file and cover
+ // close to 2 hours of events, which feels better.
+ //
+ // A large gap is left between the hardLimit and softLimit to avoid
+ // resetting the events often.
+ hardLimit = 300000;
+ softLimit = 150000;
+ }
+
+ EventsTracker.getInstance().setLimits(softLimit, hardLimit);
+ },
};
return CaptureView;
« no previous file with comments | « chrome/browser/resources/net_internals/capture_view.html ('k') | chrome/browser/resources/net_internals/events_tracker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698