Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: ppapi/proxy/ppb_audio_input_proxy.h

Issue 11366038: Rewrite PPB_AudioInput_Dev to use the new-style host/resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_audio_input_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_PPB_AUDIO_INPUT_PROXY_H_
6 #define PPAPI_PROXY_PPB_AUDIO_INPUT_PROXY_H_
7
8 #include <string>
9 #include <utility>
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/shared_memory.h"
14 #include "base/sync_socket.h"
15 #include "ipc/ipc_platform_file.h"
16 #include "ppapi/c/dev/ppb_audio_input_dev.h"
17 #include "ppapi/c/ppb_audio_config.h"
18 #include "ppapi/proxy/interface_proxy.h"
19 #include "ppapi/proxy/proxy_completion_callback_factory.h"
20 #include "ppapi/proxy/serialized_structs.h"
21 #include "ppapi/utility/completion_callback_factory.h"
22
23 namespace ppapi {
24
25 class HostResource;
26 struct DeviceRefData;
27
28 namespace proxy {
29
30 class PPB_AudioInput_Proxy : public InterfaceProxy {
31 public:
32 explicit PPB_AudioInput_Proxy(Dispatcher* dispatcher);
33 virtual ~PPB_AudioInput_Proxy();
34
35 static PP_Resource CreateProxyResource0_1(
36 PP_Instance instance,
37 PP_Resource config,
38 PPB_AudioInput_Callback audio_input_callback,
39 void* user_data);
40
41 static PP_Resource CreateProxyResource(PP_Instance instance);
42
43 // InterfaceProxy implementation.
44 virtual bool OnMessageReceived(const IPC::Message& msg);
45
46 static const ApiID kApiID = API_ID_PPB_AUDIO_INPUT_DEV;
47
48 private:
49 // Message handlers.
50 // Plugin->renderer message handlers.
51 void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result);
52 void OnMsgEnumerateDevices(const ppapi::HostResource& audio_input);
53 void OnMsgOpen(const ppapi::HostResource& audio_input,
54 const std::string& device_id,
55 int32_t sample_rate,
56 uint32_t sample_frame_count);
57 void OnMsgStartOrStop(const ppapi::HostResource& audio_input, bool capture);
58 void OnMsgClose(const ppapi::HostResource& audio_input);
59
60 // Renderer->plugin message handlers.
61 void OnMsgEnumerateDevicesACK(
62 const ppapi::HostResource& audio_input,
63 int32_t result,
64 const std::vector<ppapi::DeviceRefData>& devices);
65 void OnMsgOpenACK(const ppapi::HostResource& audio_input,
66 int32_t result,
67 const ppapi::proxy::SerializedHandle& socket_handle,
68 const ppapi::proxy::SerializedHandle& handle);
69
70 void EnumerateDevicesACKInHost(int32_t result,
71 const ppapi::HostResource& audio_input);
72 void OpenACKInHost(int32_t result, const ppapi::HostResource& audio_input);
73
74 // In the renderer, this is called in response to an OpenACK message.
75 // It will retrieve the shared memory and socket handles and place them into
76 // the given out params. The return value is a PPAPI error code.
77 //
78 // The input arguments should be initialized to 0 or -1, depending on the
79 // platform's default invalid handle values. On error, some of these
80 // arguments may be written to, and others may be untouched, depending on
81 // where the error occurred.
82 int32_t GetAudioInputConnectedHandles(
83 const ppapi::HostResource& resource,
84 IPC::PlatformFileForTransit* foreign_socket_handle,
85 base::SharedMemoryHandle* foreign_shared_memory_handle,
86 uint32_t* shared_memory_length);
87
88 ProxyCompletionCallbackFactory<PPB_AudioInput_Proxy> callback_factory_;
89
90 DISALLOW_COPY_AND_ASSIGN(PPB_AudioInput_Proxy);
91 };
92
93 } // namespace proxy
94 } // namespace ppapi
95
96 #endif // PPAPI_PROXY_PPB_AUDIO_INPUT_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/ppb_audio_input_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698