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 | 7 |
8 namespace net { | 8 namespace net { |
9 | 9 |
10 // static | 10 // static |
11 const char* NetLog::EventTypeToString(EventType event) { | 11 const char* NetLog::EventTypeToString(EventType event) { |
12 switch (event) { | 12 switch (event) { |
13 #define EVENT_TYPE(label) case TYPE_ ## label: return #label; | 13 #define EVENT_TYPE(label) case TYPE_ ## label: return #label; |
14 #include "net/base/net_log_event_type_list.h" | 14 #include "net/base/net_log_event_type_list.h" |
15 #undef EVENT_TYPE | 15 #undef EVENT_TYPE |
16 } | 16 } |
17 return NULL; | 17 return NULL; |
18 } | 18 } |
19 | 19 |
| 20 // static |
| 21 std::vector<NetLog::EventType> NetLog::GetAllEventTypes() { |
| 22 std::vector<NetLog::EventType> types; |
| 23 #define EVENT_TYPE(label) types.push_back(TYPE_ ## label); |
| 24 #include "net/base/net_log_event_type_list.h" |
| 25 #undef EVENT_TYPE |
| 26 return types; |
| 27 } |
| 28 |
20 void BoundNetLog::AddEntry(const NetLog::Entry& entry) const { | 29 void BoundNetLog::AddEntry(const NetLog::Entry& entry) const { |
21 if (net_log_) | 30 if (net_log_) |
22 net_log_->AddEntry(entry); | 31 net_log_->AddEntry(entry); |
23 } | 32 } |
24 | 33 |
25 bool BoundNetLog::HasListener() const { | 34 bool BoundNetLog::HasListener() const { |
26 if (net_log_) | 35 if (net_log_) |
27 return net_log_->HasListener(); | 36 return net_log_->HasListener(); |
28 return false; | 37 return false; |
29 } | 38 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 154 |
146 void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const { | 155 void CapturingBoundNetLog::AppendTo(const BoundNetLog& net_log) const { |
147 for (size_t i = 0; i < entries().size(); ++i) { | 156 for (size_t i = 0; i < entries().size(); ++i) { |
148 NetLog::Entry entry = entries()[i]; | 157 NetLog::Entry entry = entries()[i]; |
149 entry.source = net_log.source(); | 158 entry.source = net_log.source(); |
150 net_log.AddEntry(entry); | 159 net_log.AddEntry(entry); |
151 } | 160 } |
152 } | 161 } |
153 | 162 |
154 } // namespace net | 163 } // namespace net |
OLD | NEW |