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_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 "chrome/common/media/webrtc_logging_message_data.h" |
| 11 #include "content/public/browser/browser_message_filter.h" | 11 #include "content/public/browser/browser_message_filter.h" |
| 12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
| 16 } // namespace net | 16 } // namespace net |
| 17 | 17 |
| 18 class PartialCircularBuffer; | 18 class PartialCircularBuffer; |
| 19 class Profile; | 19 class Profile; |
| 20 class RenderProcessHost; | 20 class RenderProcessHost; |
| 21 class WebRtcRtpDumpHandler; | |
| 21 | 22 |
| 22 typedef std::map<std::string, std::string> MetaDataMap; | 23 typedef std::map<std::string, std::string> MetaDataMap; |
| 23 | 24 |
| 24 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: | 25 // WebRtcLoggingHandlerHost handles operations regarding the WebRTC logging: |
| 25 // - Opens a shared memory buffer that the handler in the render process | 26 // - Opens a shared memory buffer that the handler in the render process |
| 26 // writes to. | 27 // writes to. |
| 27 // - Writes basic machine info to the log. | 28 // - Writes basic machine info to the log. |
| 28 // - Informs the handler in the render process when to stop logging. | 29 // - Informs the handler in the render process when to stop logging. |
| 29 // - Closes the shared memory (and thereby discarding it) or triggers uploading | 30 // - Closes the shared memory (and thereby discarding it) or triggers uploading |
| 30 // of the log. | 31 // of the log. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 // Adds a message to the log. | 67 // Adds a message to the log. |
| 67 void LogMessage(const std::string& message); | 68 void LogMessage(const std::string& message); |
| 68 | 69 |
| 69 // May be called on any thread. |upload_log_on_render_close_| is used | 70 // May be called on any thread. |upload_log_on_render_close_| is used |
| 70 // for decision making and it's OK if it changes before the execution based | 71 // for decision making and it's OK if it changes before the execution based |
| 71 // on that decision has finished. | 72 // on that decision has finished. |
| 72 void set_upload_log_on_render_close(bool should_upload) { | 73 void set_upload_log_on_render_close(bool should_upload) { |
| 73 upload_log_on_render_close_ = should_upload; | 74 upload_log_on_render_close_ = should_upload; |
| 74 } | 75 } |
| 75 | 76 |
| 77 void OnRtpPacket(const uint8* packet, size_t length, bool incoming); | |
|
Henrik Grunell
2014/05/07 09:38:19
Add comment. Which thread should it be called on?
| |
| 78 | |
| 76 private: | 79 private: |
| 77 // States used for protecting from function calls made at non-allowed points | 80 // States used for protecting from function calls made at non-allowed points |
| 78 // in time. For example, StartLogging() is only allowed in CLOSED state. | 81 // in time. For example, StartLogging() is only allowed in CLOSED state. |
| 79 // Transitions: SetMetaData(): CLOSED -> CLOSED. | 82 // Transitions: SetMetaData(): CLOSED -> CLOSED. |
| 80 // StartLogging(): CLOSED -> STARTING. | 83 // StartLogging(): CLOSED -> STARTING. |
| 81 // Start done: STARTING -> STARTED. | 84 // Start done: STARTING -> STARTED. |
| 82 // StopLogging(): STARTED -> STOPPING. | 85 // StopLogging(): STARTED -> STOPPING. |
| 83 // Stop done: STOPPING -> STOPPED. | 86 // Stop done: STOPPING -> STOPPED. |
| 84 // UploadLog(): STOPPED -> UPLOADING. | 87 // UploadLog(): STOPPED -> UPLOADING. |
| 85 // Upload done: UPLOADING -> CLOSED. | 88 // Upload done: UPLOADING -> CLOSED. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 160 |
| 158 // This is the handle to be passed to the render process. It's stored so that | 161 // This is the handle to be passed to the render process. It's stored so that |
| 159 // it doesn't have to be passed on when posting messages between threads. | 162 // it doesn't have to be passed on when posting messages between threads. |
| 160 // It's only accessed on the IO thread. | 163 // It's only accessed on the IO thread. |
| 161 base::SharedMemoryHandle foreign_memory_handle_; | 164 base::SharedMemoryHandle foreign_memory_handle_; |
| 162 | 165 |
| 163 // The system time in ms when logging is started. Reset when logging_state_ | 166 // The system time in ms when logging is started. Reset when logging_state_ |
| 164 // changes to STOPPED. | 167 // changes to STOPPED. |
| 165 base::Time logging_started_time_; | 168 base::Time logging_started_time_; |
| 166 | 169 |
| 170 scoped_ptr<WebRtcRtpDumpHandler> rtp_dump_handler_; | |
|
Henrik Grunell
2014/05/07 09:38:19
Add comment.
| |
| 171 | |
| 167 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); | 172 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
| 168 }; | 173 }; |
| 169 | 174 |
| 170 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 175 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
| OLD | NEW |