| 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 CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
| 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "chrome/browser/media/rtp_dump_type.h" | 10 #include "chrome/browser/media/rtp_dump_type.h" |
| 11 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" | 11 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" |
| 12 #include "chrome/common/media/webrtc_logging_message_data.h" | 12 #include "chrome/common/media/webrtc_logging_message_data.h" |
| 13 #include "content/public/browser/browser_message_filter.h" | 13 #include "content/public/browser/browser_message_filter.h" |
| 14 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 15 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
| 16 | 16 |
| 17 namespace net { | |
| 18 class URLRequestContextGetter; | |
| 19 } // namespace net | |
| 20 | |
| 21 class PartialCircularBuffer; | 17 class PartialCircularBuffer; |
| 22 class Profile; | 18 class Profile; |
| 23 | 19 |
| 24 typedef std::map<std::string, std::string> MetaDataMap; | 20 typedef std::map<std::string, std::string> MetaDataMap; |
| 25 | 21 |
| 26 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: | 22 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: |
| 27 // - Opens a shared memory buffer that the handler in the render process | 23 // - Opens a shared memory buffer that the handler in the render process |
| 28 // writes to. | 24 // writes to. |
| 29 // - Writes basic machine info to the log. | 25 // - Writes basic machine info to the log. |
| 30 // - Informs the handler in the render process when to stop logging. | 26 // - Informs the handler in the render process when to stop logging. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 125 |
| 130 // Handles log message requests from renderer process. | 126 // Handles log message requests from renderer process. |
| 131 void OnAddLogMessages(const std::vector<WebRtcLoggingMessageData>& messages); | 127 void OnAddLogMessages(const std::vector<WebRtcLoggingMessageData>& messages); |
| 132 void OnLoggingStoppedInRenderer(); | 128 void OnLoggingStoppedInRenderer(); |
| 133 | 129 |
| 134 // Handles log message requests from browser process. | 130 // Handles log message requests from browser process. |
| 135 void AddLogMessageFromBrowser(const WebRtcLoggingMessageData& message); | 131 void AddLogMessageFromBrowser(const WebRtcLoggingMessageData& message); |
| 136 | 132 |
| 137 void StartLoggingIfAllowed(); | 133 void StartLoggingIfAllowed(); |
| 138 void DoStartLogging(); | 134 void DoStartLogging(); |
| 139 void LogInitialInfoOnFileThread(); | 135 void LogInitialInfoOnBlockingPool(); |
| 140 void LogInitialInfoOnIOThread(const net::NetworkInterfaceList& network_list); | 136 void LogInitialInfoOnIOThread(const net::NetworkInterfaceList& network_list, |
| 137 const std::string& linux_distro); |
| 141 void NotifyLoggingStarted(); | 138 void NotifyLoggingStarted(); |
| 142 | 139 |
| 143 // Writes a formatted log |message| to the |circular_buffer_|. | 140 // Writes a formatted log |message| to the |circular_buffer_|. |
| 144 void LogToCircularBuffer(const std::string& message); | 141 void LogToCircularBuffer(const std::string& message); |
| 145 | 142 |
| 146 // Gets the log directory path for |profile_| and ensure it exists. Must be | 143 // Gets the log directory path for |profile_| and ensure it exists. Must be |
| 147 // called on the FILE thread. | 144 // called on the FILE thread. |
| 148 base::FilePath GetLogDirectoryAndEnsureExists(); | 145 base::FilePath GetLogDirectoryAndEnsureExists(); |
| 149 | 146 |
| 150 void TriggerUpload(const base::FilePath& log_directory); | 147 void TriggerUpload(const base::FilePath& log_directory); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 169 // Adds the packet to the dump on IO thread. | 166 // Adds the packet to the dump on IO thread. |
| 170 void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, | 167 void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, |
| 171 size_t header_length, | 168 size_t header_length, |
| 172 size_t packet_length, | 169 size_t packet_length, |
| 173 bool incoming); | 170 bool incoming); |
| 174 | 171 |
| 175 scoped_ptr<unsigned char[]> log_buffer_; | 172 scoped_ptr<unsigned char[]> log_buffer_; |
| 176 scoped_ptr<PartialCircularBuffer> circular_buffer_; | 173 scoped_ptr<PartialCircularBuffer> circular_buffer_; |
| 177 | 174 |
| 178 // The profile associated with our renderer process. | 175 // The profile associated with our renderer process. |
| 179 Profile* profile_; | 176 const Profile* const profile_; |
| 180 | 177 |
| 181 // These are only accessed on the IO thread, except when in STARTING state. In | 178 // These are only accessed on the IO thread, except when in STARTING state. In |
| 182 // this state we are protected since entering any function that alters the | 179 // this state we are protected since entering any function that alters the |
| 183 // state is not allowed. | 180 // state is not allowed. |
| 184 MetaDataMap meta_data_; | 181 MetaDataMap meta_data_; |
| 185 | 182 |
| 186 // These are only accessed on the IO thread. | 183 // These are only accessed on the IO thread. |
| 187 GenericDoneCallback start_callback_; | 184 GenericDoneCallback start_callback_; |
| 188 GenericDoneCallback stop_callback_; | 185 GenericDoneCallback stop_callback_; |
| 189 UploadDoneCallback upload_callback_; | 186 UploadDoneCallback upload_callback_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 209 // The RTP dump handler responsible for creating the RTP header dump files. | 206 // The RTP dump handler responsible for creating the RTP header dump files. |
| 210 scoped_ptr<WebRtcRtpDumpHandler> rtp_dump_handler_; | 207 scoped_ptr<WebRtcRtpDumpHandler> rtp_dump_handler_; |
| 211 | 208 |
| 212 // The callback to call when StopRtpDump is called. | 209 // The callback to call when StopRtpDump is called. |
| 213 content::RenderProcessHost::WebRtcStopRtpDumpCallback stop_rtp_dump_callback_; | 210 content::RenderProcessHost::WebRtcStopRtpDumpCallback stop_rtp_dump_callback_; |
| 214 | 211 |
| 215 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); | 212 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
| 216 }; | 213 }; |
| 217 | 214 |
| 218 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 215 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
| OLD | NEW |