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
3 // found in the LICENSE file.
5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/c/trusted/ppb_audio_trusted.h"
7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/thunk.h"
10 #include "ppapi/thunk/ppb_audio_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
18 typedef EnterResource
<PPB_Audio_API
> EnterAudio
;
20 PP_Resource
Create(PP_Instance instance_id
) {
21 EnterResourceCreation
enter(instance_id
);
24 return enter
.functions()->CreateAudioTrusted(instance_id
);
27 int32_t Open(PP_Resource audio_id
,
28 PP_Resource config_id
,
29 PP_CompletionCallback callback
) {
30 EnterAudio
enter(audio_id
, callback
, true);
32 return enter
.retval();
33 return enter
.SetResult(enter
.object()->OpenTrusted(config_id
,
37 int32_t GetSyncSocket(PP_Resource audio_id
, int* sync_socket
) {
38 EnterAudio
enter(audio_id
, true);
40 return enter
.retval();
41 return enter
.object()->GetSyncSocket(sync_socket
);
44 int32_t GetSharedMemory(PP_Resource audio_id
,
47 EnterAudio
enter(audio_id
, true);
49 return enter
.retval();
50 return enter
.object()->GetSharedMemory(shm_handle
, shm_size
);
53 const PPB_AudioTrusted g_ppb_audio_trusted_thunk
= {
62 const PPB_AudioTrusted_0_6
* GetPPB_AudioTrusted_0_6_Thunk() {
63 return &g_ppb_audio_trusted_thunk
;