| 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/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 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 EnterFunction<ResourceCreationAPI> enter(instance, true); | 26 EnterFunction<ResourceCreationAPI> enter(instance, true); |
| 27 if (enter.failed()) | 27 if (enter.failed()) |
| 28 return 0; | 28 return 0; |
| 29 return enter.functions()->CreateGraphics3DRaw( | 29 return enter.functions()->CreateGraphics3DRaw( |
| 30 instance, share_context, attrib_list); | 30 instance, share_context, attrib_list); |
| 31 } | 31 } |
| 32 | 32 |
| 33 PP_Bool InitCommandBuffer(PP_Resource context, int32_t size) { | 33 PP_Bool InitCommandBuffer(PP_Resource context) { |
| 34 EnterGraphics3D enter(context, true); | 34 EnterGraphics3D enter(context, true); |
| 35 if (enter.failed()) | 35 if (enter.failed()) |
| 36 return PP_FALSE; | 36 return PP_FALSE; |
| 37 return enter.object()->InitCommandBuffer(size); | 37 return enter.object()->InitCommandBuffer(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 PP_Bool GetRingBuffer(PP_Resource context, | 40 PP_Bool SetGetBuffer(PP_Resource context, int32_t transfer_buffer_id) { |
| 41 int* shm_handle, | |
| 42 uint32_t* shm_size) { | |
| 43 EnterGraphics3D enter(context, true); | 41 EnterGraphics3D enter(context, true); |
| 44 if (enter.failed()) | 42 if (enter.failed()) |
| 45 return PP_FALSE; | 43 return PP_FALSE; |
| 46 return enter.object()->GetRingBuffer(shm_handle, shm_size); | 44 return enter.object()->SetGetBuffer(transfer_buffer_id); |
| 47 } | 45 } |
| 48 | 46 |
| 49 PP_Graphics3DTrustedState GetState(PP_Resource context) { | 47 PP_Graphics3DTrustedState GetState(PP_Resource context) { |
| 50 EnterGraphics3D enter(context, true); | 48 EnterGraphics3D enter(context, true); |
| 51 if (enter.failed()) | 49 if (enter.failed()) |
| 52 return GetErrorState(); | 50 return GetErrorState(); |
| 53 return enter.object()->GetState(); | 51 return enter.object()->GetState(); |
| 54 } | 52 } |
| 55 | 53 |
| 56 int32_t CreateTransferBuffer(PP_Resource context, uint32_t size) { | 54 int32_t CreateTransferBuffer(PP_Resource context, uint32_t size) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 int32_t last_known_get) { | 94 int32_t last_known_get) { |
| 97 EnterGraphics3D enter(context, true); | 95 EnterGraphics3D enter(context, true); |
| 98 if (enter.failed()) | 96 if (enter.failed()) |
| 99 return GetErrorState(); | 97 return GetErrorState(); |
| 100 return enter.object()->FlushSyncFast(put_offset, last_known_get); | 98 return enter.object()->FlushSyncFast(put_offset, last_known_get); |
| 101 } | 99 } |
| 102 | 100 |
| 103 const PPB_Graphics3DTrusted g_ppb_graphics_3d_trusted_thunk = { | 101 const PPB_Graphics3DTrusted g_ppb_graphics_3d_trusted_thunk = { |
| 104 &CreateRaw, | 102 &CreateRaw, |
| 105 &InitCommandBuffer, | 103 &InitCommandBuffer, |
| 106 &GetRingBuffer, | 104 &SetGetBuffer, |
| 107 &GetState, | 105 &GetState, |
| 108 &CreateTransferBuffer, | 106 &CreateTransferBuffer, |
| 109 &DestroyTransferBuffer, | 107 &DestroyTransferBuffer, |
| 110 &GetTransferBuffer, | 108 &GetTransferBuffer, |
| 111 &Flush, | 109 &Flush, |
| 112 &FlushSync, | 110 &FlushSync, |
| 113 &FlushSyncFast, | 111 &FlushSyncFast, |
| 114 }; | 112 }; |
| 115 | 113 |
| 116 } // namespace | 114 } // namespace |
| 117 | 115 |
| 118 const PPB_Graphics3DTrusted* GetPPB_Graphics3DTrusted_Thunk() { | 116 const PPB_Graphics3DTrusted* GetPPB_Graphics3DTrusted_Thunk() { |
| 119 return &g_ppb_graphics_3d_trusted_thunk; | 117 return &g_ppb_graphics_3d_trusted_thunk; |
| 120 } | 118 } |
| 121 | 119 |
| 122 } // namespace thunk | 120 } // namespace thunk |
| 123 } // namespace ppapi | 121 } // namespace ppapi |
| 124 | 122 |
| OLD | NEW |