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_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/thunk/common.h" |
| 7 #include "ppapi/thunk/enter.h" |
6 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
7 #include "ppapi/thunk/enter.h" | |
8 #include "ppapi/thunk/ppb_surface_3d_api.h" | 9 #include "ppapi/thunk/ppb_surface_3d_api.h" |
9 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
10 | 11 |
11 namespace ppapi { | 12 namespace ppapi { |
12 namespace thunk { | 13 namespace thunk { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 PP_Resource Create(PP_Instance instance, | 17 PP_Resource Create(PP_Instance instance, |
17 PP_Config3D_Dev config, | 18 PP_Config3D_Dev config, |
(...skipping 22 matching lines...) Expand all Loading... |
40 EnterResource<PPB_Surface3D_API> enter(surface, true); | 41 EnterResource<PPB_Surface3D_API> enter(surface, true); |
41 if (enter.failed()) | 42 if (enter.failed()) |
42 return PP_ERROR_BADRESOURCE; | 43 return PP_ERROR_BADRESOURCE; |
43 return enter.object()->GetAttrib(attribute, value); | 44 return enter.object()->GetAttrib(attribute, value); |
44 } | 45 } |
45 | 46 |
46 int32_t SwapBuffers(PP_Resource surface, | 47 int32_t SwapBuffers(PP_Resource surface, |
47 PP_CompletionCallback callback) { | 48 PP_CompletionCallback callback) { |
48 EnterResource<PPB_Surface3D_API> enter(surface, true); | 49 EnterResource<PPB_Surface3D_API> enter(surface, true); |
49 if (enter.failed()) | 50 if (enter.failed()) |
50 return PP_ERROR_BADRESOURCE; | 51 return MayForceCallback(callback, PP_ERROR_BADRESOURCE); |
51 return enter.object()->SwapBuffers(callback); | 52 int32_t result = enter.object()->SwapBuffers(callback); |
| 53 return MayForceCallback(callback, result); |
52 } | 54 } |
53 | 55 |
54 const PPB_Surface3D_Dev g_ppb_surface_3d_thunk = { | 56 const PPB_Surface3D_Dev g_ppb_surface_3d_thunk = { |
55 &Create, | 57 &Create, |
56 &IsSurface3D, | 58 &IsSurface3D, |
57 &SetAttrib, | 59 &SetAttrib, |
58 &GetAttrib, | 60 &GetAttrib, |
59 &SwapBuffers | 61 &SwapBuffers |
60 }; | 62 }; |
61 | 63 |
62 } // namespace | 64 } // namespace |
63 | 65 |
64 const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk() { | 66 const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk() { |
65 return &g_ppb_surface_3d_thunk; | 67 return &g_ppb_surface_3d_thunk; |
66 } | 68 } |
67 | 69 |
68 } // namespace thunk | 70 } // namespace thunk |
69 } // namespace ppapi | 71 } // namespace ppapi |
OLD | NEW |