| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // NetLog is the destination for log messages generated by the network stack. | 23 // NetLog is the destination for log messages generated by the network stack. |
| 24 // Each log message has a "source" field which identifies the specific entity | 24 // Each log message has a "source" field which identifies the specific entity |
| 25 // that generated the message (for example, which URLRequest or which | 25 // that generated the message (for example, which URLRequest or which |
| 26 // SocketStream). | 26 // SocketStream). |
| 27 // | 27 // |
| 28 // To avoid needing to pass in the "source id" to the logging functions, NetLog | 28 // To avoid needing to pass in the "source id" to the logging functions, NetLog |
| 29 // is usually accessed through a BoundNetLog, which will always pass in a | 29 // is usually accessed through a BoundNetLog, which will always pass in a |
| 30 // specific source ID. | 30 // specific source ID. |
| 31 // | 31 // |
| 32 // Note that NetLog is NOT THREADSAFE. | |
| 33 // | |
| 34 // ******** The NetLog (and associated logging) is a work in progress ******** | 32 // ******** The NetLog (and associated logging) is a work in progress ******** |
| 35 // | 33 // |
| 36 // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. | 34 // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. |
| 37 // TODO(eroman): Make the DNS jobs emit into the NetLog. | |
| 38 // TODO(eroman): Start a new Source each time URLRequest redirects | 35 // TODO(eroman): Start a new Source each time URLRequest redirects |
| 39 // (simpler to reason about each as a separate entity). | 36 // (simpler to reason about each as a separate entity). |
| 40 | 37 |
| 41 class NetLog { | 38 class NetLog { |
| 42 public: | 39 public: |
| 43 enum EventType { | 40 enum EventType { |
| 44 #define EVENT_TYPE(label) TYPE_ ## label, | 41 #define EVENT_TYPE(label) TYPE_ ## label, |
| 45 #include "net/base/net_log_event_type_list.h" | 42 #include "net/base/net_log_event_type_list.h" |
| 46 #undef EVENT_TYPE | 43 #undef EVENT_TYPE |
| 47 }; | 44 }; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 74 // The caller takes ownership of the returned Value*. | 71 // The caller takes ownership of the returned Value*. |
| 75 Value* ToValue() const; | 72 Value* ToValue() const; |
| 76 | 73 |
| 77 SourceType type; | 74 SourceType type; |
| 78 uint32 id; | 75 uint32 id; |
| 79 }; | 76 }; |
| 80 | 77 |
| 81 // Base class for associating additional parameters with an event. Log | 78 // Base class for associating additional parameters with an event. Log |
| 82 // observers need to know what specific derivations of EventParameters a | 79 // observers need to know what specific derivations of EventParameters a |
| 83 // particular EventType uses, in order to get at the individual components. | 80 // particular EventType uses, in order to get at the individual components. |
| 84 class EventParameters : public base::RefCounted<EventParameters> { | 81 class EventParameters : public base::RefCountedThreadSafe<EventParameters> { |
| 85 public: | 82 public: |
| 86 EventParameters() {} | 83 EventParameters() {} |
| 87 virtual ~EventParameters() {} | 84 virtual ~EventParameters() {} |
| 88 | 85 |
| 89 // Serializes the parameters to a Value tree. This is intended to be a | 86 // Serializes the parameters to a Value tree. This is intended to be a |
| 90 // lossless conversion, which is used to serialize the parameters to JSON. | 87 // lossless conversion, which is used to serialize the parameters to JSON. |
| 91 // The caller takes ownership of the returned Value*. | 88 // The caller takes ownership of the returned Value*. |
| 92 virtual Value* ToValue() const = 0; | 89 virtual Value* ToValue() const = 0; |
| 93 | 90 |
| 94 private: | 91 private: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 virtual Value* ToValue() const; | 266 virtual Value* ToValue() const; |
| 270 | 267 |
| 271 private: | 268 private: |
| 272 const char* name_; | 269 const char* name_; |
| 273 const NetLog::Source value_; | 270 const NetLog::Source value_; |
| 274 }; | 271 }; |
| 275 | 272 |
| 276 } // namespace net | 273 } // namespace net |
| 277 | 274 |
| 278 #endif // NET_BASE_NET_LOG_H_ | 275 #endif // NET_BASE_NET_LOG_H_ |
| OLD | NEW |