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

Side by Side Diff: ppapi/proxy/ppb_audio_proxy.cc

Issue 7655002: Convert the pp::proxy namespace to the ppapi::proxy namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months 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
OLDNEW
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 "ppapi/proxy/ppb_audio_proxy.h" 5 #include "ppapi/proxy/ppb_audio_proxy.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/threading/simple_thread.h" 8 #include "base/threading/simple_thread.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_audio.h" 10 #include "ppapi/c/ppb_audio.h"
11 #include "ppapi/c/ppb_audio_config.h" 11 #include "ppapi/c/ppb_audio_config.h"
12 #include "ppapi/c/ppb_var.h" 12 #include "ppapi/c/ppb_var.h"
13 #include "ppapi/c/trusted/ppb_audio_trusted.h" 13 #include "ppapi/c/trusted/ppb_audio_trusted.h"
14 #include "ppapi/proxy/enter_proxy.h" 14 #include "ppapi/proxy/enter_proxy.h"
15 #include "ppapi/proxy/interface_id.h" 15 #include "ppapi/proxy/interface_id.h"
16 #include "ppapi/proxy/plugin_dispatcher.h" 16 #include "ppapi/proxy/plugin_dispatcher.h"
17 #include "ppapi/proxy/ppapi_messages.h" 17 #include "ppapi/proxy/ppapi_messages.h"
18 #include "ppapi/shared_impl/audio_impl.h" 18 #include "ppapi/shared_impl/audio_impl.h"
19 #include "ppapi/shared_impl/resource.h" 19 #include "ppapi/shared_impl/resource.h"
20 #include "ppapi/thunk/ppb_audio_config_api.h" 20 #include "ppapi/thunk/ppb_audio_config_api.h"
21 #include "ppapi/thunk/enter.h" 21 #include "ppapi/thunk/enter.h"
22 #include "ppapi/thunk/resource_creation_api.h" 22 #include "ppapi/thunk/resource_creation_api.h"
23 #include "ppapi/thunk/thunk.h" 23 #include "ppapi/thunk/thunk.h"
24 24
25 using ppapi::HostResource;
26 using ppapi::Resource;
27 using ppapi::thunk::EnterResourceNoLock; 25 using ppapi::thunk::EnterResourceNoLock;
28 using ppapi::thunk::PPB_Audio_API; 26 using ppapi::thunk::PPB_Audio_API;
29 using ppapi::thunk::PPB_AudioConfig_API; 27 using ppapi::thunk::PPB_AudioConfig_API;
30 28
31 namespace pp { 29 namespace ppapi {
32 namespace proxy { 30 namespace proxy {
33 31
34 class Audio : public Resource, public ppapi::AudioImpl { 32 class Audio : public Resource, public AudioImpl {
35 public: 33 public:
36 Audio(const HostResource& audio_id, 34 Audio(const HostResource& audio_id,
37 PP_Resource config_id, 35 PP_Resource config_id,
38 PPB_Audio_Callback callback, 36 PPB_Audio_Callback callback,
39 void* user_data); 37 void* user_data);
40 virtual ~Audio(); 38 virtual ~Audio();
41 39
42 // Resource overrides. 40 // Resource overrides.
43 virtual PPB_Audio_API* AsPPB_Audio_API(); 41 virtual PPB_Audio_API* AsPPB_Audio_API();
44 42
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 : InterfaceProxy(dispatcher, target_interface), 140 : InterfaceProxy(dispatcher, target_interface),
143 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 141 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
144 } 142 }
145 143
146 PPB_Audio_Proxy::~PPB_Audio_Proxy() { 144 PPB_Audio_Proxy::~PPB_Audio_Proxy() {
147 } 145 }
148 146
149 // static 147 // static
150 const InterfaceProxy::Info* PPB_Audio_Proxy::GetInfo() { 148 const InterfaceProxy::Info* PPB_Audio_Proxy::GetInfo() {
151 static const Info info = { 149 static const Info info = {
152 ppapi::thunk::GetPPB_Audio_Thunk(), 150 thunk::GetPPB_Audio_Thunk(),
153 PPB_AUDIO_INTERFACE, 151 PPB_AUDIO_INTERFACE,
154 INTERFACE_ID_PPB_AUDIO, 152 INTERFACE_ID_PPB_AUDIO,
155 false, 153 false,
156 &CreateAudioProxy, 154 &CreateAudioProxy,
157 }; 155 };
158 return &info; 156 return &info;
159 } 157 }
160 158
161 // static 159 // static
162 PP_Resource PPB_Audio_Proxy::CreateProxyResource( 160 PP_Resource PPB_Audio_Proxy::CreateProxyResource(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 OnMsgNotifyAudioStreamCreated) 192 OnMsgNotifyAudioStreamCreated)
195 IPC_MESSAGE_UNHANDLED(handled = false) 193 IPC_MESSAGE_UNHANDLED(handled = false)
196 IPC_END_MESSAGE_MAP() 194 IPC_END_MESSAGE_MAP()
197 return handled; 195 return handled;
198 } 196 }
199 197
200 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, 198 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
201 int32_t sample_rate, 199 int32_t sample_rate,
202 uint32_t sample_frame_count, 200 uint32_t sample_frame_count,
203 HostResource* result) { 201 HostResource* result) {
204 ::ppapi::thunk::EnterFunction< ::ppapi::thunk::ResourceCreationAPI> 202 thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(
205 resource_creation(instance_id, true); 203 instance_id, true);
206 if (resource_creation.failed()) 204 if (resource_creation.failed())
207 return; 205 return;
208 206
209 // Make the resource and get the API pointer to its trusted interface. 207 // Make the resource and get the API pointer to its trusted interface.
210 result->SetHostResource( 208 result->SetHostResource(
211 instance_id, 209 instance_id,
212 resource_creation.functions()->CreateAudioTrusted(instance_id)); 210 resource_creation.functions()->CreateAudioTrusted(instance_id));
213 if (result->is_null()) 211 if (result->is_null())
214 return; 212 return;
215 213
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // shared_memory_handle doesn't belong to us: don't close it. 333 // shared_memory_handle doesn't belong to us: don't close it.
336 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 334 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote(
337 IntToPlatformFile(shared_memory_handle), false); 335 IntToPlatformFile(shared_memory_handle), false);
338 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 336 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit())
339 return PP_ERROR_FAILED; 337 return PP_ERROR_FAILED;
340 338
341 return PP_OK; 339 return PP_OK;
342 } 340 }
343 341
344 } // namespace proxy 342 } // namespace proxy
345 } // namespace pp 343 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698