Chromium Code Reviews| 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/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/single_thread_task_runner.h" | |
|
xhwang
2015/05/05 16:01:58
forward declare?
anujsharma
2015/05/06 03:42:45
Done.
| |
| 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 class MessageLoopProxy; | |
| 17 } | |
| 18 | |
| 19 class PartialCircularBuffer; | 16 class PartialCircularBuffer; |
| 20 class WebRtcLoggingMessageFilter; | 17 class WebRtcLoggingMessageFilter; |
| 21 | 18 |
| 22 // ChromeWebRtcLogMessageDelegate handles WebRTC logging. There is one object | 19 // ChromeWebRtcLogMessageDelegate handles WebRTC logging. There is one object |
| 23 // per render process, owned by WebRtcLoggingMessageFilter. It communicates with | 20 // per render process, owned by WebRtcLoggingMessageFilter. It communicates with |
| 24 // WebRtcLoggingHandlerHost and receives logging messages from libjingle and | 21 // WebRtcLoggingHandlerHost and receives logging messages from libjingle and |
| 25 // writes them to a shared memory buffer. | 22 // writes them to a shared memory buffer. |
| 26 class ChromeWebRtcLogMessageDelegate | 23 class ChromeWebRtcLogMessageDelegate |
| 27 : public content::WebRtcLogMessageDelegate, | 24 : public content::WebRtcLogMessageDelegate, |
| 28 public base::NonThreadSafe { | 25 public base::NonThreadSafe { |
| 29 public: | 26 public: |
| 30 ChromeWebRtcLogMessageDelegate( | 27 ChromeWebRtcLogMessageDelegate( |
| 31 const scoped_refptr<base::MessageLoopProxy>& io_message_loop, | 28 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 32 WebRtcLoggingMessageFilter* message_filter); | 29 WebRtcLoggingMessageFilter* message_filter); |
| 33 | 30 |
| 34 ~ChromeWebRtcLogMessageDelegate() override; | 31 ~ChromeWebRtcLogMessageDelegate() override; |
| 35 | 32 |
| 36 // content::WebRtcLogMessageDelegate implementation. | 33 // content::WebRtcLogMessageDelegate implementation. |
| 37 void LogMessage(const std::string& message) override; | 34 void LogMessage(const std::string& message) override; |
| 38 | 35 |
| 39 void OnFilterRemoved(); | 36 void OnFilterRemoved(); |
| 40 | 37 |
| 41 void OnStartLogging(); | 38 void OnStartLogging(); |
| 42 void OnStopLogging(); | 39 void OnStopLogging(); |
| 43 | 40 |
| 44 private: | 41 private: |
| 45 void LogMessageOnIOThread(const WebRtcLoggingMessageData& message); | 42 void LogMessageOnIOThread(const WebRtcLoggingMessageData& message); |
| 46 void SendLogBuffer(); | 43 void SendLogBuffer(); |
| 47 | 44 |
| 48 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 45 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 49 bool logging_started_; | 46 bool logging_started_; |
| 50 std::vector<WebRtcLoggingMessageData> log_buffer_; | 47 std::vector<WebRtcLoggingMessageData> log_buffer_; |
| 51 | 48 |
| 52 base::TimeTicks last_log_buffer_send_; | 49 base::TimeTicks last_log_buffer_send_; |
| 53 | 50 |
| 54 WebRtcLoggingMessageFilter* message_filter_; | 51 WebRtcLoggingMessageFilter* message_filter_; |
| 55 | 52 |
| 56 DISALLOW_COPY_AND_ASSIGN(ChromeWebRtcLogMessageDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(ChromeWebRtcLogMessageDelegate); |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 #endif // CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ | 56 #endif // CHROME_RENDERER_MEDIA_CHROME_WEBRTC_LOG_MESSAGE_DELEGATE_H_ |
| OLD | NEW |