Bluetooth: clean up Bluetooth classes
[chromium-blink-merge.git] / ppapi / thunk / ppb_graphics_3d_thunk.cc
blobcc006965e05f736b320ae5ec5f7c5e07a4b7ab47
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 ppb_graphics_3d.idl modified Mon Apr 1 08:24:03 2013.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_graphics_3d.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppb_graphics_3d_api.h"
13 #include "ppapi/thunk/ppb_instance_api.h"
14 #include "ppapi/thunk/resource_creation_api.h"
15 #include "ppapi/thunk/thunk.h"
17 namespace ppapi {
18 namespace thunk {
20 namespace {
22 int32_t GetAttribMaxValue(PP_Resource instance,
23 int32_t attribute,
24 int32_t* value) {
25 VLOG(4) << "PPB_Graphics3D::GetAttribMaxValue()";
26 EnterResource<PPB_Graphics3D_API> enter(instance, true);
27 if (enter.failed())
28 return enter.retval();
29 return enter.object()->GetAttribMaxValue(attribute, value);
32 PP_Resource Create(PP_Instance instance,
33 PP_Resource share_context,
34 const int32_t attrib_list[]) {
35 VLOG(4) << "PPB_Graphics3D::Create()";
36 EnterResourceCreation enter(instance);
37 if (enter.failed())
38 return 0;
39 return enter.functions()->CreateGraphics3D(instance,
40 share_context,
41 attrib_list);
44 PP_Bool IsGraphics3D(PP_Resource resource) {
45 VLOG(4) << "PPB_Graphics3D::IsGraphics3D()";
46 EnterResource<PPB_Graphics3D_API> enter(resource, false);
47 return PP_FromBool(enter.succeeded());
50 int32_t GetAttribs(PP_Resource context, int32_t attrib_list[]) {
51 VLOG(4) << "PPB_Graphics3D::GetAttribs()";
52 EnterResource<PPB_Graphics3D_API> enter(context, true);
53 if (enter.failed())
54 return enter.retval();
55 return enter.object()->GetAttribs(attrib_list);
58 int32_t SetAttribs(PP_Resource context, const int32_t attrib_list[]) {
59 VLOG(4) << "PPB_Graphics3D::SetAttribs()";
60 EnterResource<PPB_Graphics3D_API> enter(context, true);
61 if (enter.failed())
62 return enter.retval();
63 return enter.object()->SetAttribs(attrib_list);
66 int32_t GetError(PP_Resource context) {
67 VLOG(4) << "PPB_Graphics3D::GetError()";
68 EnterResource<PPB_Graphics3D_API> enter(context, true);
69 if (enter.failed())
70 return enter.retval();
71 return enter.object()->GetError();
74 int32_t ResizeBuffers(PP_Resource context, int32_t width, int32_t height) {
75 VLOG(4) << "PPB_Graphics3D::ResizeBuffers()";
76 EnterResource<PPB_Graphics3D_API> enter(context, true);
77 if (enter.failed())
78 return enter.retval();
79 return enter.object()->ResizeBuffers(width, height);
82 int32_t SwapBuffers(PP_Resource context,
83 struct PP_CompletionCallback callback) {
84 VLOG(4) << "PPB_Graphics3D::SwapBuffers()";
85 EnterResource<PPB_Graphics3D_API> enter(context, callback, true);
86 if (enter.failed())
87 return enter.retval();
88 return enter.SetResult(enter.object()->SwapBuffers(enter.callback()));
91 const PPB_Graphics3D_1_0 g_ppb_graphics3d_thunk_1_0 = {
92 &GetAttribMaxValue,
93 &Create,
94 &IsGraphics3D,
95 &GetAttribs,
96 &SetAttribs,
97 &GetError,
98 &ResizeBuffers,
99 &SwapBuffers
102 } // namespace
104 const PPB_Graphics3D_1_0* GetPPB_Graphics3D_1_0_Thunk() {
105 return &g_ppb_graphics3d_thunk_1_0;
108 } // namespace thunk
109 } // namespace ppapi