OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ | 5 #ifndef CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ |
6 #define CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ | 6 #define CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ |
7 | 7 |
8 #include "base/memory/scoped_handle.h" | 8 #include "base/memory/scoped_handle.h" |
9 #include "net/base/net_log.h" | 9 #include "net/base/net_log.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 // If |log_path| is empty or file creation fails, writes to VLOG(1). | 25 // If |log_path| is empty or file creation fails, writes to VLOG(1). |
26 // Otherwise, writes to |log_path|. Uses one line per entry, for | 26 // Otherwise, writes to |log_path|. Uses one line per entry, for |
27 // easy parsing. | 27 // easy parsing. |
28 explicit NetLogLogger(const FilePath &log_path); | 28 explicit NetLogLogger(const FilePath &log_path); |
29 virtual ~NetLogLogger(); | 29 virtual ~NetLogLogger(); |
30 | 30 |
31 // Starts observing specified NetLog. Must not already be watching a NetLog. | 31 // Starts observing specified NetLog. Must not already be watching a NetLog. |
32 // Separate from constructor to enforce thread safety. | 32 // Separate from constructor to enforce thread safety. |
33 void StartObserving(net::NetLog* net_log); | 33 void StartObserving(net::NetLog* net_log); |
34 | 34 |
35 // Stops observing |net_log_|. Must already be watching |net_log_|. | |
36 void StopObserving(); | |
37 | |
35 // net::NetLog::ThreadSafeObserver implementation: | 38 // net::NetLog::ThreadSafeObserver implementation: |
36 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; | 39 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE; |
37 | 40 |
38 private: | 41 private: |
39 ScopedStdioHandle file_; | 42 ScopedStdioHandle file_; |
40 | 43 |
44 // NetLog that is being observed. Weak ptr, owned by the caller of | |
45 // |StartObserving|. |StopObserving| stops observing of |net_log_|. | |
46 net::NetLog* net_log_; | |
mmenke
2013/01/04 16:22:09
This isn't needed. NetLog::ThreadSafeObserver has
| |
47 | |
41 DISALLOW_COPY_AND_ASSIGN(NetLogLogger); | 48 DISALLOW_COPY_AND_ASSIGN(NetLogLogger); |
42 }; | 49 }; |
43 | 50 |
44 #endif // CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ | 51 #endif // CHROME_BROWSER_NET_NET_LOG_LOGGER_H_ |
OLD | NEW |