| 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "ppapi/shared_impl/ppb_audio_input_shared.h" | 14 #include "ppapi/shared_impl/ppb_audio_input_shared.h" |
| 15 #include "webkit/plugins/ppapi/plugin_delegate.h" | 15 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 16 | 16 |
| 17 namespace webkit { | 17 namespace webkit { |
| 18 namespace ppapi { | 18 namespace ppapi { |
| 19 | 19 |
| 20 // Some of the backend functionality of this class is implemented by the | 20 // Some of the backend functionality of this class is implemented by the |
| 21 // PPB_AudioInput_Shared so it can be shared with the proxy. | 21 // PPB_AudioInput_Shared so it can be shared with the proxy. |
| 22 class PPB_AudioInput_Impl : public ::ppapi::PPB_AudioInput_Shared, | 22 class PPB_AudioInput_Impl : public ::ppapi::PPB_AudioInput_Shared, |
| 23 public PluginDelegate::PlatformAudioCommonClient, | 23 public PluginDelegate::PlatformAudioInputClient, |
| 24 public base::SupportsWeakPtr<PPB_AudioInput_Impl> { | 24 public base::SupportsWeakPtr<PPB_AudioInput_Impl> { |
| 25 public: | 25 public: |
| 26 typedef std::vector< ::ppapi::DeviceRefData> DeviceRefDataVector; | 26 typedef std::vector< ::ppapi::DeviceRefData> DeviceRefDataVector; |
| 27 | 27 |
| 28 explicit PPB_AudioInput_Impl(PP_Instance instance); | 28 explicit PPB_AudioInput_Impl(PP_Instance instance); |
| 29 virtual ~PPB_AudioInput_Impl(); | 29 virtual ~PPB_AudioInput_Impl(); |
| 30 | 30 |
| 31 // Creation function for the v0.1 interface. This handles all initialization | 31 // Creation function for the v0.1 interface. This handles all initialization |
| 32 // and will return 0 on failure. | 32 // and will return 0 on failure. |
| 33 static PP_Resource Create0_1(PP_Instance instance, | 33 static PP_Resource Create0_1(PP_Instance instance, |
| 34 PP_Resource config, | 34 PP_Resource config, |
| 35 PPB_AudioInput_Callback audio_input_callback, | 35 PPB_AudioInput_Callback audio_input_callback, |
| 36 void* user_data); | 36 void* user_data); |
| 37 | 37 |
| 38 // Implementation of PPB_AudioInput_API trusted methods. | 38 // Implementation of PPB_AudioInput_API trusted methods. |
| 39 virtual int32_t OpenTrusted(const std::string& device_id, | 39 virtual int32_t OpenTrusted(const std::string& device_id, |
| 40 PP_Resource config, | 40 PP_Resource config, |
| 41 PP_CompletionCallback create_callback) OVERRIDE; | 41 PP_CompletionCallback create_callback) OVERRIDE; |
| 42 virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE; | 42 virtual int32_t GetSyncSocket(int* sync_socket) OVERRIDE; |
| 43 virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE; | 43 virtual int32_t GetSharedMemory(int* shm_handle, uint32_t* shm_size) OVERRIDE; |
| 44 virtual const DeviceRefDataVector& GetDeviceRefData() const OVERRIDE; | 44 virtual const DeviceRefDataVector& GetDeviceRefData() const OVERRIDE; |
| 45 | 45 |
| 46 // PluginDelegate::PlatformAudioCommonClient implementation. | 46 // PluginDelegate::PlatformAudioInputClient implementation. |
| 47 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, | 47 virtual void StreamCreated(base::SharedMemoryHandle shared_memory_handle, |
| 48 size_t shared_memory_size, | 48 size_t shared_memory_size, |
| 49 base::SyncSocket::Handle socket) OVERRIDE; | 49 base::SyncSocket::Handle socket) OVERRIDE; |
| 50 virtual void StreamCreationFailed() OVERRIDE; |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 // PPB_AudioInput_Shared implementation. | 53 // PPB_AudioInput_Shared implementation. |
| 53 virtual int32_t InternalEnumerateDevices( | 54 virtual int32_t InternalEnumerateDevices( |
| 54 PP_Resource* devices, | 55 PP_Resource* devices, |
| 55 PP_CompletionCallback callback) OVERRIDE; | 56 PP_CompletionCallback callback) OVERRIDE; |
| 56 virtual int32_t InternalOpen(const std::string& device_id, | 57 virtual int32_t InternalOpen(const std::string& device_id, |
| 57 PP_AudioSampleRate sample_rate, | 58 PP_AudioSampleRate sample_rate, |
| 58 uint32_t sample_frame_count, | 59 uint32_t sample_frame_count, |
| 59 PP_CompletionCallback callback) OVERRIDE; | 60 PP_CompletionCallback callback) OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 | 72 |
| 72 DeviceRefDataVector devices_data_; | 73 DeviceRefDataVector devices_data_; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(PPB_AudioInput_Impl); | 75 DISALLOW_COPY_AND_ASSIGN(PPB_AudioInput_Impl); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace ppapi | 78 } // namespace ppapi |
| 78 } // namespace webkit | 79 } // namespace webkit |
| 79 | 80 |
| 80 #endif // WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_ | 81 #endif // WEBKIT_PLUGINS_PPAPI_PPB_AUDIO_INPUT_IMPL_H_ |
| OLD | NEW |