OLD | NEW |
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/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/thunk/common.h" |
| 7 #include "ppapi/thunk/enter.h" |
6 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
7 #include "ppapi/thunk/enter.h" | |
8 #include "ppapi/thunk/ppb_audio_trusted_api.h" | 9 #include "ppapi/thunk/ppb_audio_trusted_api.h" |
9 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
10 | 11 |
11 namespace ppapi { | 12 namespace ppapi { |
12 namespace thunk { | 13 namespace thunk { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 PP_Resource Create(PP_Instance instance_id) { | 17 PP_Resource Create(PP_Instance instance_id) { |
17 EnterFunction<ResourceCreationAPI> enter(instance_id, true); | 18 EnterFunction<ResourceCreationAPI> enter(instance_id, true); |
18 if (enter.failed()) | 19 if (enter.failed()) |
19 return 0; | 20 return 0; |
20 return enter.functions()->CreateAudioTrusted(instance_id); | 21 return enter.functions()->CreateAudioTrusted(instance_id); |
21 } | 22 } |
22 | 23 |
23 int32_t Open(PP_Resource audio_id, | 24 int32_t Open(PP_Resource audio_id, |
24 PP_Resource config_id, | 25 PP_Resource config_id, |
25 PP_CompletionCallback created) { | 26 PP_CompletionCallback create_callback) { |
26 EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); | 27 EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); |
27 if (enter.failed()) | 28 if (enter.failed()) |
28 return PP_ERROR_BADRESOURCE; | 29 return MayForceCallback(create_callback, PP_ERROR_BADRESOURCE); |
29 return enter.object()->OpenTrusted(config_id, created); | 30 int32_t result = enter.object()->OpenTrusted(config_id, create_callback); |
| 31 return MayForceCallback(create_callback, result); |
30 } | 32 } |
31 | 33 |
32 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { | 34 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { |
33 EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); | 35 EnterResource<PPB_AudioTrusted_API> enter(audio_id, true); |
34 if (enter.failed()) | 36 if (enter.failed()) |
35 return PP_ERROR_BADRESOURCE; | 37 return PP_ERROR_BADRESOURCE; |
36 return enter.object()->GetSyncSocket(sync_socket); | 38 return enter.object()->GetSyncSocket(sync_socket); |
37 } | 39 } |
38 | 40 |
39 int32_t GetSharedMemory(PP_Resource audio_id, | 41 int32_t GetSharedMemory(PP_Resource audio_id, |
(...skipping 13 matching lines...) Expand all Loading... |
53 }; | 55 }; |
54 | 56 |
55 } // namespace | 57 } // namespace |
56 | 58 |
57 const PPB_AudioTrusted* GetPPB_AudioTrusted_Thunk() { | 59 const PPB_AudioTrusted* GetPPB_AudioTrusted_Thunk() { |
58 return &g_ppb_audio_trusted_thunk; | 60 return &g_ppb_audio_trusted_thunk; |
59 } | 61 } |
60 | 62 |
61 } // namespace thunk | 63 } // namespace thunk |
62 } // namespace ppapi | 64 } // namespace ppapi |
OLD | NEW |