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

Side by Side Diff: net/base/capturing_net_log.cc

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h 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/cert_database_mac.cc » ('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), 21 : last_id_(-1),
22 max_num_entries_(max_num_entries), 22 max_num_entries_(max_num_entries),
23 log_level_(LOG_ALL_BUT_BYTES) { 23 log_level_(LOG_ALL_BUT_BYTES) {
24 } 24 }
25 25
26 CapturingNetLog::~CapturingNetLog() {} 26 CapturingNetLog::~CapturingNetLog() {}
27 27
28 void CapturingNetLog::GetEntries(EntryList* entry_list) const { 28 void CapturingNetLog::GetEntries(EntryList* entry_list) const {
29 AutoLock lock(lock_); 29 base::AutoLock lock(lock_);
30 *entry_list = entries_; 30 *entry_list = entries_;
31 } 31 }
32 32
33 void CapturingNetLog::Clear() { 33 void CapturingNetLog::Clear() {
34 AutoLock lock(lock_); 34 base::AutoLock lock(lock_);
35 entries_.clear(); 35 entries_.clear();
36 } 36 }
37 37
38 void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) { 38 void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
39 AutoLock lock(lock_); 39 base::AutoLock lock(lock_);
40 log_level_ = log_level; 40 log_level_ = log_level;
41 } 41 }
42 42
43 void CapturingNetLog::AddEntry(EventType type, 43 void CapturingNetLog::AddEntry(EventType type,
44 const base::TimeTicks& time, 44 const base::TimeTicks& time,
45 const Source& source, 45 const Source& source,
46 EventPhase phase, 46 EventPhase phase,
47 EventParameters* extra_parameters) { 47 EventParameters* extra_parameters) {
48 AutoLock lock(lock_); 48 base::AutoLock lock(lock_);
49 Entry entry(type, time, source, phase, extra_parameters); 49 Entry entry(type, time, source, phase, extra_parameters);
50 if (entries_.size() + 1 < max_num_entries_) 50 if (entries_.size() + 1 < max_num_entries_)
51 entries_.push_back(entry); 51 entries_.push_back(entry);
52 } 52 }
53 53
54 uint32 CapturingNetLog::NextID() { 54 uint32 CapturingNetLog::NextID() {
55 return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1); 55 return base::subtle::NoBarrier_AtomicIncrement(&last_id_, 1);
56 } 56 }
57 57
58 NetLog::LogLevel CapturingNetLog::GetLogLevel() const { 58 NetLog::LogLevel CapturingNetLog::GetLogLevel() const {
59 AutoLock lock(lock_); 59 base::AutoLock lock(lock_);
60 return log_level_; 60 return log_level_;
61 } 61 }
62 62
63 CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source, 63 CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source,
64 CapturingNetLog* net_log) 64 CapturingNetLog* net_log)
65 : source_(source), capturing_net_log_(net_log) { 65 : source_(source), capturing_net_log_(net_log) {
66 } 66 }
67 67
68 CapturingBoundNetLog::CapturingBoundNetLog(size_t max_num_entries) 68 CapturingBoundNetLog::CapturingBoundNetLog(size_t max_num_entries)
69 : capturing_net_log_(new CapturingNetLog(max_num_entries)) {} 69 : capturing_net_log_(new CapturingNetLog(max_num_entries)) {}
70 70
71 CapturingBoundNetLog::~CapturingBoundNetLog() {} 71 CapturingBoundNetLog::~CapturingBoundNetLog() {}
72 72
73 void CapturingBoundNetLog::GetEntries( 73 void CapturingBoundNetLog::GetEntries(
74 CapturingNetLog::EntryList* entry_list) const { 74 CapturingNetLog::EntryList* entry_list) const {
75 capturing_net_log_->GetEntries(entry_list); 75 capturing_net_log_->GetEntries(entry_list);
76 } 76 }
77 77
78 void CapturingBoundNetLog::Clear() { 78 void CapturingBoundNetLog::Clear() {
79 capturing_net_log_->Clear(); 79 capturing_net_log_->Clear();
80 } 80 }
81 81
82 void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) { 82 void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) {
83 capturing_net_log_->SetLogLevel(log_level); 83 capturing_net_log_->SetLogLevel(log_level);
84 } 84 }
85 85
86 } // namespace net 86 } // namespace net
OLDNEW
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/cert_database_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698