ash: Update app list layout:
[chromium-blink-merge.git] / ppapi / thunk / ppb_audio_trusted_thunk.cc
bloba990415341e6361501086da9316e4b057567e996
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/thunk/enter.h"
8 #include "ppapi/thunk/thunk.h"
9 #include "ppapi/thunk/ppb_audio_api.h"
10 #include "ppapi/thunk/resource_creation_api.h"
12 namespace ppapi {
13 namespace thunk {
15 namespace {
17 typedef EnterResource<PPB_Audio_API> EnterAudio;
19 PP_Resource Create(PP_Instance instance_id) {
20 EnterFunction<ResourceCreationAPI> enter(instance_id, true);
21 if (enter.failed())
22 return 0;
23 return enter.functions()->CreateAudioTrusted(instance_id);
26 int32_t Open(PP_Resource audio_id,
27 PP_Resource config_id,
28 PP_CompletionCallback callback) {
29 EnterAudio enter(audio_id, callback, true);
30 if (enter.failed())
31 return enter.retval();
32 return enter.SetResult(enter.object()->OpenTrusted(config_id, callback));
35 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) {
36 EnterAudio enter(audio_id, true);
37 if (enter.failed())
38 return enter.retval();
39 return enter.object()->GetSyncSocket(sync_socket);
42 int32_t GetSharedMemory(PP_Resource audio_id,
43 int* shm_handle,
44 uint32_t* shm_size) {
45 EnterAudio enter(audio_id, true);
46 if (enter.failed())
47 return enter.retval();
48 return enter.object()->GetSharedMemory(shm_handle, shm_size);
51 const PPB_AudioTrusted g_ppb_audio_trusted_thunk = {
52 &Create,
53 &Open,
54 &GetSyncSocket,
55 &GetSharedMemory,
58 } // namespace
60 const PPB_AudioTrusted_0_6* GetPPB_AudioTrusted_0_6_Thunk() {
61 return &g_ppb_audio_trusted_thunk;
64 } // namespace thunk
65 } // namespace ppapi