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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 }; | 63 }; |
64 | 64 |
65 // Identifies the entity that generated this log. The |id| field should | 65 // Identifies the entity that generated this log. The |id| field should |
66 // uniquely identify the source, and is used by log observers to infer | 66 // uniquely identify the source, and is used by log observers to infer |
67 // message groupings. Can use NetLog::NextID() to create unique IDs. | 67 // message groupings. Can use NetLog::NextID() to create unique IDs. |
68 struct Source { | 68 struct Source { |
69 static const uint32 kInvalidId = 0; | 69 static const uint32 kInvalidId = 0; |
70 | 70 |
71 Source() : type(SOURCE_NONE), id(kInvalidId) {} | 71 Source() : type(SOURCE_NONE), id(kInvalidId) {} |
72 Source(SourceType type, uint32 id) : type(type), id(id) {} | 72 Source(SourceType type, uint32 id) : type(type), id(id) {} |
73 bool is_valid() { return id != kInvalidId; } | 73 bool is_valid() const { return id != kInvalidId; } |
| 74 |
| 75 // The caller takes ownership of the returned Value*. |
| 76 Value* ToValue() const; |
74 | 77 |
75 SourceType type; | 78 SourceType type; |
76 uint32 id; | 79 uint32 id; |
77 }; | 80 }; |
78 | 81 |
79 // Base class for associating additional parameters with an event. Log | 82 // Base class for associating additional parameters with an event. Log |
80 // observers need to know what specific derivations of EventParameters a | 83 // observers need to know what specific derivations of EventParameters a |
81 // particular EventType uses, in order to get at the individual components. | 84 // particular EventType uses, in order to get at the individual components. |
82 class EventParameters : public base::RefCounted<EventParameters> { | 85 class EventParameters : public base::RefCounted<EventParameters> { |
83 public: | 86 public: |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 virtual Value* ToValue() const; | 244 virtual Value* ToValue() const; |
242 | 245 |
243 private: | 246 private: |
244 const char* name_; | 247 const char* name_; |
245 const NetLog::Source value_; | 248 const NetLog::Source value_; |
246 }; | 249 }; |
247 | 250 |
248 } // namespace net | 251 } // namespace net |
249 | 252 |
250 #endif // NET_BASE_NET_LOG_H_ | 253 #endif // NET_BASE_NET_LOG_H_ |
OLD | NEW |