OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/thunk/thunk.h" | 5 #include "ppapi/thunk/thunk.h" |
6 #include "ppapi/thunk/enter.h" | 6 #include "ppapi/thunk/enter.h" |
7 #include "ppapi/thunk/ppb_graphics_3d_api.h" | 7 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
8 #include "ppapi/thunk/resource_creation_api.h" | 8 #include "ppapi/thunk/resource_creation_api.h" |
9 | 9 |
10 namespace ppapi { | 10 namespace ppapi { |
11 namespace thunk { | 11 namespace thunk { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; | 15 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; |
16 | 16 |
17 PP_Graphics3DTrustedState GetErrorState() { | 17 PP_Graphics3DTrustedState GetErrorState() { |
18 PP_Graphics3DTrustedState error_state = { 0 }; | 18 PP_Graphics3DTrustedState error_state = { 0 }; |
19 error_state.error = PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR; | 19 error_state.error = PPB_GRAPHICS3D_TRUSTED_ERROR_GENERICERROR; |
20 return error_state; | 20 return error_state; |
21 } | 21 } |
22 | 22 |
23 PP_Resource CreateRaw(PP_Instance instance, | 23 PP_Resource CreateRaw(PP_Instance instance, |
24 PP_Resource share_context, | 24 PP_Resource share_context, |
25 const int32_t* attrib_list) { | 25 const int32_t* attrib_list) { |
26 EnterResourceCreation enter(instance); | 26 EnterResourceCreation enter(instance); |
27 if (enter.failed()) | 27 if (enter.failed()) |
28 return 0; | 28 return 0; |
29 | |
30 PPB_Graphics3D_API* share_api = NULL; | |
brettw
2012/05/25 23:19:41
This code should be in the impl/proxy files. I wan
| |
31 if (share_context) { | |
32 EnterResourceNoLock<PPB_Graphics3D_API> enter_share(instance, true); | |
33 if (enter_share.failed()) | |
34 return 0; | |
35 share_api = enter_share.object(); | |
36 } | |
37 | |
29 return enter.functions()->CreateGraphics3DRaw( | 38 return enter.functions()->CreateGraphics3DRaw( |
30 instance, share_context, attrib_list); | 39 instance, share_api, attrib_list); |
31 } | 40 } |
32 | 41 |
33 PP_Bool InitCommandBuffer(PP_Resource context) { | 42 PP_Bool InitCommandBuffer(PP_Resource context) { |
34 EnterGraphics3D enter(context, true); | 43 EnterGraphics3D enter(context, true); |
35 if (enter.failed()) | 44 if (enter.failed()) |
36 return PP_FALSE; | 45 return PP_FALSE; |
37 return enter.object()->InitCommandBuffer(); | 46 return enter.object()->InitCommandBuffer(); |
38 } | 47 } |
39 | 48 |
40 PP_Bool SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) { | 49 PP_Bool SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 }; | 121 }; |
113 | 122 |
114 } // namespace | 123 } // namespace |
115 | 124 |
116 const PPB_Graphics3DTrusted_1_0* GetPPB_Graphics3DTrusted_1_0_Thunk() { | 125 const PPB_Graphics3DTrusted_1_0* GetPPB_Graphics3DTrusted_1_0_Thunk() { |
117 return &g_ppb_graphics_3d_trusted_thunk; | 126 return &g_ppb_graphics_3d_trusted_thunk; |
118 } | 127 } |
119 | 128 |
120 } // namespace thunk | 129 } // namespace thunk |
121 } // namespace ppapi | 130 } // namespace ppapi |
OLD | NEW |