OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/pepper/pepper_audio_input_host.h" | 5 #include "content/renderer/pepper/pepper_audio_input_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/common/pepper_file_util.h" | 9 #include "content/common/pepper_file_util.h" |
10 #include "content/renderer/pepper/pepper_media_device_manager.h" | 10 #include "content/renderer/pepper/pepper_media_device_manager.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 int32_t PepperAudioInputHost::GetRemoteHandles( | 165 int32_t PepperAudioInputHost::GetRemoteHandles( |
166 const base::SyncSocket& socket, | 166 const base::SyncSocket& socket, |
167 const base::SharedMemory& shared_memory, | 167 const base::SharedMemory& shared_memory, |
168 IPC::PlatformFileForTransit* remote_socket_handle, | 168 IPC::PlatformFileForTransit* remote_socket_handle, |
169 base::SharedMemoryHandle* remote_shared_memory_handle) { | 169 base::SharedMemoryHandle* remote_shared_memory_handle) { |
170 *remote_socket_handle = renderer_ppapi_host_->ShareHandleWithRemote( | 170 *remote_socket_handle = renderer_ppapi_host_->ShareHandleWithRemote( |
171 ConvertSyncSocketHandle(socket), false); | 171 ConvertSyncSocketHandle(socket), false); |
172 if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit()) | 172 if (*remote_socket_handle == IPC::InvalidPlatformFileForTransit()) |
173 return PP_ERROR_FAILED; | 173 return PP_ERROR_FAILED; |
174 | 174 |
175 *remote_shared_memory_handle = renderer_ppapi_host_->ShareHandleWithRemote( | 175 *remote_shared_memory_handle = |
176 PlatformFileFromSharedMemoryHandle(shared_memory.handle()), false); | 176 renderer_ppapi_host_->ShareSharedMemoryHandleWithRemote( |
177 if (*remote_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) | 177 shared_memory.handle()); |
| 178 if (!base::SharedMemory::IsHandleValid(*remote_shared_memory_handle)) |
178 return PP_ERROR_FAILED; | 179 return PP_ERROR_FAILED; |
179 | 180 |
180 return PP_OK; | 181 return PP_OK; |
181 } | 182 } |
182 | 183 |
183 void PepperAudioInputHost::Close() { | 184 void PepperAudioInputHost::Close() { |
184 if (!audio_input_) | 185 if (!audio_input_) |
185 return; | 186 return; |
186 | 187 |
187 audio_input_->ShutDown(); | 188 audio_input_->ShutDown(); |
188 audio_input_ = NULL; | 189 audio_input_ = NULL; |
189 | 190 |
190 if (open_context_.is_valid()) | 191 if (open_context_.is_valid()) |
191 SendOpenReply(PP_ERROR_ABORTED); | 192 SendOpenReply(PP_ERROR_ABORTED); |
192 } | 193 } |
193 | 194 |
194 void PepperAudioInputHost::SendOpenReply(int32_t result) { | 195 void PepperAudioInputHost::SendOpenReply(int32_t result) { |
195 open_context_.params.set_result(result); | 196 open_context_.params.set_result(result); |
196 host()->SendReply(open_context_, PpapiPluginMsg_AudioInput_OpenReply()); | 197 host()->SendReply(open_context_, PpapiPluginMsg_AudioInput_OpenReply()); |
197 open_context_ = ppapi::host::ReplyMessageContext(); | 198 open_context_ = ppapi::host::ReplyMessageContext(); |
198 } | 199 } |
199 | 200 |
200 } // namespace content | 201 } // namespace content |
OLD | NEW |