| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 | 14 |
| 15 class Value; | 15 class Value; |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class TimeTicks; | 18 class TimeTicks; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 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 net::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. | 32 // Note that NetLog is NOT THREADSAFE. |
| 33 // | 33 // |
| 34 // ******** The NetLog (and associated logging) is a work in progress ******** | 34 // ******** The NetLog (and associated logging) is a work in progress ******** |
| 35 // | 35 // |
| 36 // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. | 36 // TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods. |
| 37 // TODO(eroman): Make the DNS jobs emit into the NetLog. | 37 // TODO(eroman): Make the DNS jobs emit into the NetLog. |
| 38 // TODO(eroman): Start a new Source each time URLRequest redirects | 38 // TODO(eroman): Start a new Source each time net::URLRequest redirects |
| 39 // (simpler to reason about each as a separate entity). | 39 // (simpler to reason about each as a separate entity). |
| 40 | 40 |
| 41 class NetLog { | 41 class NetLog { |
| 42 public: | 42 public: |
| 43 enum EventType { | 43 enum EventType { |
| 44 #define EVENT_TYPE(label) TYPE_ ## label, | 44 #define EVENT_TYPE(label) TYPE_ ## label, |
| 45 #include "net/base/net_log_event_type_list.h" | 45 #include "net/base/net_log_event_type_list.h" |
| 46 #undef EVENT_TYPE | 46 #undef EVENT_TYPE |
| 47 }; | 47 }; |
| 48 | 48 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 virtual Value* ToValue() const; | 269 virtual Value* ToValue() const; |
| 270 | 270 |
| 271 private: | 271 private: |
| 272 const char* name_; | 272 const char* name_; |
| 273 const NetLog::Source value_; | 273 const NetLog::Source value_; |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 } // namespace net | 276 } // namespace net |
| 277 | 277 |
| 278 #endif // NET_BASE_NET_LOG_H_ | 278 #endif // NET_BASE_NET_LOG_H_ |
| OLD | NEW |