| 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 "webkit/plugins/ppapi/ppb_audio_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_audio_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.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" |
| 11 #include "ppapi/c/trusted/ppb_audio_trusted.h" | 11 #include "ppapi/c/trusted/ppb_audio_trusted.h" |
| 12 #include "ppapi/shared_impl/resource_tracker.h" | 12 #include "ppapi/shared_impl/resource_tracker.h" |
| 13 #include "ppapi/shared_impl/tracker_base.h" | 13 #include "ppapi/shared_impl/tracker_base.h" |
| 14 #include "ppapi/thunk/enter.h" | 14 #include "ppapi/thunk/enter.h" |
| 15 #include "ppapi/thunk/ppb_audio_config_api.h" | 15 #include "ppapi/thunk/ppb_audio_config_api.h" |
| 16 #include "ppapi/thunk/thunk.h" | 16 #include "ppapi/thunk/thunk.h" |
| 17 #include "webkit/plugins/ppapi/common.h" | 17 #include "webkit/plugins/ppapi/common.h" |
| 18 #include "webkit/plugins/ppapi/resource_helper.h" | 18 #include "webkit/plugins/ppapi/resource_helper.h" |
| 19 | 19 |
| 20 using ppapi::thunk::EnterResourceNoLock; | 20 using ppapi::thunk::EnterResourceNoLock; |
| 21 using ppapi::thunk::PPB_Audio_API; | 21 using ppapi::thunk::PPB_Audio_API; |
| 22 using ppapi::thunk::PPB_AudioConfig_API; | 22 using ppapi::thunk::PPB_AudioConfig_API; |
| 23 | 23 |
| 24 namespace webkit { | 24 namespace webkit { |
| 25 namespace ppapi { | 25 namespace ppapi { |
| 26 | 26 |
| 27 // PPB_AudioConfig ------------------------------------------------------------- | |
| 28 | |
| 29 PPB_AudioConfig_Impl::PPB_AudioConfig_Impl(PP_Instance instance) | |
| 30 : Resource(instance) { | |
| 31 } | |
| 32 | |
| 33 PPB_AudioConfig_Impl::~PPB_AudioConfig_Impl() { | |
| 34 } | |
| 35 | |
| 36 // static | |
| 37 PP_Resource PPB_AudioConfig_Impl::Create(PP_Instance instance, | |
| 38 PP_AudioSampleRate sample_rate, | |
| 39 uint32_t sample_frame_count) { | |
| 40 scoped_refptr<PPB_AudioConfig_Impl> config( | |
| 41 new PPB_AudioConfig_Impl(instance)); | |
| 42 if (!config->Init(sample_rate, sample_frame_count)) | |
| 43 return 0; | |
| 44 return config->GetReference(); | |
| 45 } | |
| 46 | |
| 47 PPB_AudioConfig_API* PPB_AudioConfig_Impl::AsPPB_AudioConfig_API() { | |
| 48 return this; | |
| 49 } | |
| 50 | |
| 51 // PPB_Audio_Impl -------------------------------------------------------------- | 27 // PPB_Audio_Impl -------------------------------------------------------------- |
| 52 | 28 |
| 53 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) | 29 PPB_Audio_Impl::PPB_Audio_Impl(PP_Instance instance) |
| 54 : Resource(instance), | 30 : Resource(instance), |
| 55 audio_(NULL), | 31 audio_(NULL), |
| 56 create_callback_pending_(false), | 32 create_callback_pending_(false), |
| 57 shared_memory_size_for_create_callback_(0) { | 33 shared_memory_size_for_create_callback_(0) { |
| 58 create_callback_ = PP_MakeCompletionCallback(NULL, NULL); | 34 create_callback_ = PP_MakeCompletionCallback(NULL, NULL); |
| 59 } | 35 } |
| 60 | 36 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 // something more elaborate like an ACK from the plugin or post a task to | 194 // something more elaborate like an ACK from the plugin or post a task to |
| 219 // the I/O thread and back, but this extra complexity doesn't seem worth it | 195 // the I/O thread and back, but this extra complexity doesn't seem worth it |
| 220 // just to clean up these handles faster. | 196 // just to clean up these handles faster. |
| 221 } else { | 197 } else { |
| 222 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); | 198 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); |
| 223 } | 199 } |
| 224 } | 200 } |
| 225 | 201 |
| 226 } // namespace ppapi | 202 } // namespace ppapi |
| 227 } // namespace webkit | 203 } // namespace webkit |
| OLD | NEW |