| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BOUNDED_FILE_NET_LOG_OBSERVER_H_ | 5 #ifndef BOUNDED_FILE_NET_LOG_OBSERVER_H_ |
| 6 #define BOUNDED_FILE_NET_LOG_OBSERVER_H_ | 6 #define BOUNDED_FILE_NET_LOG_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/scoped_file.h" | 11 #include "base/files/scoped_file.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "net/log/net_log.h" | 18 #include "net/log/net_log.h" |
| 19 #include "net/log/net_log_capture_mode.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class DictionaryValue; | 22 class DictionaryValue; |
| 22 class Value; | 23 class Value; |
| 23 } // namespace base | 24 } // namespace base |
| 24 | 25 |
| 25 namespace net { | 26 namespace net { |
| 26 | 27 |
| 27 class URLRequestContext; | 28 class URLRequestContext; |
| 28 | 29 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // once all file writing is complete and the netlog files can be accessed | 93 // once all file writing is complete and the netlog files can be accessed |
| 93 // safely. | 94 // safely. |
| 94 // | 95 // |
| 95 // |url_request_context| is an optional argument used to add additional | 96 // |url_request_context| is an optional argument used to add additional |
| 96 // network stack state to the log. If the context is non-NULL, | 97 // network stack state to the log. If the context is non-NULL, |
| 97 // StopObserving() must be called on the context's thread. | 98 // StopObserving() must be called on the context's thread. |
| 98 void StopObserving(URLRequestContext* url_request_context, | 99 void StopObserving(URLRequestContext* url_request_context, |
| 99 const base::Closure& callback); | 100 const base::Closure& callback); |
| 100 | 101 |
| 101 // NetLog::ThreadSafeObserver | 102 // NetLog::ThreadSafeObserver |
| 102 void OnAddEntry(const NetLog::Entry& entry) override; | 103 void OnAddEntry(const NetLogEntry& entry) override; |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 class WriteQueue; | 106 class WriteQueue; |
| 106 class FileWriter; | 107 class FileWriter; |
| 107 | 108 |
| 108 // The capture mode to log at. | 109 // The capture mode to log at. |
| 109 NetLogCaptureMode capture_mode_; | 110 NetLogCaptureMode capture_mode_; |
| 110 | 111 |
| 111 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 112 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 112 | 113 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 125 // thread is safe because the FileWriter object will be alive until the | 126 // thread is safe because the FileWriter object will be alive until the |
| 126 // observer's destruction. | 127 // observer's destruction. |
| 127 FileWriter* file_writer_; | 128 FileWriter* file_writer_; |
| 128 | 129 |
| 129 DISALLOW_COPY_AND_ASSIGN(BoundedFileNetLogObserver); | 130 DISALLOW_COPY_AND_ASSIGN(BoundedFileNetLogObserver); |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 } // namespace net | 133 } // namespace net |
| 133 | 134 |
| 134 #endif // BOUNDED_FILE_NET_LOG_OBSERVER_H_ | 135 #endif // BOUNDED_FILE_NET_LOG_OBSERVER_H_ |
| OLD | NEW |