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

Side by Side Diff: chrome/browser/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: 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 #include "content/browser/renderer_host/media/webrtc_logging_handler_host.h" 5 #include "chrome/browser/media/webrtc_logging_handler_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/common/media/webrtc_logging_messages.h" 9 #include "chrome/common/media/webrtc_logging_messages.h"
10 10
11 namespace content { 11 namespace chrome {
12 12
13 const size_t kWebRtcLogSize = 6 * 1024 * 1024; // 6 MB 13 const size_t kWebRtcLogSize = 6 * 1024 * 1024; // 6 MB
14 14
15 WebRtcLoggingHandlerHost::WebRtcLoggingHandlerHost() { 15 WebRtcLoggingHandlerHost::WebRtcLoggingHandlerHost() {
16 } 16 }
17 17
18 WebRtcLoggingHandlerHost::~WebRtcLoggingHandlerHost() { 18 WebRtcLoggingHandlerHost::~WebRtcLoggingHandlerHost() {
19 } 19 }
20 20
21 void WebRtcLoggingHandlerHost::OnChannelClosing() { 21 void WebRtcLoggingHandlerHost::OnChannelClosing() {
22 BrowserMessageFilter::OnChannelClosing(); 22 content::BrowserMessageFilter::OnChannelClosing();
23 } 23 }
24 24
25 void WebRtcLoggingHandlerHost::OnDestruct() const { 25 void WebRtcLoggingHandlerHost::OnDestruct() const {
26 BrowserThread::DeleteOnIOThread::Destruct(this); 26 content::BrowserThread::DeleteOnIOThread::Destruct(this);
27 } 27 }
28 28
29 bool WebRtcLoggingHandlerHost::OnMessageReceived(const IPC::Message& message, 29 bool WebRtcLoggingHandlerHost::OnMessageReceived(const IPC::Message& message,
30 bool* message_was_ok) { 30 bool* message_was_ok) {
31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 31 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
32 bool handled = true; 32 bool handled = true;
33 IPC_BEGIN_MESSAGE_MAP_EX(WebRtcLoggingHandlerHost, message, *message_was_ok) 33 IPC_BEGIN_MESSAGE_MAP_EX(WebRtcLoggingHandlerHost, message, *message_was_ok)
34 IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_OpenLog, OnOpenLog) 34 IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_OpenLog, OnOpenLog)
35 IPC_MESSAGE_UNHANDLED(handled = false) 35 IPC_MESSAGE_UNHANDLED(handled = false)
36 IPC_END_MESSAGE_MAP_EX() 36 IPC_END_MESSAGE_MAP_EX()
37 37
38 return handled; 38 return handled;
39 } 39 }
40 40
41 void WebRtcLoggingHandlerHost::OnOpenLog() { 41 void WebRtcLoggingHandlerHost::OnOpenLog() {
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
43 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle())); 43 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle()));
44 44
45 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) { 45 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) {
46 DLOG(ERROR) << "Failed to create shared memory."; 46 DLOG(ERROR) << "Failed to create shared memory.";
47 Send(new WebRtcLoggingMsg_OpenLogFailed()); 47 Send(new WebRtcLoggingMsg_OpenLogFailed());
48 return; 48 return;
49 } 49 }
50 50
51 base::SharedMemoryHandle foreign_memory_handle; 51 base::SharedMemoryHandle foreign_memory_handle;
52 if (!shared_memory_.ShareToProcess(peer_handle(), 52 if (!shared_memory_.ShareToProcess(peer_handle(),
53 &foreign_memory_handle)) { 53 &foreign_memory_handle)) {
54 Send(new WebRtcLoggingMsg_OpenLogFailed()); 54 Send(new WebRtcLoggingMsg_OpenLogFailed());
55 return; 55 return;
56 } 56 }
57 57
58 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize)); 58 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize));
59 } 59 }
60 60
61 } // namespace content 61 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698