OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LOGGER_H_ | 5 #ifndef NET_BASE_NET_LOG_LOGGER_H_ |
6 #define NET_BASE_NET_LOG_LOGGER_H_ | 6 #define NET_BASE_NET_LOG_LOGGER_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include "base/files/scoped_file.h" | 10 #include "base/files/scoped_file.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
13 | 13 |
14 namespace base { | 14 namespace base { |
| 15 class DictionaryValue; |
15 class FilePath; | 16 class FilePath; |
16 class Value; | 17 class Value; |
17 } | 18 } |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 // NetLogLogger watches the NetLog event stream, and sends all entries to | 22 // NetLogLogger watches the NetLog event stream, and sends all entries to |
22 // a file specified on creation. | 23 // a file specified on creation. |
23 // | 24 // |
24 // The text file will contain a single JSON object. | 25 // The text file will contain a single JSON object. |
(...skipping 13 matching lines...) Expand all Loading... |
38 void StartObserving(NetLog* net_log); | 39 void StartObserving(NetLog* net_log); |
39 | 40 |
40 // Stops observing net_log(). Must already be watching. | 41 // Stops observing net_log(). Must already be watching. |
41 void StopObserving(); | 42 void StopObserving(); |
42 | 43 |
43 // net::NetLog::ThreadSafeObserver implementation: | 44 // net::NetLog::ThreadSafeObserver implementation: |
44 void OnAddEntry(const NetLog::Entry& entry) override; | 45 void OnAddEntry(const NetLog::Entry& entry) override; |
45 | 46 |
46 // Create a dictionary containing legend for net/ constants. Caller takes | 47 // Create a dictionary containing legend for net/ constants. Caller takes |
47 // ownership of returned value. | 48 // ownership of returned value. |
| 49 // TODO(mmenke): Get rid of this, and have embedders use GetNetConstants |
| 50 // directly. Also maybe call that function by default, so only embedders |
| 51 // that need more constants need to worry about it. |
48 static base::DictionaryValue* GetConstants(); | 52 static base::DictionaryValue* GetConstants(); |
49 | 53 |
50 private: | 54 private: |
51 base::ScopedFILE file_; | 55 base::ScopedFILE file_; |
52 | 56 |
53 // The LogLevel to log at. | 57 // The LogLevel to log at. |
54 NetLog::LogLevel log_level_; | 58 NetLog::LogLevel log_level_; |
55 | 59 |
56 // True if OnAddEntry() has been called at least once. | 60 // True if OnAddEntry() has been called at least once. |
57 bool added_events_; | 61 bool added_events_; |
58 | 62 |
59 DISALLOW_COPY_AND_ASSIGN(NetLogLogger); | 63 DISALLOW_COPY_AND_ASSIGN(NetLogLogger); |
60 }; | 64 }; |
61 | 65 |
62 } // namespace net | 66 } // namespace net |
63 | 67 |
64 #endif // NET_BASE_NET_LOG_LOGGER_H_ | 68 #endif // NET_BASE_NET_LOG_LOGGER_H_ |
OLD | NEW |