| 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 PPAPI_PROXY_PPB_AUDIO_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
| 6 #define PPAPI_PROXY_PPB_AUDIO_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
| 12 #include "base/sync_socket.h" | 12 #include "base/sync_socket.h" |
| 13 #include "ipc/ipc_platform_file.h" | 13 #include "ipc/ipc_platform_file.h" |
| 14 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
| 15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
| 16 #include "ppapi/c/ppb_audio.h" | 16 #include "ppapi/c/ppb_audio.h" |
| 17 #include "ppapi/c/ppb_audio_config.h" | 17 #include "ppapi/c/ppb_audio_config.h" |
| 18 #include "ppapi/proxy/interface_proxy.h" | 18 #include "ppapi/proxy/interface_proxy.h" |
| 19 #include "ppapi/proxy/proxy_completion_callback_factory.h" | 19 #include "ppapi/proxy/proxy_completion_callback_factory.h" |
| 20 #include "ppapi/proxy/serialized_structs.h" |
| 20 #include "ppapi/utility/completion_callback_factory.h" | 21 #include "ppapi/utility/completion_callback_factory.h" |
| 21 | 22 |
| 22 namespace ppapi { | 23 namespace ppapi { |
| 23 | 24 |
| 24 class HostResource; | 25 class HostResource; |
| 25 | 26 |
| 26 namespace proxy { | 27 namespace proxy { |
| 27 | 28 |
| 28 class PPB_Audio_Proxy : public InterfaceProxy { | 29 class PPB_Audio_Proxy : public InterfaceProxy { |
| 29 public: | 30 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // Plugin->renderer message handlers. | 47 // Plugin->renderer message handlers. |
| 47 void OnMsgCreate(PP_Instance instance_id, | 48 void OnMsgCreate(PP_Instance instance_id, |
| 48 int32_t sample_rate, | 49 int32_t sample_rate, |
| 49 uint32_t sample_frame_count, | 50 uint32_t sample_frame_count, |
| 50 ppapi::HostResource* result); | 51 ppapi::HostResource* result); |
| 51 void OnMsgStartOrStop(const ppapi::HostResource& audio_id, bool play); | 52 void OnMsgStartOrStop(const ppapi::HostResource& audio_id, bool play); |
| 52 | 53 |
| 53 // Renderer->plugin message handlers. | 54 // Renderer->plugin message handlers. |
| 54 void OnMsgNotifyAudioStreamCreated(const ppapi::HostResource& audio_id, | 55 void OnMsgNotifyAudioStreamCreated( |
| 55 int32_t result_code, | 56 const ppapi::HostResource& audio_id, |
| 56 IPC::PlatformFileForTransit socket_handle, | 57 int32_t result_code, |
| 57 base::SharedMemoryHandle handle, | 58 ppapi::proxy::SerializedHandle socket_handle, |
| 58 uint32_t length); | 59 ppapi::proxy::SerializedHandle handle); |
| 59 | 60 |
| 60 void AudioChannelConnected(int32_t result, | 61 void AudioChannelConnected(int32_t result, |
| 61 const ppapi::HostResource& resource); | 62 const ppapi::HostResource& resource); |
| 62 | 63 |
| 63 // In the renderer, this is called in response to a stream created message. | 64 // In the renderer, this is called in response to a stream created message. |
| 64 // It will retrieve the shared memory and socket handles and place them into | 65 // It will retrieve the shared memory and socket handles and place them into |
| 65 // the given out params. The return value is a PPAPI error code. | 66 // the given out params. The return value is a PPAPI error code. |
| 66 // | 67 // |
| 67 // The input arguments should be initialized to 0 or -1, depending on the | 68 // The input arguments should be initialized to 0 or -1, depending on the |
| 68 // platform's default invalid handle values. On error, some of these | 69 // platform's default invalid handle values. On error, some of these |
| 69 // arguments may be written to, and others may be untouched, depending on | 70 // arguments may be written to, and others may be untouched, depending on |
| 70 // where the error occurred. | 71 // where the error occurred. |
| 71 int32_t GetAudioConnectedHandles( | 72 int32_t GetAudioConnectedHandles( |
| 72 const ppapi::HostResource& resource, | 73 const ppapi::HostResource& resource, |
| 73 IPC::PlatformFileForTransit* foreign_socket_handle, | 74 IPC::PlatformFileForTransit* foreign_socket_handle, |
| 74 base::SharedMemoryHandle* foreign_shared_memory_handle, | 75 base::SharedMemoryHandle* foreign_shared_memory_handle, |
| 75 uint32_t* shared_memory_length); | 76 uint32_t* shared_memory_length); |
| 76 | 77 |
| 77 ProxyCompletionCallbackFactory<PPB_Audio_Proxy> callback_factory_; | 78 ProxyCompletionCallbackFactory<PPB_Audio_Proxy> callback_factory_; |
| 78 | 79 |
| 79 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy); | 80 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy); |
| 80 }; | 81 }; |
| 81 | 82 |
| 82 } // namespace proxy | 83 } // namespace proxy |
| 83 } // namespace ppapi | 84 } // namespace ppapi |
| 84 | 85 |
| 85 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_ | 86 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
| OLD | NEW |