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

Unified Diff: net/base/load_log.cc

Issue 165404: Implement LoadLog, and hook up HostResolverImpl to LoadLog.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Do an unsigned/signed thing for GCC compile Created 11 years, 4 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
« no previous file with comments | « net/base/load_log.h ('k') | net/base/load_log_event_type_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/load_log.cc
===================================================================
--- net/base/load_log.cc (revision 0)
+++ net/base/load_log.cc (revision 0)
@@ -0,0 +1,37 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/load_log.h"
+
+namespace net {
+
+LoadLog::LoadLog() {
+}
+
+// static
+const char* LoadLog::EventTypeToString(EventType event) {
+ switch (event) {
+#define EVENT_TYPE(label) case TYPE_ ## label: return #label;
+#include "net/base/load_log_event_type_list.h"
+#undef EVENT_TYPE
+ }
+ return NULL;
+}
+
+void LoadLog::Add(base::TimeTicks t, EventType event, EventPhase phase) {
+ // Minor optimization. TODO(eroman): use StackVector instead.
+ if (events_.empty())
+ events_.reserve(kMaxNumEntries / 2);
+
+ // Enforce a bound of kMaxNumEntries -- when we reach it, make it so the
+ // final entry in the list is |TYPE_LOG_TRUNCATED|.
+
+ if (events_.size() + 1 == kMaxNumEntries)
+ events_.push_back(Event(t, TYPE_LOG_TRUNCATED, PHASE_NONE));
+
+ if (events_.size() < kMaxNumEntries)
+ events_.push_back(Event(t, event, phase));
+}
+
+} // namespace net
Property changes on: net\base\load_log.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « net/base/load_log.h ('k') | net/base/load_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698