OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/c/trusted/ppb_audio_trusted.h" | 6 #include "ppapi/c/trusted/ppb_audio_trusted.h" |
| 7 #include "ppapi/shared_impl/tracked_callback.h" |
7 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/thunk.h" | 9 #include "ppapi/thunk/thunk.h" |
9 #include "ppapi/thunk/ppb_audio_api.h" | 10 #include "ppapi/thunk/ppb_audio_api.h" |
10 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
11 | 12 |
12 namespace ppapi { | 13 namespace ppapi { |
13 namespace thunk { | 14 namespace thunk { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 typedef EnterResource<PPB_Audio_API> EnterAudio; | 18 typedef EnterResource<PPB_Audio_API> EnterAudio; |
18 | 19 |
19 PP_Resource Create(PP_Instance instance_id) { | 20 PP_Resource Create(PP_Instance instance_id) { |
20 EnterResourceCreation enter(instance_id); | 21 EnterResourceCreation enter(instance_id); |
21 if (enter.failed()) | 22 if (enter.failed()) |
22 return 0; | 23 return 0; |
23 return enter.functions()->CreateAudioTrusted(instance_id); | 24 return enter.functions()->CreateAudioTrusted(instance_id); |
24 } | 25 } |
25 | 26 |
26 int32_t Open(PP_Resource audio_id, | 27 int32_t Open(PP_Resource audio_id, |
27 PP_Resource config_id, | 28 PP_Resource config_id, |
28 PP_CompletionCallback callback) { | 29 PP_CompletionCallback callback) { |
29 EnterAudio enter(audio_id, callback, true); | 30 EnterAudio enter(audio_id, callback, true); |
30 if (enter.failed()) | 31 if (enter.failed()) |
31 return enter.retval(); | 32 return enter.retval(); |
32 return enter.SetResult(enter.object()->OpenTrusted(config_id, callback)); | 33 return enter.SetResult(enter.object()->OpenTrusted(config_id, |
| 34 enter.callback())); |
33 } | 35 } |
34 | 36 |
35 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { | 37 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { |
36 EnterAudio enter(audio_id, true); | 38 EnterAudio enter(audio_id, true); |
37 if (enter.failed()) | 39 if (enter.failed()) |
38 return enter.retval(); | 40 return enter.retval(); |
39 return enter.object()->GetSyncSocket(sync_socket); | 41 return enter.object()->GetSyncSocket(sync_socket); |
40 } | 42 } |
41 | 43 |
42 int32_t GetSharedMemory(PP_Resource audio_id, | 44 int32_t GetSharedMemory(PP_Resource audio_id, |
(...skipping 13 matching lines...) Expand all Loading... |
56 }; | 58 }; |
57 | 59 |
58 } // namespace | 60 } // namespace |
59 | 61 |
60 const PPB_AudioTrusted_0_6* GetPPB_AudioTrusted_0_6_Thunk() { | 62 const PPB_AudioTrusted_0_6* GetPPB_AudioTrusted_0_6_Thunk() { |
61 return &g_ppb_audio_trusted_thunk; | 63 return &g_ppb_audio_trusted_thunk; |
62 } | 64 } |
63 | 65 |
64 } // namespace thunk | 66 } // namespace thunk |
65 } // namespace ppapi | 67 } // namespace ppapi |
OLD | NEW |