| 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 COMPONENTS_NET_LOG_CHROME_NET_LOG_H_ | 5 #ifndef COMPONENTS_NET_LOG_CHROME_NET_LOG_H_ |
| 6 #define COMPONENTS_NET_LOG_CHROME_NET_LOG_H_ | 6 #define COMPONENTS_NET_LOG_CHROME_NET_LOG_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace net_log { | 25 namespace net_log { |
| 26 | 26 |
| 27 class NetLogFileWriter; | 27 class NetLogFileWriter; |
| 28 | 28 |
| 29 // ChromeNetLog is an implementation of NetLog that adds file loggers | 29 // ChromeNetLog is an implementation of NetLog that adds file loggers |
| 30 // as its observers. | 30 // as its observers. |
| 31 class ChromeNetLog : public net::NetLog { | 31 class ChromeNetLog : public net::NetLog { |
| 32 public: | 32 public: |
| 33 // The parameters to the constructor are only used for command-line based |
| 34 // NetLog writing (which starts immediately after construction). |
| 35 // |
| 36 // TODO(eroman): This would be clearer as a separate method to configure and |
| 37 // start this logging mode. |
| 38 // |
| 33 // The log is saved to |log_file|. | 39 // The log is saved to |log_file|. |
| 34 // |log_file_mode| is the mode used to log in |log_file|. | 40 // |log_file_mode| is the mode used to log in |log_file|. |
| 35 // If |log_file| is empty, only a temporary log is created, and | 41 // If |log_file| is empty, only a temporary log is created, and |
| 36 // |log_file_mode| is not used. | 42 // |log_file_mode| is not used. |
| 37 ChromeNetLog(const base::FilePath& log_file, | 43 ChromeNetLog(const base::FilePath& log_file, |
| 38 net::NetLogCaptureMode log_file_mode, | 44 net::NetLogCaptureMode log_file_mode, |
| 39 const base::CommandLine::StringType& command_line_string, | 45 const base::CommandLine::StringType& command_line_string, |
| 40 const std::string& channel_string); | 46 const std::string& channel_string); |
| 41 ~ChromeNetLog() override; | 47 ~ChromeNetLog() override; |
| 42 | 48 |
| 43 NetLogFileWriter* net_log_file_writer() { return net_log_file_writer_.get(); } | 49 // TODO(eroman): Rename this to something clearer. Perhaps |
| 50 // |net_export_file_writer()|. |
| 51 NetLogFileWriter* net_log_file_writer(); |
| 44 | 52 |
| 45 // Returns a Value containing constants needed to load a log file. | 53 // Returns a Value containing constants needed to load a log file. |
| 46 // Safe to call on any thread. | 54 // Safe to call on any thread. |
| 47 static std::unique_ptr<base::Value> GetConstants( | 55 static std::unique_ptr<base::Value> GetConstants( |
| 48 const base::CommandLine::StringType& command_line_string, | 56 const base::CommandLine::StringType& command_line_string, |
| 49 const std::string& channel_string); | 57 const std::string& channel_string); |
| 50 | 58 |
| 51 private: | 59 private: |
| 52 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; | 60 std::unique_ptr<net::WriteToFileNetLogObserver> write_to_file_observer_; |
| 53 std::unique_ptr<NetLogFileWriter> net_log_file_writer_; | 61 std::unique_ptr<NetLogFileWriter> net_log_file_writer_; |
| 54 std::unique_ptr<net::TraceNetLogObserver> trace_net_log_observer_; | 62 std::unique_ptr<net::TraceNetLogObserver> trace_net_log_observer_; |
| 55 | 63 |
| 56 DISALLOW_COPY_AND_ASSIGN(ChromeNetLog); | 64 DISALLOW_COPY_AND_ASSIGN(ChromeNetLog); |
| 57 }; | 65 }; |
| 58 | 66 |
| 59 } // namespace net_log | 67 } // namespace net_log |
| 60 | 68 |
| 61 #endif // COMPONENTS_NET_LOG_CHROME_NET_LOG_H_ | 69 #endif // COMPONENTS_NET_LOG_CHROME_NET_LOG_H_ |
| OLD | NEW |