| 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_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ |
| 6 #define CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ | 6 #define CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/sequence_checker.h" |
| 11 #include "chrome/common/media/webrtc_logging_message_data.h" | 12 #include "chrome/common/media/webrtc_logging_message_data.h" |
| 12 #include "content/public/renderer/webrtc_log_message_delegate.h" | 13 #include "content/public/renderer/webrtc_log_message_delegate.h" |
| 13 #include "ipc/ipc_channel_proxy.h" | 14 #include "ipc/ipc_channel_proxy.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class SingleThreadTaskRunner; | 17 class SingleThreadTaskRunner; |
| 17 } | 18 } |
| 18 | 19 |
| 19 class WebRtcLoggingMessageFilter; | 20 class WebRtcLoggingMessageFilter; |
| 20 | 21 |
| 21 // ChromeWebRtcLogMessageDelegate handles WebRTC logging. There is one object | 22 // ChromeWebRtcLogMessageDelegate handles WebRTC logging. There is one object |
| 22 // per render process, owned by WebRtcLoggingMessageFilter. It communicates with | 23 // per render process, owned by WebRtcLoggingMessageFilter. It communicates with |
| 23 // WebRtcLoggingHandlerHost and receives logging messages from libjingle and | 24 // WebRtcLoggingHandlerHost and receives logging messages from libjingle and |
| 24 // writes them to a shared memory buffer. | 25 // writes them to a shared memory buffer. |
| 25 class ChromeWebRtcLogMessageDelegate | 26 class ChromeWebRtcLogMessageDelegate |
| 26 : public content::WebRtcLogMessageDelegate, | 27 : public content::WebRtcLogMessageDelegate { |
| 27 public base::NonThreadSafe { | |
| 28 public: | 28 public: |
| 29 ChromeWebRtcLogMessageDelegate( | 29 ChromeWebRtcLogMessageDelegate( |
| 30 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 30 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 31 WebRtcLoggingMessageFilter* message_filter); | 31 WebRtcLoggingMessageFilter* message_filter); |
| 32 | 32 |
| 33 ~ChromeWebRtcLogMessageDelegate() override; | 33 ~ChromeWebRtcLogMessageDelegate() override; |
| 34 | 34 |
| 35 // content::WebRtcLogMessageDelegate implementation. | 35 // content::WebRtcLogMessageDelegate implementation. |
| 36 void LogMessage(const std::string& message) override; | 36 void LogMessage(const std::string& message) override; |
| 37 | 37 |
| 38 void OnFilterRemoved(); | 38 void OnFilterRemoved(); |
| 39 | 39 |
| 40 void OnStartLogging(); | 40 void OnStartLogging(); |
| 41 void OnStopLogging(); | 41 void OnStopLogging(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void LogMessageOnIOThread(const WebRtcLoggingMessageData& message); | 44 void LogMessageOnIOThread(const WebRtcLoggingMessageData& message); |
| 45 void SendLogBuffer(); | 45 void SendLogBuffer(); |
| 46 | 46 |
| 47 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 47 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 48 bool logging_started_; | 48 bool logging_started_; |
| 49 std::vector<WebRtcLoggingMessageData> log_buffer_; | 49 std::vector<WebRtcLoggingMessageData> log_buffer_; |
| 50 | 50 |
| 51 base::TimeTicks last_log_buffer_send_; | 51 base::TimeTicks last_log_buffer_send_; |
| 52 | 52 |
| 53 WebRtcLoggingMessageFilter* message_filter_; | 53 WebRtcLoggingMessageFilter* message_filter_; |
| 54 | 54 |
| 55 SEQUENCE_CHECKER(sequence_checker_); |
| 56 |
| 55 DISALLOW_COPY_AND_ASSIGN(ChromeWebRtcLogMessageDelegate); | 57 DISALLOW_COPY_AND_ASSIGN(ChromeWebRtcLogMessageDelegate); |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 #endif // CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ | 60 #endif // CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ |
| OLD | NEW |