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/capturing_net_log.cc

Issue 4067002: First pass at adding http/backend cache to NetLog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Lint fixes Created 9 years, 11 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/capturing_net_log.h ('k') | net/base/net_log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/capturing_net_log.h" 5 #include "net/base/capturing_net_log.h"
6 6
7 namespace net { 7 namespace net {
8 8
9 CapturingNetLog::Entry::Entry(EventType type, 9 CapturingNetLog::Entry::Entry(EventType type,
10 const base::TimeTicks& time, 10 const base::TimeTicks& time,
11 Source source, 11 Source source,
12 EventPhase phase, 12 EventPhase phase,
13 EventParameters* extra_parameters) 13 EventParameters* extra_parameters)
14 : type(type), time(time), source(source), phase(phase), 14 : type(type), time(time), source(source), phase(phase),
15 extra_parameters(extra_parameters) { 15 extra_parameters(extra_parameters) {
16 } 16 }
17 17
18 CapturingNetLog::Entry::~Entry() {} 18 CapturingNetLog::Entry::~Entry() {}
19 19
20 CapturingNetLog::CapturingNetLog(size_t max_num_entries) 20 CapturingNetLog::CapturingNetLog(size_t max_num_entries)
21 : last_id_(-1), max_num_entries_(max_num_entries) { 21 : last_id_(-1),
22 max_num_entries_(max_num_entries),
23 log_level_(LOG_ALL_BUT_BYTES) {
22 } 24 }
23 25
24 CapturingNetLog::~CapturingNetLog() {} 26 CapturingNetLog::~CapturingNetLog() {}
25 27
26 void CapturingNetLog::AddEntry(EventType type, 28 void CapturingNetLog::AddEntry(EventType type,
27 const base::TimeTicks& time, 29 const base::TimeTicks& time,
28 const Source& source, 30 const Source& source,
29 EventPhase phase, 31 EventPhase phase,
30 EventParameters* extra_parameters) { 32 EventParameters* extra_parameters) {
31 AutoLock lock(lock_); 33 AutoLock lock(lock_);
32 Entry entry(type, time, source, phase, extra_parameters); 34 Entry entry(type, time, source, phase, extra_parameters);
33 if (entries_.size() + 1 < max_num_entries_) 35 if (entries_.size() + 1 < max_num_entries_)
34 entries_.push_back(entry); 36 entries_.push_back(entry);
35 } 37 }
36 38
37 uint32 CapturingNetLog::NextID() { 39 uint32 CapturingNetLog::NextID() {
38 return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1); 40 return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1);
39 } 41 }
40 42
41 NetLog::LogLevel CapturingNetLog::GetLogLevel() const { 43 NetLog::LogLevel CapturingNetLog::GetLogLevel() const {
42 return LOG_ALL_BUT_BYTES; 44 AutoLock lock(lock_);
45 return log_level_;
43 } 46 }
44 47
45 void CapturingNetLog::GetEntries(EntryList* entry_list) const { 48 void CapturingNetLog::GetEntries(EntryList* entry_list) const {
46 AutoLock lock(lock_); 49 AutoLock lock(lock_);
47 *entry_list = entries_; 50 *entry_list = entries_;
48 } 51 }
49 52
50 void CapturingNetLog::Clear() { 53 void CapturingNetLog::Clear() {
51 AutoLock lock(lock_); 54 AutoLock lock(lock_);
52 entries_.clear(); 55 entries_.clear();
53 } 56 }
54 57
58 void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
59 AutoLock lock(lock_);
60 log_level_ = log_level;
61 }
62
55 CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source, 63 CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source,
56 CapturingNetLog* net_log) 64 CapturingNetLog* net_log)
57 : source_(source), capturing_net_log_(net_log) { 65 : source_(source), capturing_net_log_(net_log) {
58 } 66 }
59 67
60 CapturingBoundNetLog::CapturingBoundNetLog(size_t max_num_entries) 68 CapturingBoundNetLog::CapturingBoundNetLog(size_t max_num_entries)
61 : capturing_net_log_(new CapturingNetLog(max_num_entries)) {} 69 : capturing_net_log_(new CapturingNetLog(max_num_entries)) {}
62 70
63 CapturingBoundNetLog::~CapturingBoundNetLog() {} 71 CapturingBoundNetLog::~CapturingBoundNetLog() {}
64 72
65 void CapturingBoundNetLog::GetEntries( 73 void CapturingBoundNetLog::GetEntries(
66 CapturingNetLog::EntryList* entry_list) const { 74 CapturingNetLog::EntryList* entry_list) const {
67 capturing_net_log_->GetEntries(entry_list); 75 capturing_net_log_->GetEntries(entry_list);
68 } 76 }
69 77
70 void CapturingBoundNetLog::Clear() { 78 void CapturingBoundNetLog::Clear() {
71 capturing_net_log_->Clear(); 79 capturing_net_log_->Clear();
72 } 80 }
73 81
82 void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) {
83 capturing_net_log_->SetLogLevel(log_level);
84 }
85
74 } // namespace net 86 } // namespace net
OLDNEW
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698