OLD | NEW |
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/net_log.h" | 5 #include "net/base/net_log.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 AddEntry(event_type, NetLog::PHASE_BEGIN, params); | 79 AddEntry(event_type, NetLog::PHASE_BEGIN, params); |
80 } | 80 } |
81 | 81 |
82 void BoundNetLog::BeginEventWithString(NetLog::EventType event_type, | 82 void BoundNetLog::BeginEventWithString(NetLog::EventType event_type, |
83 const std::string& string) const { | 83 const std::string& string) const { |
84 scoped_refptr<NetLog::EventParameters> params = | 84 scoped_refptr<NetLog::EventParameters> params = |
85 new NetLogStringParameter(string); | 85 new NetLogStringParameter(string); |
86 BeginEventWithParameters(event_type, params); | 86 BeginEventWithParameters(event_type, params); |
87 } | 87 } |
88 | 88 |
| 89 void BoundNetLog::BeginEventWithInteger(NetLog::EventType event_type, |
| 90 int integer) const { |
| 91 scoped_refptr<NetLog::EventParameters> params = |
| 92 new NetLogIntegerParameter(integer); |
| 93 BeginEventWithParameters(event_type, params); |
| 94 } |
| 95 |
89 void BoundNetLog::EndEvent(NetLog::EventType event_type) const { | 96 void BoundNetLog::EndEvent(NetLog::EventType event_type) const { |
90 EndEventWithParameters(event_type, NULL); | 97 EndEventWithParameters(event_type, NULL); |
91 } | 98 } |
92 | 99 |
93 void BoundNetLog::EndEventWithParameters( | 100 void BoundNetLog::EndEventWithParameters( |
94 NetLog::EventType event_type, | 101 NetLog::EventType event_type, |
95 NetLog::EventParameters* params) const { | 102 NetLog::EventParameters* params) const { |
96 AddEntry(event_type, NetLog::PHASE_END, params); | 103 AddEntry(event_type, NetLog::PHASE_END, params); |
97 } | 104 } |
98 | 105 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void CapturingNetLog::AddEntry(EventType type, | 153 void CapturingNetLog::AddEntry(EventType type, |
147 const base::TimeTicks& time, | 154 const base::TimeTicks& time, |
148 const Source& source, | 155 const Source& source, |
149 EventPhase phase, | 156 EventPhase phase, |
150 EventParameters* extra_parameters) { | 157 EventParameters* extra_parameters) { |
151 Entry entry(type, time, source, phase, extra_parameters); | 158 Entry entry(type, time, source, phase, extra_parameters); |
152 if (entries_.size() + 1 < max_num_entries_) | 159 if (entries_.size() + 1 < max_num_entries_) |
153 entries_.push_back(entry); | 160 entries_.push_back(entry); |
154 } | 161 } |
155 | 162 |
156 int CapturingNetLog::NextID() { | 163 uint32 CapturingNetLog::NextID() { |
157 return next_id_++; | 164 return next_id_++; |
158 } | 165 } |
159 | 166 |
160 void CapturingNetLog::Clear() { | 167 void CapturingNetLog::Clear() { |
161 entries_.clear(); | 168 entries_.clear(); |
162 } | 169 } |
163 | 170 |
164 void CapturingBoundNetLog::Clear() { | 171 void CapturingBoundNetLog::Clear() { |
165 capturing_net_log_->Clear(); | 172 capturing_net_log_->Clear(); |
166 } | 173 } |
167 | 174 |
168 void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const { | 175 void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const { |
169 for (size_t i = 0; i < entries().size(); ++i) { | 176 for (size_t i = 0; i < entries().size(); ++i) { |
170 const CapturingNetLog::Entry& entry = entries()[i]; | 177 const CapturingNetLog::Entry& entry = entries()[i]; |
171 net_log.AddEntryWithTime(entry.type, entry.time, entry.phase, | 178 net_log.AddEntryWithTime(entry.type, entry.time, entry.phase, |
172 entry.extra_parameters); | 179 entry.extra_parameters); |
173 } | 180 } |
174 } | 181 } |
175 | 182 |
176 } // namespace net | 183 } // namespace net |
OLD | NEW |