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 // From ../test_thunk/simple.idl modified Fri Nov 16 11:26:06 2012.
7 #include "ppapi/c/../test_thunk/simple.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppb_instance_api.h"
12 #include "ppapi/thunk/resource_creation_api.h"
13 #include "ppapi/thunk/simple_api.h"
14 #include "ppapi/thunk/thunk.h"
21 PP_Resource
Create(PP_Instance instance
) {
22 VLOG(4) << "PPB_Simple::Create()";
23 EnterResourceCreation
enter(instance
);
26 return enter
.functions()->CreateSimple(instance
);
29 PP_Bool
IsSimple(PP_Resource resource
) {
30 VLOG(4) << "PPB_Simple::IsSimple()";
31 EnterResource
<PPB_Simple_API
> enter(resource
, false);
32 return PP_FromBool(enter
.succeeded());
35 void PostMessage(PP_Instance instance
, PP_Var message
) {
36 VLOG(4) << "PPB_Simple::PostMessage()";
37 EnterInstance
enter(instance
);
40 enter
.functions()->PostMessage(instance
, message
);
43 uint32_t DoUint32Instance_0_5(PP_Instance instance
) {
44 VLOG(4) << "PPB_Simple::DoUint32Instance()";
45 EnterInstance
enter(instance
);
48 return enter
.functions()->DoUint32Instance0_5(instance
);
51 uint32_t DoUint32Instance(PP_Instance instance
, PP_Resource resource
) {
52 VLOG(4) << "PPB_Simple::DoUint32Instance()";
53 EnterInstance
enter(instance
);
56 return enter
.functions()->DoUint32Instance(instance
, resource
);
59 uint32_t DoUint32Resource(PP_Resource instance
) {
60 VLOG(4) << "PPB_Simple::DoUint32Resource()";
61 EnterResource
<PPB_Simple_API
> enter(instance
, true);
64 return enter
.object()->DoUint32Resource();
67 uint32_t DoUint32ResourceNoErrors(PP_Resource instance
) {
68 VLOG(4) << "PPB_Simple::DoUint32ResourceNoErrors()";
69 EnterResource
<PPB_Simple_API
> enter(instance
, false);
72 return enter
.object()->DoUint32ResourceNoErrors();
75 int32_t OnFailure12(PP_Instance instance
) {
76 VLOG(4) << "PPB_Simple::OnFailure12()";
77 EnterInstance
enter(instance
);
80 return enter
.functions()->OnFailure12(instance
);
83 const PPB_Simple_0_5 g_ppb_simple_thunk_0_5
= {
87 &DoUint32Instance_0_5
,
89 &DoUint32ResourceNoErrors
92 const PPB_Simple_1_0 g_ppb_simple_thunk_1_0
= {
95 &DoUint32Instance_0_5
,
97 &DoUint32ResourceNoErrors
,
101 const PPB_Simple_1_5 g_ppb_simple_thunk_1_5
= {
106 &DoUint32ResourceNoErrors
,
112 const PPB_Simple_0_5
* GetPPB_Simple_0_5_Thunk() {
113 return &g_ppb_simple_thunk_0_5
;
116 const PPB_Simple_1_0
* GetPPB_Simple_1_0_Thunk() {
117 return &g_ppb_simple_thunk_1_0
;
120 const PPB_Simple_1_5
* GetPPB_Simple_1_5_Thunk() {
121 return &g_ppb_simple_thunk_1_5
;