| 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 24 matching lines...) Expand all Loading... |
| 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 35 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 36 bool handled = true; | 36 bool handled = true; |
| 37 IPC_BEGIN_MESSAGE_MAP_EX(WebRtcLoggingHandlerHost, message, *message_was_ok) | 37 IPC_BEGIN_MESSAGE_MAP_EX(WebRtcLoggingHandlerHost, message, *message_was_ok) |
| 38 IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_OpenLog, OnOpenLog) | 38 IPC_MESSAGE_HANDLER(WebRtcLoggingMsg_OpenLog, OnOpenLog) |
| 39 IPC_MESSAGE_UNHANDLED(handled = false) | 39 IPC_MESSAGE_UNHANDLED(handled = false) |
| 40 IPC_END_MESSAGE_MAP_EX() | 40 IPC_END_MESSAGE_MAP_EX() |
| 41 | 41 |
| 42 return handled; | 42 return handled; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void WebRtcLoggingHandlerHost::OnOpenLog(const std::string& app_session_id) { | 45 void WebRtcLoggingHandlerHost::OnOpenLog(const std::string& app_session_id, |
| 46 const std::string& app_url) { |
| 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 47 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle())); | 48 DCHECK(!base::SharedMemory::IsHandleValid(shared_memory_.handle())); |
| 48 | 49 |
| 49 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) { | 50 if (!shared_memory_.CreateAndMapAnonymous(kWebRtcLogSize)) { |
| 50 DLOG(ERROR) << "Failed to create shared memory."; | 51 DLOG(ERROR) << "Failed to create shared memory."; |
| 51 Send(new WebRtcLoggingMsg_OpenLogFailed()); | 52 Send(new WebRtcLoggingMsg_OpenLogFailed()); |
| 52 return; | 53 return; |
| 53 } | 54 } |
| 54 | 55 |
| 55 base::SharedMemoryHandle foreign_memory_handle; | 56 base::SharedMemoryHandle foreign_memory_handle; |
| 56 if (!shared_memory_.ShareToProcess(peer_handle(), | 57 if (!shared_memory_.ShareToProcess(peer_handle(), |
| 57 &foreign_memory_handle)) { | 58 &foreign_memory_handle)) { |
| 58 Send(new WebRtcLoggingMsg_OpenLogFailed()); | 59 Send(new WebRtcLoggingMsg_OpenLogFailed()); |
| 59 return; | 60 return; |
| 60 } | 61 } |
| 61 | 62 |
| 62 app_session_id_ = app_session_id; | 63 app_session_id_ = app_session_id; |
| 64 app_url_ = app_url; |
| 63 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize)); | 65 Send(new WebRtcLoggingMsg_LogOpened(foreign_memory_handle, kWebRtcLogSize)); |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace content | 68 } // namespace content |
| OLD | NEW |