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

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

Issue 10694115: Get the audio proxy building as untrusted code for NaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 | « no previous file | ppapi/proxy/resource_creation_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) 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 #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"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, 164 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop,
165 OnMsgStartOrStop) 165 OnMsgStartOrStop)
166 #endif 166 #endif
167 IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, 167 IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated,
168 OnMsgNotifyAudioStreamCreated) 168 OnMsgNotifyAudioStreamCreated)
169 IPC_MESSAGE_UNHANDLED(handled = false) 169 IPC_MESSAGE_UNHANDLED(handled = false)
170 IPC_END_MESSAGE_MAP() 170 IPC_END_MESSAGE_MAP()
171 return handled; 171 return handled;
172 } 172 }
173 173
174 #if !defined(OS_NACL)
175 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, 174 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id,
176 int32_t sample_rate, 175 int32_t sample_rate,
177 uint32_t sample_frame_count, 176 uint32_t sample_frame_count,
178 HostResource* result) { 177 HostResource* result) {
179 thunk::EnterResourceCreation resource_creation(instance_id); 178 thunk::EnterResourceCreation resource_creation(instance_id);
180 if (resource_creation.failed()) 179 if (resource_creation.failed())
181 return; 180 return;
182 181
183 // Make the resource and get the API pointer to its trusted interface. 182 // Make the resource and get the API pointer to its trusted interface.
184 result->SetHostResource( 183 result->SetHostResource(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 return result; 287 return result;
289 288
290 // shared_memory_handle doesn't belong to us: don't close it. 289 // shared_memory_handle doesn't belong to us: don't close it.
291 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 290 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote(
292 IntToPlatformFile(shared_memory_handle), false); 291 IntToPlatformFile(shared_memory_handle), false);
293 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 292 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit())
294 return PP_ERROR_FAILED; 293 return PP_ERROR_FAILED;
295 294
296 return PP_OK; 295 return PP_OK;
297 } 296 }
298 #endif // !defined(OS_NACL)
299 297
300 // Processed in the plugin (message from host). 298 // Processed in the plugin (message from host).
301 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( 299 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated(
302 const HostResource& audio_id, 300 const HostResource& audio_id,
303 int32_t result_code, 301 int32_t result_code,
304 IPC::PlatformFileForTransit socket_handle, 302 IPC::PlatformFileForTransit socket_handle,
305 base::SharedMemoryHandle handle, 303 base::SharedMemoryHandle handle,
306 uint32_t length) { 304 uint32_t length) {
307 EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id); 305 EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id);
308 if (enter.failed() || result_code != PP_OK) { 306 if (enter.failed() || result_code != PP_OK) {
309 // The caller may still have given us these handles in the failure case. 307 // The caller may still have given us these handles in the failure case.
310 // The easiest way to clean these up is to just put them in the objects 308 // The easiest way to clean these up is to just put them in the objects
311 // and then close them. This failure case is not performance critical. 309 // and then close them. This failure case is not performance critical.
312 base::SyncSocket temp_socket( 310 base::SyncSocket temp_socket(
313 IPC::PlatformFileForTransitToPlatformFile(socket_handle)); 311 IPC::PlatformFileForTransitToPlatformFile(socket_handle));
314 base::SharedMemory temp_mem(handle, false); 312 base::SharedMemory temp_mem(handle, false);
315 } else { 313 } else {
316 static_cast<Audio*>(enter.object())->SetStreamInfo( 314 static_cast<Audio*>(enter.object())->SetStreamInfo(
317 enter.resource()->pp_instance(), handle, length, 315 enter.resource()->pp_instance(), handle, length,
318 IPC::PlatformFileForTransitToPlatformFile(socket_handle)); 316 IPC::PlatformFileForTransitToPlatformFile(socket_handle));
319 } 317 }
320 } 318 }
321 319
322 } // namespace proxy 320 } // namespace proxy
323 } // namespace ppapi 321 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | ppapi/proxy/resource_creation_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698