OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
7 #include "ppapi/thunk/common.h" | 7 #include "ppapi/thunk/common.h" |
8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
9 #include "ppapi/thunk/thunk.h" | 9 #include "ppapi/thunk/thunk.h" |
10 #include "ppapi/thunk/ppb_graphics_3d_api.h" | 10 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
11 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
12 | 12 |
13 namespace ppapi { | 13 namespace ppapi { |
14 namespace thunk { | 14 namespace thunk { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; | 18 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; |
19 | 19 |
20 int32_t GetConfigs(PP_Config3D_Dev* configs, | |
21 int32_t config_size, | |
22 int32_t* num_config) { | |
23 // TODO(alokp): Implement me. | |
24 return PP_ERROR_FAILED; | |
25 } | |
26 | |
27 int32_t GetConfigAttribs(PP_Config3D_Dev config, int32_t* attrib_list) { | |
28 // TODO(alokp): Implement me. | |
29 return PP_ERROR_FAILED; | |
30 } | |
31 | |
32 PP_Var GetString(int32_t name) { | 20 PP_Var GetString(int32_t name) { |
33 // TODO(alokp): Implement me. | 21 // TODO(alokp): Implement me. |
34 return PP_MakeUndefined(); | 22 return PP_MakeUndefined(); |
35 } | 23 } |
36 | 24 |
37 PP_Resource Create(PP_Instance instance, | 25 PP_Resource Create(PP_Instance instance, |
38 PP_Config3D_Dev config, | |
39 PP_Resource share_context, | 26 PP_Resource share_context, |
40 const int32_t* attrib_list) { | 27 const int32_t* attrib_list) { |
41 EnterFunction<ResourceCreationAPI> enter(instance, true); | 28 EnterFunction<ResourceCreationAPI> enter(instance, true); |
42 if (enter.failed()) | 29 if (enter.failed()) |
43 return 0; | 30 return 0; |
44 return enter.functions()->CreateGraphics3D(instance, config, share_context, | 31 return enter.functions()->CreateGraphics3D( |
45 attrib_list); | 32 instance, share_context, attrib_list); |
46 } | 33 } |
47 | 34 |
48 PP_Bool IsGraphics3D(PP_Resource resource) { | 35 PP_Bool IsGraphics3D(PP_Resource resource) { |
49 EnterGraphics3D enter(resource, false); | 36 EnterGraphics3D enter(resource, false); |
50 return PP_FromBool(enter.succeeded()); | 37 return PP_FromBool(enter.succeeded()); |
51 } | 38 } |
52 | 39 |
53 int32_t GetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { | 40 int32_t GetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { |
54 EnterGraphics3D enter(graphics_3d, true); | 41 EnterGraphics3D enter(graphics_3d, true); |
55 if (enter.failed()) | 42 if (enter.failed()) |
(...skipping 17 matching lines...) Expand all Loading... |
73 | 60 |
74 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { | 61 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { |
75 EnterGraphics3D enter(graphics_3d, true); | 62 EnterGraphics3D enter(graphics_3d, true); |
76 if (enter.failed()) | 63 if (enter.failed()) |
77 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 64 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
78 int32_t result = enter.object()->SwapBuffers(callback); | 65 int32_t result = enter.object()->SwapBuffers(callback); |
79 return MayForceCallback(callback, result); | 66 return MayForceCallback(callback, result); |
80 } | 67 } |
81 | 68 |
82 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { | 69 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { |
83 &GetConfigs, | |
84 &GetConfigAttribs, | |
85 &GetString, | 70 &GetString, |
86 &Create, | 71 &Create, |
87 &IsGraphics3D, | 72 &IsGraphics3D, |
88 &GetAttribs, | 73 &GetAttribs, |
89 &SetAttribs, | 74 &SetAttribs, |
90 &ResizeBuffers, | 75 &ResizeBuffers, |
91 &SwapBuffers | 76 &SwapBuffers |
92 }; | 77 }; |
93 | 78 |
94 } // namespace | 79 } // namespace |
95 | 80 |
96 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { | 81 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { |
97 return &g_ppb_graphics_3d_thunk; | 82 return &g_ppb_graphics_3d_thunk; |
98 } | 83 } |
99 | 84 |
100 } // namespace thunk | 85 } // namespace thunk |
101 } // namespace ppapi | 86 } // namespace ppapi |
OLD | NEW |