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 #ifndef NET_BASE_NET_LOG_H_ | 5 #ifndef NET_BASE_NET_LOG_H_ |
6 #define NET_BASE_NET_LOG_H_ | 6 #define NET_BASE_NET_LOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // The 'phase' of an event trace (whether it marks the beginning or end | 46 // The 'phase' of an event trace (whether it marks the beginning or end |
47 // of an event.). | 47 // of an event.). |
48 enum EventPhase { | 48 enum EventPhase { |
49 PHASE_NONE, | 49 PHASE_NONE, |
50 PHASE_BEGIN, | 50 PHASE_BEGIN, |
51 PHASE_END, | 51 PHASE_END, |
52 }; | 52 }; |
53 | 53 |
54 // The "source" identifies the entity that generated the log message. | 54 // The "source" identifies the entity that generated the log message. |
55 enum SourceType { | 55 enum SourceType { |
56 #define SOURCE_TYPE(label) SOURCE_ ## label, | 56 #define SOURCE_TYPE(label, value) SOURCE_ ## label = value, |
57 #include "net/base/net_log_source_type_list.h" | 57 #include "net/base/net_log_source_type_list.h" |
58 #undef SOURCE_TYPE | 58 #undef SOURCE_TYPE |
59 }; | 59 }; |
60 | 60 |
61 // Identifies the entity that generated this log. The |id| field should | 61 // Identifies the entity that generated this log. The |id| field should |
62 // uniquely identify the source, and is used by log observers to infer | 62 // uniquely identify the source, and is used by log observers to infer |
63 // message groupings. Can use NetLog::NextID() to create unique IDs. | 63 // message groupings. Can use NetLog::NextID() to create unique IDs. |
64 struct Source { | 64 struct Source { |
65 static const uint32 kInvalidId = 0; | 65 static const uint32 kInvalidId = 0; |
66 | 66 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 return value_; | 199 return value_; |
200 } | 200 } |
201 | 201 |
202 virtual Value* ToValue() const; | 202 virtual Value* ToValue() const; |
203 | 203 |
204 private: | 204 private: |
205 const char* name_; | 205 const char* name_; |
206 const int value_; | 206 const int value_; |
207 }; | 207 }; |
208 | 208 |
| 209 // NetLogSourceParameter is a subclass of EventParameters that encapsulates a |
| 210 // single NetLog::Source parameter. |
| 211 class NetLogSourceParameter : public NetLog::EventParameters { |
| 212 public: |
| 213 // |name| must be a string literal. |
| 214 NetLogSourceParameter(const char* name, const NetLog::Source& value) |
| 215 : name_(name), value_(value) {} |
| 216 |
| 217 const NetLog::Source& value() const { |
| 218 return value_; |
| 219 } |
| 220 |
| 221 virtual Value* ToValue() const; |
| 222 |
| 223 private: |
| 224 const char* name_; |
| 225 const NetLog::Source value_; |
| 226 }; |
| 227 |
209 } // namespace net | 228 } // namespace net |
210 | 229 |
211 #endif // NET_BASE_NET_LOG_H_ | 230 #endif // NET_BASE_NET_LOG_H_ |
OLD | NEW |