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

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

Issue 8333004: Rename InterfaceID to ApiID and move the file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged Created 9 years, 2 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
« no previous file with comments | « ppapi/proxy/ppb_audio_proxy.h ('k') | ppapi/proxy/ppb_broker_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
16 #include "ppapi/proxy/plugin_dispatcher.h" 15 #include "ppapi/proxy/plugin_dispatcher.h"
17 #include "ppapi/proxy/ppapi_messages.h" 16 #include "ppapi/proxy/ppapi_messages.h"
17 #include "ppapi/shared_impl/api_id.h"
18 #include "ppapi/shared_impl/audio_impl.h" 18 #include "ppapi/shared_impl/audio_impl.h"
19 #include "ppapi/shared_impl/ppapi_globals.h" 19 #include "ppapi/shared_impl/ppapi_globals.h"
20 #include "ppapi/shared_impl/resource.h" 20 #include "ppapi/shared_impl/resource.h"
21 #include "ppapi/thunk/ppb_audio_config_api.h" 21 #include "ppapi/thunk/ppb_audio_config_api.h"
22 #include "ppapi/thunk/enter.h" 22 #include "ppapi/thunk/enter.h"
23 #include "ppapi/thunk/resource_creation_api.h" 23 #include "ppapi/thunk/resource_creation_api.h"
24 #include "ppapi/thunk/thunk.h" 24 #include "ppapi/thunk/thunk.h"
25 25
26 using ppapi::thunk::EnterResourceNoLock; 26 using ppapi::thunk::EnterResourceNoLock;
27 using ppapi::thunk::PPB_Audio_API; 27 using ppapi::thunk::PPB_Audio_API;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_); 81 PpapiGlobals::Get()->GetResourceTracker()->AddRefResource(config_);
82 return config_; 82 return config_;
83 } 83 }
84 84
85 PP_Bool Audio::StartPlayback() { 85 PP_Bool Audio::StartPlayback() {
86 if (playing()) 86 if (playing())
87 return PP_TRUE; 87 return PP_TRUE;
88 SetStartPlaybackState(); 88 SetStartPlaybackState();
89 PluginDispatcher::GetForResource(this)->Send( 89 PluginDispatcher::GetForResource(this)->Send(
90 new PpapiHostMsg_PPBAudio_StartOrStop( 90 new PpapiHostMsg_PPBAudio_StartOrStop(
91 INTERFACE_ID_PPB_AUDIO, host_resource(), true)); 91 API_ID_PPB_AUDIO, host_resource(), true));
92 return PP_TRUE; 92 return PP_TRUE;
93 } 93 }
94 94
95 PP_Bool Audio::StopPlayback() { 95 PP_Bool Audio::StopPlayback() {
96 if (!playing()) 96 if (!playing())
97 return PP_TRUE; 97 return PP_TRUE;
98 PluginDispatcher::GetForResource(this)->Send( 98 PluginDispatcher::GetForResource(this)->Send(
99 new PpapiHostMsg_PPBAudio_StartOrStop( 99 new PpapiHostMsg_PPBAudio_StartOrStop(
100 INTERFACE_ID_PPB_AUDIO, host_resource(), false)); 100 API_ID_PPB_AUDIO, host_resource(), false));
101 SetStopPlaybackState(); 101 SetStopPlaybackState();
102 return PP_TRUE; 102 return PP_TRUE;
103 } 103 }
104 104
105 int32_t Audio::OpenTrusted(PP_Resource config_id, 105 int32_t Audio::OpenTrusted(PP_Resource config_id,
106 PP_CompletionCallback create_callback) { 106 PP_CompletionCallback create_callback) {
107 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface. 107 return PP_ERROR_NOTSUPPORTED; // Don't proxy the trusted interface.
108 } 108 }
109 109
110 int32_t Audio::GetSyncSocket(int* sync_socket) { 110 int32_t Audio::GetSyncSocket(int* sync_socket) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); 148 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
149 if (!dispatcher) 149 if (!dispatcher)
150 return 0; 150 return 0;
151 151
152 EnterResourceNoLock<PPB_AudioConfig_API> config(config_id, true); 152 EnterResourceNoLock<PPB_AudioConfig_API> config(config_id, true);
153 if (config.failed()) 153 if (config.failed())
154 return 0; 154 return 0;
155 155
156 HostResource result; 156 HostResource result;
157 dispatcher->Send(new PpapiHostMsg_PPBAudio_Create( 157 dispatcher->Send(new PpapiHostMsg_PPBAudio_Create(
158 INTERFACE_ID_PPB_AUDIO, instance_id, 158 API_ID_PPB_AUDIO, instance_id,
159 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(), 159 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(),
160 &result)); 160 &result));
161 if (result.is_null()) 161 if (result.is_null())
162 return 0; 162 return 0;
163 163
164 return (new Audio(result, config_id, 164 return (new Audio(result, config_id,
165 audio_callback, user_data))->GetReference(); 165 audio_callback, user_data))->GetReference();
166 } 166 }
167 167
168 bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { 168 bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 &shared_memory, 276 &shared_memory,
277 &shared_memory_length); 277 &shared_memory_length);
278 } 278 }
279 279
280 // Send all the values, even on error. This simplifies some of our cleanup 280 // Send all the values, even on error. This simplifies some of our cleanup
281 // code since the handles will be in the other process and could be 281 // code since the handles will be in the other process and could be
282 // inconvenient to clean up. Our IPC code will automatically handle this for 282 // inconvenient to clean up. Our IPC code will automatically handle this for
283 // us, as long as the remote side always closes the handles it receives 283 // us, as long as the remote side always closes the handles it receives
284 // (in OnMsgNotifyAudioStreamCreated), even in the failure case. 284 // (in OnMsgNotifyAudioStreamCreated), even in the failure case.
285 dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated( 285 dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated(
286 INTERFACE_ID_PPB_AUDIO, resource, result_code, socket_handle, 286 API_ID_PPB_AUDIO, resource, result_code, socket_handle,
287 shared_memory, shared_memory_length)); 287 shared_memory, shared_memory_length));
288 } 288 }
289 289
290 int32_t PPB_Audio_Proxy::GetAudioConnectedHandles( 290 int32_t PPB_Audio_Proxy::GetAudioConnectedHandles(
291 const HostResource& resource, 291 const HostResource& resource,
292 IPC::PlatformFileForTransit* foreign_socket_handle, 292 IPC::PlatformFileForTransit* foreign_socket_handle,
293 base::SharedMemoryHandle* foreign_shared_memory_handle, 293 base::SharedMemoryHandle* foreign_shared_memory_handle,
294 uint32_t* shared_memory_length) { 294 uint32_t* shared_memory_length) {
295 // Get the audio interface which will give us the handles. 295 // Get the audio interface which will give us the handles.
296 EnterHostFromHostResource<PPB_Audio_API> enter(resource); 296 EnterHostFromHostResource<PPB_Audio_API> enter(resource);
(...skipping 23 matching lines...) Expand all
320 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 320 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote(
321 IntToPlatformFile(shared_memory_handle), false); 321 IntToPlatformFile(shared_memory_handle), false);
322 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 322 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit())
323 return PP_ERROR_FAILED; 323 return PP_ERROR_FAILED;
324 324
325 return PP_OK; 325 return PP_OK;
326 } 326 }
327 327
328 } // namespace proxy 328 } // namespace proxy
329 } // namespace ppapi 329 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_audio_proxy.h ('k') | ppapi/proxy/ppb_broker_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698