Commit 793202cb authored by teravest@chromium.org's avatar teravest@chromium.org

Autogenerate thunk .cc file for PPB_Audio.


BUG=


Review URL: https://chromiumcodereview.appspot.com/11316335

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171047 0039d316-1c4b-4281-b951-d872f2087c98
parent dcd7e26e
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* realtime stereo audio streaming capabilities. * realtime stereo audio streaming capabilities.
*/ */
[generate_thunk]
label Chrome { label Chrome {
M14 = 1.0 M14 = 1.0
}; };
......
...@@ -2,67 +2,73 @@ ...@@ -2,67 +2,73 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ppapi/thunk/thunk.h" // From ppb_audio.idl modified Tue Dec 4 10:41:02 2012.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/ppb_audio.h"
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h" #include "ppapi/thunk/enter.h"
#include "ppapi/thunk/ppb_audio_api.h" #include "ppapi/thunk/ppb_audio_api.h"
#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/resource_creation_api.h" #include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi { namespace ppapi {
namespace thunk { namespace thunk {
namespace { namespace {
typedef EnterResource<PPB_Audio_API> EnterAudio;
PP_Resource Create(PP_Instance instance, PP_Resource Create(PP_Instance instance,
PP_Resource config_id, PP_Resource config,
PPB_Audio_Callback callback, PPB_Audio_Callback audio_callback,
void* user_data) { void* user_data) {
EnterResourceCreation enter(instance); EnterResourceCreation enter(instance);
if (enter.failed()) if (enter.failed())
return 0; return 0;
return enter.functions()->CreateAudio(instance, config_id, return enter.functions()->CreateAudio(instance,
callback, user_data); config,
audio_callback,
user_data);
} }
PP_Bool IsAudio(PP_Resource resource) { PP_Bool IsAudio(PP_Resource resource) {
EnterAudio enter(resource, false); EnterResource<PPB_Audio_API> enter(resource, false);
return enter.succeeded() ? PP_TRUE : PP_FALSE; return PP_FromBool(enter.succeeded());
} }
PP_Resource GetCurrentConfiguration(PP_Resource audio_id) { PP_Resource GetCurrentConfig(PP_Resource audio) {
EnterAudio enter(audio_id, true); EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed()) if (enter.failed())
return 0; return 0;
return enter.object()->GetCurrentConfig(); return enter.object()->GetCurrentConfig();
} }
PP_Bool StartPlayback(PP_Resource audio_id) { PP_Bool StartPlayback(PP_Resource audio) {
EnterAudio enter(audio_id, true); EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed()) if (enter.failed())
return PP_FALSE; return PP_FALSE;
return enter.object()->StartPlayback(); return enter.object()->StartPlayback();
} }
PP_Bool StopPlayback(PP_Resource audio_id) { PP_Bool StopPlayback(PP_Resource audio) {
EnterAudio enter(audio_id, true); EnterResource<PPB_Audio_API> enter(audio, true);
if (enter.failed()) if (enter.failed())
return PP_FALSE; return PP_FALSE;
return enter.object()->StopPlayback(); return enter.object()->StopPlayback();
} }
const PPB_Audio g_ppb_audio_thunk = { const PPB_Audio_1_0 g_ppb_audio_thunk_1_0 = {
&Create, &Create,
&IsAudio, &IsAudio,
&GetCurrentConfiguration, &GetCurrentConfig,
&StartPlayback, &StartPlayback,
&StopPlayback &StopPlayback,
}; };
} // namespace } // namespace
const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() { const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() {
return &g_ppb_audio_thunk; return &g_ppb_audio_thunk_1_0;
} }
} // namespace thunk } // namespace thunk
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment