| 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 PP_Var GetString(int32_t name) { | |
| 21 // TODO(alokp): Implement me. | |
| 22 return PP_MakeUndefined(); | |
| 23 } | |
| 24 | |
| 25 PP_Resource Create(PP_Instance instance, | 20 PP_Resource Create(PP_Instance instance, |
| 26 PP_Resource share_context, | 21 PP_Resource share_context, |
| 27 const int32_t* attrib_list) { | 22 const int32_t* attrib_list) { |
| 28 EnterFunction<ResourceCreationAPI> enter(instance, true); | 23 EnterFunction<ResourceCreationAPI> enter(instance, true); |
| 29 if (enter.failed()) | 24 if (enter.failed()) |
| 30 return 0; | 25 return 0; |
| 31 return enter.functions()->CreateGraphics3D( | 26 return enter.functions()->CreateGraphics3D( |
| 32 instance, share_context, attrib_list); | 27 instance, share_context, attrib_list); |
| 33 } | 28 } |
| 34 | 29 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 60 | 55 |
| 61 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { | 56 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { |
| 62 EnterGraphics3D enter(graphics_3d, true); | 57 EnterGraphics3D enter(graphics_3d, true); |
| 63 if (enter.failed()) | 58 if (enter.failed()) |
| 64 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); | 59 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
| 65 int32_t result = enter.object()->SwapBuffers(callback); | 60 int32_t result = enter.object()->SwapBuffers(callback); |
| 66 return MayForceCallback(callback, result); | 61 return MayForceCallback(callback, result); |
| 67 } | 62 } |
| 68 | 63 |
| 69 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { | 64 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { |
| 70 &GetString, | |
| 71 &Create, | 65 &Create, |
| 72 &IsGraphics3D, | 66 &IsGraphics3D, |
| 73 &GetAttribs, | 67 &GetAttribs, |
| 74 &SetAttribs, | 68 &SetAttribs, |
| 75 &ResizeBuffers, | 69 &ResizeBuffers, |
| 76 &SwapBuffers | 70 &SwapBuffers |
| 77 }; | 71 }; |
| 78 | 72 |
| 79 } // namespace | 73 } // namespace |
| 80 | 74 |
| 81 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { | 75 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { |
| 82 return &g_ppb_graphics_3d_thunk; | 76 return &g_ppb_graphics_3d_thunk; |
| 83 } | 77 } |
| 84 | 78 |
| 85 } // namespace thunk | 79 } // namespace thunk |
| 86 } // namespace ppapi | 80 } // namespace ppapi |
| OLD | NEW |