OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_audio_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_proxy.h" |
6 | 6 |
7 #include "base/threading/simple_thread.h" | 7 #include "base/threading/simple_thread.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/ppb_audio.h" | 9 #include "ppapi/c/ppb_audio.h" |
10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // Make an audio config object. | 201 // Make an audio config object. |
202 PP_Resource audio_config_res = | 202 PP_Resource audio_config_res = |
203 resource_creation.functions()->CreateAudioConfig( | 203 resource_creation.functions()->CreateAudioConfig( |
204 instance_id, static_cast<PP_AudioSampleRate>(sample_rate), | 204 instance_id, static_cast<PP_AudioSampleRate>(sample_rate), |
205 sample_frame_count); | 205 sample_frame_count); |
206 if (!audio_config_res) | 206 if (!audio_config_res) |
207 return; | 207 return; |
208 | 208 |
209 // Initiate opening the audio object. | 209 // Initiate opening the audio object. |
210 CompletionCallback callback = callback_factory_.NewCallback( | 210 CompletionCallback callback = callback_factory_.NewOptionalCallback( |
211 &PPB_Audio_Proxy::AudioChannelConnected, *result); | 211 &PPB_Audio_Proxy::AudioChannelConnected, *result); |
212 int32_t open_error = trusted_audio.object()->OpenTrusted( | 212 int32_t open_error = trusted_audio.object()->OpenTrusted( |
213 audio_config_res, callback.pp_completion_callback()); | 213 audio_config_res, callback.pp_completion_callback()); |
214 if (open_error != PP_OK_COMPLETIONPENDING) | 214 if (open_error != PP_OK_COMPLETIONPENDING) |
215 callback.Run(open_error); | 215 callback.Run(open_error); |
216 | 216 |
217 // Clean up the temporary audio config resource we made. | 217 // Clean up the temporary audio config resource we made. |
218 const PPB_Core* core = static_cast<const PPB_Core*>( | 218 const PPB_Core* core = static_cast<const PPB_Core*>( |
219 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); | 219 dispatcher()->GetLocalInterface(PPB_CORE_INTERFACE)); |
220 core->ReleaseResource(audio_config_res); | 220 core->ReleaseResource(audio_config_res); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( | 309 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( |
310 IntToPlatformFile(shared_memory_handle), false); | 310 IntToPlatformFile(shared_memory_handle), false); |
311 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) | 311 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) |
312 return PP_ERROR_FAILED; | 312 return PP_ERROR_FAILED; |
313 | 313 |
314 return PP_OK; | 314 return PP_OK; |
315 } | 315 } |
316 | 316 |
317 } // namespace proxy | 317 } // namespace proxy |
318 } // namespace pp | 318 } // namespace pp |
OLD | NEW |