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

Unified Diff: net/base/load_log.h

Issue 363025: Improve the display of LoadLogs when truncation occurs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Change -1 to be a constant instead Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/host_resolver_impl_unittest.cc ('k') | net/base/load_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/load_log.h
===================================================================
--- net/base/load_log.h (revision 31195)
+++ net/base/load_log.h (working copy)
@@ -19,7 +19,6 @@
// that it can be AddRef() / Release() across threads.
class LoadLog : public base::RefCountedThreadSafe<LoadLog> {
public:
-
enum EventType {
#define EVENT_TYPE(label) TYPE_ ## label,
#include "net/base/load_log_event_type_list.h"
@@ -48,18 +47,20 @@
EventPhase phase;
};
- // The maximum size of |events_|.
- enum { kMaxNumEntries = 40 };
-
// Ordered set of events that were logged.
// TODO(eroman): use a StackVector or array to avoid allocations.
typedef std::vector<Event> EventList;
- // Create a log, which can hold up to |kMaxNumEntries| Events.
+ // Value for max_num_entries to indicate the LoadLog has no size limit.
+ static const size_t kUnbounded = static_cast<size_t>(-1);
+
+ // Creates a log, which can hold up to |max_num_entries| Events.
+ // If |max_num_entries| is |kUnbounded|, then the log can grow arbitrarily
+ // large.
//
- // If events are dropped because the log has grown too large, the final
- // entry will be of type kLogTruncated.
- LoadLog();
+ // If events are dropped because the log has grown too large, the final entry
+ // will be overwritten.
+ explicit LoadLog(size_t max_num_entries);
// --------------------------------------------------------------------------
@@ -93,6 +94,17 @@
return events_;
}
+ // Returns the number of entries that were dropped from the log because the
+ // maximum size had been reached.
+ size_t num_entries_truncated() const {
+ return num_entries_truncated_;
+ }
+
+ // Returns the bound on the size of the log.
+ size_t max_num_entries() const {
+ return max_num_entries_;
+ }
+
// Returns a C-String symbolic name for |event|.
static const char* EventTypeToString(EventType event);
@@ -111,6 +123,8 @@
~LoadLog() {}
EventList events_;
+ size_t num_entries_truncated_;
+ size_t max_num_entries_;;
};
} // namespace net
« no previous file with comments | « net/base/host_resolver_impl_unittest.cc ('k') | net/base/load_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698