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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/base/load_log.h"
6
7 namespace net {
8
9 LoadLog::LoadLog() {
10 }
11
12 // static
13 const char* LoadLog::EventTypeToString(EventType event) {
14 switch (event) {
15 #define EVENT_TYPE(label) case TYPE_ ## label: return #label;
16 #include "net/base/load_log_event_type_list.h"
17 #undef EVENT_TYPE
18 }
19 return NULL;
20 }
21
22 void LoadLog::Add(base::TimeTicks t, EventType event, EventPhase phase) {
23 // Minor optimization. TODO(eroman): use StackVector instead.
24 if (events_.empty())
25 events_.reserve(kMaxNumEntries / 2);
26
27 // Enforce a bound of kMaxNumEntries -- when we reach it, make it so the
28 // final entry in the list is |TYPE_LOG_TRUNCATED|.
29
30 if (events_.size() + 1 == kMaxNumEntries)
31 events_.push_back(Event(t, TYPE_LOG_TRUNCATED, PHASE_NONE));
32
33 if (events_.size() < kMaxNumEntries)
34 events_.push_back(Event(t, event, phase));
35 }
36
37 } // namespace net
OLDNEW
« 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