| 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" |
| 8 #include "ppapi/thunk/enter.h" |
| 7 #include "ppapi/thunk/thunk.h" | 9 #include "ppapi/thunk/thunk.h" |
| 8 #include "ppapi/thunk/enter.h" | |
| 9 #include "ppapi/thunk/ppb_graphics_3d_api.h" | 10 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
| 11 | 12 |
| 12 namespace ppapi { | 13 namespace ppapi { |
| 13 namespace thunk { | 14 namespace thunk { |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; | 18 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; |
| 18 | 19 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 int32_t SetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { | 60 int32_t SetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { |
| 60 EnterGraphics3D enter(graphics_3d, true); | 61 EnterGraphics3D enter(graphics_3d, true); |
| 61 if (enter.failed()) | 62 if (enter.failed()) |
| 62 return PP_ERROR_BADRESOURCE; | 63 return PP_ERROR_BADRESOURCE; |
| 63 return enter.object()->SetAttribs(attrib_list); | 64 return enter.object()->SetAttribs(attrib_list); |
| 64 } | 65 } |
| 65 | 66 |
| 66 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { | 67 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { |
| 67 EnterGraphics3D enter(graphics_3d, true); | 68 EnterGraphics3D enter(graphics_3d, true); |
| 68 if (enter.failed()) | 69 if (enter.failed()) |
| 69 return PP_ERROR_BADRESOURCE; | 70 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
| 70 return enter.object()->SwapBuffers(callback); | 71 int32_t result = enter.object()->SwapBuffers(callback); |
| 72 return MayForceCallback(callback, result); |
| 71 } | 73 } |
| 72 | 74 |
| 73 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { | 75 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { |
| 74 &GetConfigs, | 76 &GetConfigs, |
| 75 &GetConfigAttribs, | 77 &GetConfigAttribs, |
| 76 &GetString, | 78 &GetString, |
| 77 &Create, | 79 &Create, |
| 78 &IsGraphics3D, | 80 &IsGraphics3D, |
| 79 &GetAttribs, | 81 &GetAttribs, |
| 80 &SetAttribs, | 82 &SetAttribs, |
| 81 &SwapBuffers | 83 &SwapBuffers |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 } // namespace | 86 } // namespace |
| 85 | 87 |
| 86 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { | 88 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { |
| 87 return &g_ppb_graphics_3d_thunk; | 89 return &g_ppb_graphics_3d_thunk; |
| 88 } | 90 } |
| 89 | 91 |
| 90 } // namespace thunk | 92 } // namespace thunk |
| 91 } // namespace ppapi | 93 } // namespace ppapi |
| OLD | NEW |