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/common/media/webrtc_logging_message_data.h" |
10 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
11 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
15 } // namespace net | 16 } // namespace net |
16 | 17 |
17 class PartialCircularBuffer; | 18 class PartialCircularBuffer; |
18 class Profile; | 19 class Profile; |
19 class RenderProcessHost; | 20 class RenderProcessHost; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 98 |
98 virtual ~WebRtcLoggingHandlerHost(); | 99 virtual ~WebRtcLoggingHandlerHost(); |
99 | 100 |
100 // BrowserMessageFilter implementation. | 101 // BrowserMessageFilter implementation. |
101 virtual void OnChannelClosing() OVERRIDE; | 102 virtual void OnChannelClosing() OVERRIDE; |
102 virtual void OnDestruct() const OVERRIDE; | 103 virtual void OnDestruct() const OVERRIDE; |
103 virtual bool OnMessageReceived(const IPC::Message& message, | 104 virtual bool OnMessageReceived(const IPC::Message& message, |
104 bool* message_was_ok) OVERRIDE; | 105 bool* message_was_ok) OVERRIDE; |
105 | 106 |
106 // Handles log message requests from renderer process. | 107 // Handles log message requests from renderer process. |
107 void OnAddLogMessage(const std::string& message); | 108 void OnAddLogMessages(const std::vector<WebRtcLoggingMessageData>& messages); |
108 void OnLoggingStoppedInRenderer(); | 109 void OnLoggingStoppedInRenderer(); |
109 | 110 |
110 // Handles log message requests from browser process. | 111 // Handles log message requests from browser process. |
111 void AddLogMessageFromBrowser(const std::string& message); | 112 void AddLogMessageFromBrowser(const WebRtcLoggingMessageData& message); |
112 | 113 |
113 void StartLoggingIfAllowed(); | 114 void StartLoggingIfAllowed(); |
114 void DoStartLogging(); | 115 void DoStartLogging(); |
115 void LogInitialInfoOnFileThread(); | 116 void LogInitialInfoOnFileThread(); |
116 void LogInitialInfoOnIOThread(const net::NetworkInterfaceList& network_list); | 117 void LogInitialInfoOnIOThread(const net::NetworkInterfaceList& network_list); |
117 void NotifyLoggingStarted(); | 118 void NotifyLoggingStarted(); |
118 | 119 |
119 // Writes a formatted log |message| to the |circular_buffer_|. | 120 // Writes a formatted log |message| to the |circular_buffer_|. |
120 void LogToCircularBuffer(const std::string& message); | 121 void LogToCircularBuffer(const std::string& message); |
121 | 122 |
(...skipping 30 matching lines...) Expand all Loading... |
152 LoggingState logging_state_; | 153 LoggingState logging_state_; |
153 | 154 |
154 // Only accessed on the IO thread. | 155 // Only accessed on the IO thread. |
155 bool upload_log_on_render_close_; | 156 bool upload_log_on_render_close_; |
156 | 157 |
157 // This is the handle to be passed to the render process. It's stored so that | 158 // This is the handle to be passed to the render process. It's stored so that |
158 // it doesn't have to be passed on when posting messages between threads. | 159 // it doesn't have to be passed on when posting messages between threads. |
159 // It's only accessed on the IO thread. | 160 // It's only accessed on the IO thread. |
160 base::SharedMemoryHandle foreign_memory_handle_; | 161 base::SharedMemoryHandle foreign_memory_handle_; |
161 | 162 |
| 163 // The system time in ms when logging is started. Reset when logging_state_ |
| 164 // changes to STOPPED. |
| 165 base::Time logging_started_time_; |
| 166 |
162 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); | 167 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
163 }; | 168 }; |
164 | 169 |
165 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 170 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
OLD | NEW |