| 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_input_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_audio_input_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/c/dev/ppb_audio_input_dev.h" | 8 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/ppb_audio_config.h" | 10 #include "ppapi/c/ppb_audio_config.h" |
| 11 #include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h" | 11 #include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h" |
| 12 #include "ppapi/shared_impl/resource_tracker.h" | 12 #include "ppapi/shared_impl/resource_tracker.h" |
| 13 #include "ppapi/thunk/enter.h" | 13 #include "ppapi/thunk/enter.h" |
| 14 #include "ppapi/thunk/ppb_audio_config_api.h" | 14 #include "ppapi/thunk/ppb_audio_config_api.h" |
| 15 #include "ppapi/thunk/thunk.h" | 15 #include "ppapi/thunk/thunk.h" |
| 16 #include "webkit/plugins/ppapi/common.h" | 16 #include "webkit/plugins/ppapi/common.h" |
| 17 #include "webkit/plugins/ppapi/resource_helper.h" | 17 #include "webkit/plugins/ppapi/resource_helper.h" |
| 18 | 18 |
| 19 using ppapi::PpapiGlobals; | 19 using ppapi::PpapiGlobals; |
| 20 using ppapi::thunk::EnterResourceNoLock; | 20 using ppapi::thunk::EnterResourceNoLock; |
| 21 using ppapi::thunk::PPB_AudioInput_API; | 21 using ppapi::thunk::PPB_AudioInput_API; |
| 22 using ppapi::thunk::PPB_AudioConfig_API; | 22 using ppapi::thunk::PPB_AudioConfig_API; |
| 23 using ppapi::TrackedCallback; |
| 23 | 24 |
| 24 namespace webkit { | 25 namespace webkit { |
| 25 namespace ppapi { | 26 namespace ppapi { |
| 26 | 27 |
| 27 // PPB_AudioInput_Impl --------------------------------------------------------- | 28 // PPB_AudioInput_Impl --------------------------------------------------------- |
| 28 | 29 |
| 29 PPB_AudioInput_Impl::PPB_AudioInput_Impl(PP_Instance instance) | 30 PPB_AudioInput_Impl::PPB_AudioInput_Impl(PP_Instance instance) |
| 30 : Resource(instance), | 31 : Resource(instance), |
| 31 audio_input_(NULL) { | 32 audio_input_(NULL) { |
| 32 } | 33 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 enter.object()->GetSampleRate(), | 132 enter.object()->GetSampleRate(), |
| 132 enter.object()->GetSampleFrameCount(), | 133 enter.object()->GetSampleFrameCount(), |
| 133 this); | 134 this); |
| 134 | 135 |
| 135 if (!audio_input_) | 136 if (!audio_input_) |
| 136 return PP_ERROR_FAILED; | 137 return PP_ERROR_FAILED; |
| 137 | 138 |
| 138 // At this point, we are guaranteeing ownership of the completion | 139 // At this point, we are guaranteeing ownership of the completion |
| 139 // callback. Audio promises to fire the completion callback | 140 // callback. Audio promises to fire the completion callback |
| 140 // once and only once. | 141 // once and only once. |
| 141 SetCallbackInfo(true, create_callback); | 142 SetCreateCallback(new TrackedCallback(this, create_callback)); |
| 142 return PP_OK_COMPLETIONPENDING; | 143 return PP_OK_COMPLETIONPENDING; |
| 143 } | 144 } |
| 144 | 145 |
| 145 int32_t PPB_AudioInput_Impl::GetSyncSocket(int* sync_socket) { | 146 int32_t PPB_AudioInput_Impl::GetSyncSocket(int* sync_socket) { |
| 146 return GetSyncSocketImpl(sync_socket); | 147 return GetSyncSocketImpl(sync_socket); |
| 147 } | 148 } |
| 148 | 149 |
| 149 int32_t PPB_AudioInput_Impl::GetSharedMemory(int* shm_handle, | 150 int32_t PPB_AudioInput_Impl::GetSharedMemory(int* shm_handle, |
| 150 uint32_t* shm_size) { | 151 uint32_t* shm_size) { |
| 151 return GetSharedMemoryImpl(shm_handle, shm_size); | 152 return GetSharedMemoryImpl(shm_handle, shm_size); |
| 152 } | 153 } |
| 153 | 154 |
| 154 void PPB_AudioInput_Impl::OnSetStreamInfo( | 155 void PPB_AudioInput_Impl::OnSetStreamInfo( |
| 155 base::SharedMemoryHandle shared_memory_handle, | 156 base::SharedMemoryHandle shared_memory_handle, |
| 156 size_t shared_memory_size, | 157 size_t shared_memory_size, |
| 157 base::SyncSocket::Handle socket_handle) { | 158 base::SyncSocket::Handle socket_handle) { |
| 158 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); | 159 SetStreamInfo(shared_memory_handle, shared_memory_size, socket_handle); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace ppapi | 162 } // namespace ppapi |
| 162 } // namespace webkit | 163 } // namespace webkit |
| OLD | NEW |