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