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