Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/media/webrtc_logging_handler_host.h

Issue 140633004: Reland CL to implement browser-side logging to WebRtc log. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: These are the changes that should fix crbug.com/338848 Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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.
102 void OnAddLogMessage(const std::string& message); 106 void OnAddLogMessage(const std::string& message);
103 void OnLoggingStoppedInRenderer(); 107 void OnLoggingStoppedInRenderer();
104 108
109 // Handles log message requests from browser process.
110 void AddLogMessageFromBrowser(const std::string& message);
111
105 void StartLoggingIfAllowed(); 112 void StartLoggingIfAllowed();
106 void DoStartLogging(); 113 void DoStartLogging();
107 void LogMachineInfo(); 114 void LogMachineInfo();
108 void NotifyLoggingStarted(); 115 void NotifyLoggingStarted();
109 116
110 // Writes a formatted log |message| to the |circular_buffer_|. 117 // Writes a formatted log |message| to the |circular_buffer_|.
111 void LogToCircularBuffer(const std::string& message); 118 void LogToCircularBuffer(const std::string& message);
112 119
113 void TriggerUploadLog(); 120 void TriggerUploadLog();
114 121
(...skipping 30 matching lines...) Expand all
145 152
146 // This is the handle to be passed to the render process. It's stored so that 153 // 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. 154 // it doesn't have to be passed on when posting messages between threads.
148 // It's only accessed on the IO thread. 155 // It's only accessed on the IO thread.
149 base::SharedMemoryHandle foreign_memory_handle_; 156 base::SharedMemoryHandle foreign_memory_handle_;
150 157
151 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost); 158 DISALLOW_COPY_AND_ASSIGN(WebRtcLoggingHandlerHost);
152 }; 159 };
153 160
154 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_ 161 #endif // CHROME_BROWSER_MEDIA_WEBRTC_LOGGING_HANDLER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698