| 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 "content/public/browser/browser_message_filter.h" | 10 #include "content/public/browser/browser_message_filter.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void UploadLog(const UploadDoneCallback& callback); | 54 void UploadLog(const UploadDoneCallback& callback); |
| 55 | 55 |
| 56 // Called by WebRtcLogUploader when uploading has finished. Must be called on | 56 // Called by WebRtcLogUploader when uploading has finished. Must be called on |
| 57 // the IO thread. | 57 // the IO thread. |
| 58 void UploadLogDone(); | 58 void UploadLogDone(); |
| 59 | 59 |
| 60 // Discards the log. May only be called after logging has stopped. Must be | 60 // Discards the log. May only be called after logging has stopped. Must be |
| 61 // called on the IO thread. | 61 // called on the IO thread. |
| 62 void DiscardLog(const GenericDoneCallback& callback); | 62 void DiscardLog(const GenericDoneCallback& callback); |
| 63 | 63 |
| 64 // Adds a message to the log. |
| 65 void LogMessage(const std::string& message); |
| 66 |
| 64 // May be called on any thread. |upload_log_on_render_close_| is used | 67 // May be called on any thread. |upload_log_on_render_close_| is used |
| 65 // for decision making and it's OK if it changes before the execution based | 68 // for decision making and it's OK if it changes before the execution based |
| 66 // on that decision has finished. | 69 // on that decision has finished. |
| 67 void set_upload_log_on_render_close(bool should_upload) { | 70 void set_upload_log_on_render_close(bool should_upload) { |
| 68 upload_log_on_render_close_ = should_upload; | 71 upload_log_on_render_close_ = should_upload; |
| 69 } | 72 } |
| 70 | 73 |
| 71 private: | 74 private: |
| 72 // States used for protecting from function calls made at non-allowed points | 75 // States used for protecting from function calls made at non-allowed points |
| 73 // in time. For example, StartLogging() is only allowed in CLOSED state. | 76 // in time. For example, StartLogging() is only allowed in CLOSED state. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 friend class base::DeleteHelper<WebRtcLoggingHandlerHost>; | 95 friend class base::DeleteHelper<WebRtcLoggingHandlerHost>; |
| 93 | 96 |
| 94 virtual ~WebRtcLoggingHandlerHost(); | 97 virtual ~WebRtcLoggingHandlerHost(); |
| 95 | 98 |
| 96 // BrowserMessageFilter implementation. | 99 // BrowserMessageFilter implementation. |
| 97 virtual void OnChannelClosing() OVERRIDE; | 100 virtual void OnChannelClosing() OVERRIDE; |
| 98 virtual void OnDestruct() const OVERRIDE; | 101 virtual void OnDestruct() const OVERRIDE; |
| 99 virtual bool OnMessageReceived(const IPC::Message& message, | 102 virtual bool OnMessageReceived(const IPC::Message& message, |
| 100 bool* message_was_ok) OVERRIDE; | 103 bool* message_was_ok) OVERRIDE; |
| 101 | 104 |
| 105 // Handles log message requests from both renderer process and browser |
| 106 // process. |
| 102 void OnAddLogMessage(const std::string& message); | 107 void OnAddLogMessage(const std::string& message); |
| 103 void OnLoggingStoppedInRenderer(); | 108 void OnLoggingStoppedInRenderer(); |
| 104 | 109 |
| 105 void StartLoggingIfAllowed(); | 110 void StartLoggingIfAllowed(); |
| 106 void DoStartLogging(); | 111 void DoStartLogging(); |
| 107 void LogMachineInfo(); | 112 void LogMachineInfo(); |
| 108 void NotifyLoggingStarted(); | 113 void NotifyLoggingStarted(); |
| 109 | 114 |
| 110 // Writes a formatted log |message| to the |circular_buffer_|. | 115 // Writes a formatted log |message| to the |circular_buffer_|. |
| 111 void LogToCircularBuffer(const std::string& message); | 116 void LogToCircularBuffer(const std::string& message); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 150 |
| 146 // This is the handle to be passed to the render process. It's stored so that | 151 // This is the handle to be passed to the render process. It's stored so that |
| 147 // it doesn't have to be passed on when posting messages between threads. | 152 // it doesn't have to be passed on when posting messages between threads. |
| 148 // It's only accessed on the IO thread. | 153 // It's only accessed on the IO thread. |
| 149 base::SharedMemoryHandle foreign_memory_handle_; | 154 base::SharedMemoryHandle foreign_memory_handle_; |
| 150 | 155 |
| 151 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); | 156 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); |
| 152 }; | 157 }; |
| 153 | 158 |
| 154 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ | 159 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ |
| OLD | NEW |