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

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

Issue 8749017: Pepper: Add some basic tests for PPB_Audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years 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_input_proxy.cc ('k') | ppapi/tests/test_audio.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"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 PPB_Audio_Callback audio_callback, 132 PPB_Audio_Callback audio_callback,
133 void* user_data) { 133 void* user_data) {
134 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); 134 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
135 if (!dispatcher) 135 if (!dispatcher)
136 return 0; 136 return 0;
137 137
138 EnterResourceNoLock<PPB_AudioConfig_API> config(config_id, true); 138 EnterResourceNoLock<PPB_AudioConfig_API> config(config_id, true);
139 if (config.failed()) 139 if (config.failed())
140 return 0; 140 return 0;
141 141
142 if (!audio_callback)
143 return 0;
144
142 HostResource result; 145 HostResource result;
143 dispatcher->Send(new PpapiHostMsg_PPBAudio_Create( 146 dispatcher->Send(new PpapiHostMsg_PPBAudio_Create(
144 API_ID_PPB_AUDIO, instance_id, 147 API_ID_PPB_AUDIO, instance_id,
145 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(), 148 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(),
146 &result)); 149 &result));
147 if (result.is_null()) 150 if (result.is_null())
148 return 0; 151 return 0;
149 152
150 return (new Audio(result, config_id, 153 return (new Audio(result, config_id,
151 audio_callback, user_data))->GetReference(); 154 audio_callback, user_data))->GetReference();
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( 309 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote(
307 IntToPlatformFile(shared_memory_handle), false); 310 IntToPlatformFile(shared_memory_handle), false);
308 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) 311 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit())
309 return PP_ERROR_FAILED; 312 return PP_ERROR_FAILED;
310 313
311 return PP_OK; 314 return PP_OK;
312 } 315 }
313 316
314 } // namespace proxy 317 } // namespace proxy
315 } // namespace ppapi 318 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_audio_input_proxy.cc ('k') | ppapi/tests/test_audio.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698