Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ppapi/thunk/ppb_audio_input_trusted_thunk.cc

Issue 11366038: Rewrite PPB_AudioInput_Dev to use the new-style host/resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/thunk/ppb_audio_input_thunk.cc ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/c/trusted/ppb_audio_input_trusted_dev.h"
7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_audio_input_api.h"
10 #include "ppapi/thunk/resource_creation_api.h"
11 #include "ppapi/thunk/thunk.h"
12
13 namespace ppapi {
14 namespace thunk {
15
16 namespace {
17
18 typedef EnterResource<PPB_AudioInput_API> EnterAudioInput;
19
20 PP_Resource Create(PP_Instance instance_id) {
21 EnterResourceCreation enter(instance_id);
22 if (enter.failed())
23 return 0;
24 return enter.functions()->CreateAudioInput(instance_id);
25 }
26
27 int32_t Open(PP_Resource audio_id,
28 PP_Resource config_id,
29 PP_CompletionCallback callback) {
30 EnterAudioInput enter(audio_id, callback, true);
31 if (enter.failed())
32 return enter.retval();
33 return enter.SetResult(enter.object()->OpenTrusted("", config_id,
34 enter.callback()));
35 }
36
37 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) {
38 EnterAudioInput enter(audio_id, true);
39 if (enter.failed())
40 return enter.retval();
41 return enter.object()->GetSyncSocket(sync_socket);
42 }
43
44 int32_t GetSharedMemory(PP_Resource audio_id,
45 int* shm_handle,
46 uint32_t* shm_size) {
47 EnterAudioInput enter(audio_id, true);
48 if (enter.failed())
49 return enter.retval();
50 return enter.object()->GetSharedMemory(shm_handle, shm_size);
51 }
52
53 const PPB_AudioInputTrusted_Dev g_ppb_audioinput_trusted_thunk = {
54 &Create,
55 &Open,
56 &GetSyncSocket,
57 &GetSharedMemory,
58 };
59
60 } // namespace
61
62 const PPB_AudioInputTrusted_Dev_0_1* GetPPB_AudioInputTrusted_0_1_Thunk() {
63 return &g_ppb_audioinput_trusted_thunk;
64 }
65
66 } // namespace thunk
67 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_audio_input_thunk.cc ('k') | ppapi/thunk/resource_creation_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698