| OLD | NEW |
| 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 "content/browser/renderer_host/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 "content/common/media/webrtc_logging_messages.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 31 DCHECK(BrowserThread::CurrentlyOn(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(const std::string& app_session_id) { | 41 void WebRtcLoggingHandlerHost::OnOpenLog(const std::string& app_session_id, |
| 42 const std::string& app_url) { |
| 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 43 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle())); | 44 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle())); |
| 44 | 45 |
| 45 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) { | 46 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) { |
| 46 DLOG(ERROR) << "Failed to create shared memory."; | 47 DLOG(ERROR) << "Failed to create shared memory."; |
| 47 Send(new WebRtcLoggingMsg_OpenLogFailed()); | 48 Send(new WebRtcLoggingMsg_OpenLogFailed()); |
| 48 return; | 49 return; |
| 49 } | 50 } |
| 50 | 51 |
| 51 base::SharedMemoryHandle foreign_memory_handle; | 52 base::SharedMemoryHandle foreign_memory_handle; |
| 52 if (!shared_memory_.ShareToProcess(peer_handle(), | 53 if (!shared_memory_.ShareToProcess(peer_handle(), |
| 53 &foreign_memory_handle)) { | 54 &foreign_memory_handle)) { |
| 54 Send(new WebRtcLoggingMsg_OpenLogFailed()); | 55 Send(new WebRtcLoggingMsg_OpenLogFailed()); |
| 55 return; | 56 return; |
| 56 } | 57 } |
| 57 | 58 |
| 58 app_session_id_ = app_session_id; | 59 app_session_id_ = app_session_id; |
| 60 app_url_ = app_url; |
| 59 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize)); | 61 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize)); |
| 60 } | 62 } |
| 61 | 63 |
| 62 } // namespace content | 64 } // namespace content |
| OLD | NEW |