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 NET_TOOLS_GDIG_FILE_NET_LOG_H_ | 5 #ifndef NET_TOOLS_GDIG_FILE_NET_LOG_H_ |
6 #define NET_TOOLS_GDIG_FILE_NET_LOG_H_ | 6 #define NET_TOOLS_GDIG_FILE_NET_LOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "net/log/net_log.h" | 12 #include "net/log/net_log.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // FileNetLogObserver is a simple implementation of NetLog::ThreadSafeObserver | 16 // FileNetLogObserver is a simple implementation of NetLog::ThreadSafeObserver |
17 // that prints out all the events received into the stream passed | 17 // that prints out all the events received into the stream passed |
18 // to the constructor. | 18 // to the constructor. |
19 class FileNetLogObserver : public NetLog::ThreadSafeObserver { | 19 class FileNetLogObserver : public NetLog::ThreadSafeObserver { |
20 public: | 20 public: |
21 explicit FileNetLogObserver(FILE* destination); | 21 explicit FileNetLogObserver(FILE* destination); |
22 ~FileNetLogObserver() override; | 22 ~FileNetLogObserver() override; |
23 | 23 |
24 // NetLog::ThreadSafeObserver implementation: | 24 // NetLog::ThreadSafeObserver implementation: |
25 void OnAddEntry(const net::NetLog::Entry& entry) override; | 25 void OnAddEntry(const net::NetLogEntry& entry) override; |
26 | 26 |
27 private: | 27 private: |
28 FILE* const destination_; | 28 FILE* const destination_; |
29 base::Lock lock_; | 29 base::Lock lock_; |
30 | 30 |
31 base::Time first_event_time_; | 31 base::Time first_event_time_; |
32 }; | 32 }; |
33 | 33 |
34 } // namespace net | 34 } // namespace net |
35 | 35 |
36 #endif // NET_TOOLS_GDIG_FILE_NET_LOG_H_ | 36 #endif // NET_TOOLS_GDIG_FILE_NET_LOG_H_ |
OLD | NEW |