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

Side by Side Diff: content/browser/renderer_host/media/webrtc_logging_handler_host.cc

Issue 15741003: Moving WebRTC logging related files from content to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Public content API for setting the log delegate. Created 7 years, 7 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/media/webrtc_logging_handler_host.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "content/common/media/webrtc_logging_messages.h"
10
11 namespace content {
12
13 const size_t kWebRtcLogSize = 6 * 1024 * 1024; // 6 MB
14
15 WebRtcLoggingHandlerHost::WebRtcLoggingHandlerHost() {
16 }
17
18 WebRtcLoggingHandlerHost::~WebRtcLoggingHandlerHost() {
19 }
20
21 void WebRtcLoggingHandlerHost::OnChannelClosing() {
22 BrowserMessageFilter::OnChannelClosing();
23 }
24
25 void WebRtcLoggingHandlerHost::OnDestruct() const {
26 BrowserThread::DeleteOnIOThread::Destruct(this);
27 }
28
29 bool WebRtcLoggingHandlerHost::OnMessageReceived(const IPC::Message& message,
30 bool* message_was_ok) {
31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
32 bool handled = true;
33 IPC_BEGIN_MESSAGE_MAP_EX(WebRtcLoggingHandlerHost, message, *message_was_ok)
34 IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_OpenLog, OnOpenLog)
35 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP_EX()
37
38 return handled;
39 }
40
41 void WebRtcLoggingHandlerHost::OnOpenLog() {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
43 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle()));
44
45 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) {
46 DLOG(ERROR) << "Failed to create shared memory.";
47 Send(new WebRtcLoggingMsg_OpenLogFailed());
48 return;
49 }
50
51 base::SharedMemoryHandle foreign_memory_handle;
52 if (!shared_memory_.ShareToProcess(peer_handle(),
53 &foreign_memory_handle)) {
54 Send(new WebRtcLoggingMsg_OpenLogFailed());
55 return;
56 }
57
58 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize));
59 }
60
61 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698