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

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

Issue 238923007: PPAPI: Format ppapi/thunk using clang-format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Popen instead, force carriage returns in thunks Created 6 years, 8 months 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
OLDNEW
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/ppb_audio.h" 6 #include "ppapi/c/ppb_audio.h"
7 #include "ppapi/shared_impl/tracked_callback.h" 7 #include "ppapi/shared_impl/tracked_callback.h"
8 #include "ppapi/thunk/enter.h" 8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_audio_api.h" 9 #include "ppapi/thunk/ppb_audio_api.h"
10 #include "ppapi/thunk/ppb_instance_api.h" 10 #include "ppapi/thunk/ppb_instance_api.h"
11 #include "ppapi/thunk/resource_creation_api.h" 11 #include "ppapi/thunk/resource_creation_api.h"
12 #include "ppapi/thunk/thunk.h" 12 #include "ppapi/thunk/thunk.h"
13 13
14 namespace ppapi { 14 namespace ppapi {
15 namespace thunk { 15 namespace thunk {
16 16
17 namespace { 17 namespace {
18 18
19 PP_Resource Create_1_0(PP_Instance instance, 19 PP_Resource Create_1_0(PP_Instance instance,
20 PP_Resource config, 20 PP_Resource config,
21 PPB_Audio_Callback_1_0 audio_callback, 21 PPB_Audio_Callback_1_0 audio_callback,
22 void* user_data) { 22 void* user_data) {
23 VLOG(4) << "PPB_Audio::Create()"; 23 VLOG(4) << "PPB_Audio::Create()";
24 EnterResourceCreation enter(instance); 24 EnterResourceCreation enter(instance);
25 if (enter.failed()) 25 if (enter.failed())
26 return 0; 26 return 0;
27 return enter.functions()->CreateAudio1_0(instance, 27 return enter.functions()->CreateAudio1_0(
28 config, 28 instance, config, audio_callback, user_data);
29 audio_callback,
30 user_data);
31 } 29 }
32 30
33 PP_Resource Create(PP_Instance instance, 31 PP_Resource Create(PP_Instance instance,
34 PP_Resource config, 32 PP_Resource config,
35 PPB_Audio_Callback audio_callback, 33 PPB_Audio_Callback audio_callback,
36 void* user_data) { 34 void* user_data) {
37 VLOG(4) << "PPB_Audio::Create()"; 35 VLOG(4) << "PPB_Audio::Create()";
38 EnterResourceCreation enter(instance); 36 EnterResourceCreation enter(instance);
39 if (enter.failed()) 37 if (enter.failed())
40 return 0; 38 return 0;
41 return enter.functions()->CreateAudio(instance, 39 return enter.functions()->CreateAudio(
42 config, 40 instance, config, audio_callback, user_data);
43 audio_callback,
44 user_data);
45 } 41 }
46 42
47 PP_Bool IsAudio(PP_Resource resource) { 43 PP_Bool IsAudio(PP_Resource resource) {
48 VLOG(4) << "PPB_Audio::IsAudio()"; 44 VLOG(4) << "PPB_Audio::IsAudio()";
49 EnterResource<PPB_Audio_API> enter(resource, false); 45 EnterResource<PPB_Audio_API> enter(resource, false);
50 return PP_FromBool(enter.succeeded()); 46 return PP_FromBool(enter.succeeded());
51 } 47 }
52 48
53 PP_Resource GetCurrentConfig(PP_Resource audio) { 49 PP_Resource GetCurrentConfig(PP_Resource audio) {
54 VLOG(4) << "PPB_Audio::GetCurrentConfig()"; 50 VLOG(4) << "PPB_Audio::GetCurrentConfig()";
(...skipping 13 matching lines...) Expand all
68 64
69 PP_Bool StopPlayback(PP_Resource audio) { 65 PP_Bool StopPlayback(PP_Resource audio) {
70 VLOG(4) << "PPB_Audio::StopPlayback()"; 66 VLOG(4) << "PPB_Audio::StopPlayback()";
71 EnterResource<PPB_Audio_API> enter(audio, true); 67 EnterResource<PPB_Audio_API> enter(audio, true);
72 if (enter.failed()) 68 if (enter.failed())
73 return PP_FALSE; 69 return PP_FALSE;
74 return enter.object()->StopPlayback(); 70 return enter.object()->StopPlayback();
75 } 71 }
76 72
77 const PPB_Audio_1_0 g_ppb_audio_thunk_1_0 = { 73 const PPB_Audio_1_0 g_ppb_audio_thunk_1_0 = {
78 &Create_1_0, 74 &Create_1_0, &IsAudio, &GetCurrentConfig, &StartPlayback, &StopPlayback};
79 &IsAudio,
80 &GetCurrentConfig,
81 &StartPlayback,
82 &StopPlayback
83 };
84 75
85 const PPB_Audio_1_1 g_ppb_audio_thunk_1_1 = { 76 const PPB_Audio_1_1 g_ppb_audio_thunk_1_1 = {
86 &Create, 77 &Create, &IsAudio, &GetCurrentConfig, &StartPlayback, &StopPlayback};
87 &IsAudio,
88 &GetCurrentConfig,
89 &StartPlayback,
90 &StopPlayback
91 };
92 78
93 } // namespace 79 } // namespace
94 80
95 const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() { 81 const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() { return &g_ppb_audio_thunk_1_0; }
96 return &g_ppb_audio_thunk_1_0;
97 }
98 82
99 const PPB_Audio_1_1* GetPPB_Audio_1_1_Thunk() { 83 const PPB_Audio_1_1* GetPPB_Audio_1_1_Thunk() { return &g_ppb_audio_thunk_1_1; }
100 return &g_ppb_audio_thunk_1_1;
101 }
102 84
103 } // namespace thunk 85 } // namespace thunk
104 } // namespace ppapi 86 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698