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

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: Fixed typo in gypi file. Created 7 years, 8 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..4e213c4b61707fe71b06460f74777c0dc97deb72
--- /dev/null
+++ b/content/browser/renderer_host/webrtc_logging_handler_host.cc
@@ -0,0 +1,61 @@
+// 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));
+ DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle()));
+
+ if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) {
+ DLOG(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)) {
+ Send(new WebRtcLoggingMsg_OpenLogFailed());
+ return;
+ }
+
+ Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize));
+}
+
+} // namespace content
« no previous file with comments | « content/browser/renderer_host/webrtc_logging_handler_host.h ('k') | content/common/content_message_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698