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

Unified Diff: content/browser/renderer_host/webrtc_logging_handler_host.cc

Issue 13119009: Adding WebRTC logging filter, handler and handler host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed render_thread_impl.* and render_process_host_impl.cc changes from this CL. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/webrtc_logging_handler_host.cc
diff --git a/content/browser/renderer_host/webrtc_logging_handler_host.cc b/content/browser/renderer_host/webrtc_logging_handler_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2efb8d86f6380650bd48d83b7e8968053fe86654
--- /dev/null
+++ b/content/browser/renderer_host/webrtc_logging_handler_host.cc
@@ -0,0 +1,63 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/webrtc_logging_handler_host.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "content/common/webrtc_logging_messages.h"
+
+namespace content {
+
+const size_t kWebRtcLogSize = 6 * 1024 * 1024; // 6 MB
+
+WebRtcLoggingHandlerHost::WebRtcLoggingHandlerHost() {
+}
+
+WebRtcLoggingHandlerHost::~WebRtcLoggingHandlerHost() {
+}
+
+void WebRtcLoggingHandlerHost::OnChannelClosing() {
+ BrowserMessageFilter::OnChannelClosing();
+}
+
+void WebRtcLoggingHandlerHost::OnDestruct() const {
+ BrowserThread::DeleteOnIOThread::Destruct(this);
+}
+
+bool WebRtcLoggingHandlerHost::OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(WebRtcLoggingHandlerHost, message, *message_was_ok)
+ IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_OpenLog, OnOpenLog)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+
+ return handled;
+}
+
+void WebRtcLoggingHandlerHost::OnOpenLog() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (base::SharedMemory::IsHandleValid(shared_memory_.handle()))
tommi (sloooow) - chröme 2013/03/28 11:00:10 {} Maybe just be a DCHECK for now (until we suppo
Henrik Grunell 2013/04/02 10:06:40 Yep, sgtm. The handler in the render process can e
+ // TODO(grunell): Handle or disallow.
+ NOTIMPLEMENTED();
+
+ if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) {
+ LOG(ERROR) << "Failed to create shared memory.";
+ Send(new WebRtcLoggingMsg_OpenLogFailed());
+ return;
+ }
+
+ base::SharedMemoryHandle foreign_memory_handle;
+ if (!shared_memory_.ShareToProcess(peer_handle(),
+ &foreign_memory_handle)) {
+ // TODO(grunell): Handle error. (E.g. close, unmap and send fail msg.)
+ return;
+ }
+
+ Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698