OLD | NEW |
1 // Copyright (c) 2010 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 #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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" |
11 #include "ipc/ipc_platform_file.h" | 11 #include "ipc/ipc_platform_file.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_module.h" | 13 #include "ppapi/c/pp_module.h" |
14 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
15 #include "ppapi/cpp/completion_callback.h" | 15 #include "ppapi/cpp/completion_callback.h" |
16 #include "ppapi/proxy/interface_proxy.h" | 16 #include "ppapi/proxy/interface_proxy.h" |
17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" | 17 #include "ppapi/proxy/proxy_non_thread_safe_ref_count.h" |
18 | 18 |
19 struct PPB_Audio; | 19 struct PPB_Audio; |
20 | 20 |
21 namespace pp { | 21 namespace pp { |
22 namespace proxy { | 22 namespace proxy { |
23 | 23 |
| 24 class AudioChannelConnectedTracking; |
| 25 struct PPBAudio_NotifyAudioStreamCreated_Params; |
| 26 class HostResource; |
| 27 |
24 class PPB_Audio_Proxy : public InterfaceProxy { | 28 class PPB_Audio_Proxy : public InterfaceProxy { |
25 public: | 29 public: |
26 PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface); | 30 PPB_Audio_Proxy(Dispatcher* dispatcher, const void* target_interface); |
27 virtual ~PPB_Audio_Proxy(); | 31 virtual ~PPB_Audio_Proxy(); |
28 | 32 |
29 const PPB_Audio* ppb_audio_target() const { | 33 const PPB_Audio* ppb_audio_target() const { |
30 return static_cast<const PPB_Audio*>(target_interface()); | 34 return static_cast<const PPB_Audio*>(target_interface()); |
31 } | 35 } |
32 | 36 |
33 // InterfaceProxy implementation. | 37 // InterfaceProxy implementation. |
34 virtual const void* GetSourceInterface() const; | 38 virtual const void* GetSourceInterface() const; |
35 virtual InterfaceID GetInterfaceId() const; | 39 virtual InterfaceID GetInterfaceId() const; |
36 virtual bool OnMessageReceived(const IPC::Message& msg); | 40 virtual bool OnMessageReceived(const IPC::Message& msg); |
37 | 41 |
38 private: | 42 private: |
39 // Plugin->renderer message handlers. | 43 // Plugin->renderer message handlers. |
40 void OnMsgCreate(PP_Instance instance_id, | 44 void OnMsgCreate(PP_Instance instance_id, |
41 PP_Resource config_id, | 45 const HostResource& config_id, |
42 PP_Resource* result); | 46 HostResource* result); |
43 void OnMsgStartOrStop(PP_Resource audio_id, bool play); | 47 void OnMsgStartOrStop(const HostResource& audio_id, bool play); |
44 | 48 |
45 // Renderer->plugin message handlers. | 49 // Renderer->plugin message handlers. |
46 void OnMsgNotifyAudioStreamCreated( | 50 void OnMsgNotifyAudioStreamCreated( |
47 PP_Resource audio_id, | 51 const PPBAudio_NotifyAudioStreamCreated_Params& params); |
48 int32_t result_code, | |
49 IPC::PlatformFileForTransit socket_handle, | |
50 base::SharedMemoryHandle shared_memory_handle, | |
51 uint32_t shared_memory_length); | |
52 | 52 |
53 void AudioChannelConnected(int32_t result, PP_Resource resource); | 53 void AudioChannelConnected(int32_t result, |
| 54 AudioChannelConnectedTracking* tracking); |
54 | 55 |
55 // In the renderer, this is called in response to a stream created message. | 56 // In the renderer, this is called in response to a stream created message. |
56 // It will retrieve the shared memory and socket handles and place them into | 57 // It will retrieve the shared memory and socket handles and place them into |
57 // the given out params. The return value is a PPAPI error code. | 58 // the given out params. The return value is a PPAPI error code. |
58 // | 59 // |
59 // The input arguments should be initialized to 0 or -1, depending on the | 60 // The input arguments should be initialized to 0 or -1, depending on the |
60 // platform's default invalid handle values. On error, some of these | 61 // platform's default invalid handle values. On error, some of these |
61 // arguments may be written to, and others may be untouched, depending on | 62 // arguments may be written to, and others may be untouched, depending on |
62 // where the error occurred. | 63 // where the error occurred. |
63 int32_t GetAudioConnectedHandles( | 64 int32_t GetAudioConnectedHandles( |
64 PP_Resource resource, | 65 const HostResource& resource, |
65 IPC::PlatformFileForTransit* foreign_socket_handle, | 66 IPC::PlatformFileForTransit* foreign_socket_handle, |
66 base::SharedMemoryHandle* foreign_shared_memory_handle, | 67 base::SharedMemoryHandle* foreign_shared_memory_handle, |
67 uint32_t* shared_memory_length); | 68 uint32_t* shared_memory_length); |
68 | 69 |
69 CompletionCallbackFactory<PPB_Audio_Proxy, | 70 CompletionCallbackFactory<PPB_Audio_Proxy, |
70 ProxyNonThreadSafeRefCount> callback_factory_; | 71 ProxyNonThreadSafeRefCount> callback_factory_; |
71 | 72 |
72 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy); | 73 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Proxy); |
73 }; | 74 }; |
74 | 75 |
75 } // namespace proxy | 76 } // namespace proxy |
76 } // namespace pp | 77 } // namespace pp |
77 | 78 |
78 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_ | 79 #endif // PPAPI_PROXY_PPB_AUDIO_PROXY_H_ |
OLD | NEW |