| 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_WEBRTC_LOGGING_MESSAGE_FILTER_H_ | 5 #ifndef CHROME_RENDERER_MEDIA_WEBRTC_LOGGING_MESSAGE_FILTER_H_ |
| 6 #define CHROME_RENDERER_MEDIA_WEBRTC_LOGGING_MESSAGE_FILTER_H_ | 6 #define CHROME_RENDERER_MEDIA_WEBRTC_LOGGING_MESSAGE_FILTER_H_ |
| 7 | 7 |
| 8 #include "base/single_thread_task_runner.h" |
| 8 #include "chrome/common/media/webrtc_logging_message_data.h" | 9 #include "chrome/common/media/webrtc_logging_message_data.h" |
| 9 #include "ipc/message_filter.h" | 10 #include "ipc/message_filter.h" |
| 10 | 11 |
| 11 namespace base { | |
| 12 class MessageLoopProxy; | |
| 13 } | |
| 14 | |
| 15 class ChromeWebRtcLogMessageDelegate; | 12 class ChromeWebRtcLogMessageDelegate; |
| 16 | 13 |
| 17 // Filter for WebRTC logging messages. Sits between | 14 // Filter for WebRTC logging messages. Sits between |
| 18 // ChromeWebRtcLogMessageDelegate (renderer process) and | 15 // ChromeWebRtcLogMessageDelegate (renderer process) and |
| 19 // WebRtcLoggingHandlerHost (browser process). Must be called on the IO thread. | 16 // WebRtcLoggingHandlerHost (browser process). Must be called on the IO thread. |
| 20 class WebRtcLoggingMessageFilter : public IPC::MessageFilter { | 17 class WebRtcLoggingMessageFilter : public IPC::MessageFilter { |
| 21 public: | 18 public: |
| 22 explicit WebRtcLoggingMessageFilter( | 19 explicit WebRtcLoggingMessageFilter( |
| 23 const scoped_refptr<base::MessageLoopProxy>& io_message_loop); | 20 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
| 24 | 21 |
| 25 virtual void AddLogMessages( | 22 virtual void AddLogMessages( |
| 26 const std::vector<WebRtcLoggingMessageData>& messages); | 23 const std::vector<WebRtcLoggingMessageData>& messages); |
| 27 virtual void LoggingStopped(); | 24 virtual void LoggingStopped(); |
| 28 | 25 |
| 29 const scoped_refptr<base::MessageLoopProxy>& io_message_loop() { | 26 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner() { |
| 30 return io_message_loop_; | 27 return io_task_runner_; |
| 31 } | 28 } |
| 32 | 29 |
| 33 protected: | 30 protected: |
| 34 ~WebRtcLoggingMessageFilter() override; | 31 ~WebRtcLoggingMessageFilter() override; |
| 35 | 32 |
| 36 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 33 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 37 | 34 |
| 38 // Owned by this class. The only other pointer to it is in libjingle's logging | 35 // Owned by this class. The only other pointer to it is in libjingle's logging |
| 39 // file. That's a global pointer used on different threads, so we will leak | 36 // file. That's a global pointer used on different threads, so we will leak |
| 40 // this object when we go away to ensure that it outlives any log messages | 37 // this object when we go away to ensure that it outlives any log messages |
| 41 // coming from libjingle. | 38 // coming from libjingle. |
| 42 // This is protected for unit test purposes. | 39 // This is protected for unit test purposes. |
| 43 // TODO(vrk): Remove ChromeWebRtcLogMessageDelegate's pointer to | 40 // TODO(vrk): Remove ChromeWebRtcLogMessageDelegate's pointer to |
| 44 // WebRtcLoggingMessageFilter so that we can write a unit test that doesn't | 41 // WebRtcLoggingMessageFilter so that we can write a unit test that doesn't |
| 45 // need this accessor. | 42 // need this accessor. |
| 46 ChromeWebRtcLogMessageDelegate* log_message_delegate_; | 43 ChromeWebRtcLogMessageDelegate* log_message_delegate_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 57 void OnStartLogging(); | 54 void OnStartLogging(); |
| 58 void OnStopLogging(); | 55 void OnStopLogging(); |
| 59 void Send(IPC::Message* message); | 56 void Send(IPC::Message* message); |
| 60 | 57 |
| 61 IPC::Sender* sender_; | 58 IPC::Sender* sender_; |
| 62 | 59 |
| 63 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingMessageFilter); | 60 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingMessageFilter); |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 #endif // CHROME_RENDERER_MEDIA_WEBRTC_LOGGING_MESSAGE_FILTER_H_ | 63 #endif // CHROME_RENDERER_MEDIA_WEBRTC_LOGGING_MESSAGE_FILTER_H_ |
| OLD | NEW |