| 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_context_3d_api.h" | 7 #include "ppapi/thunk/ppb_context_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 13 matching lines...) Expand all Loading... |
| 24 PP_Config3D_Dev config, | 24 PP_Config3D_Dev config, |
| 25 PP_Resource share_context, | 25 PP_Resource share_context, |
| 26 const int32_t* attrib_list) { | 26 const int32_t* attrib_list) { |
| 27 EnterFunction<ResourceCreationAPI> enter(instance, true); | 27 EnterFunction<ResourceCreationAPI> enter(instance, true); |
| 28 if (enter.failed()) | 28 if (enter.failed()) |
| 29 return 0; | 29 return 0; |
| 30 return enter.functions()->CreateContext3DRaw(instance, config, share_context, | 30 return enter.functions()->CreateContext3DRaw(instance, config, share_context, |
| 31 attrib_list); | 31 attrib_list); |
| 32 } | 32 } |
| 33 | 33 |
| 34 PP_Bool Initialize(PP_Resource context, int32_t size) { | 34 PP_Bool Initialize(PP_Resource context) { |
| 35 EnterContext3D enter(context, true); | 35 EnterContext3D enter(context, true); |
| 36 if (enter.failed()) | 36 if (enter.failed()) |
| 37 return PP_FALSE; | 37 return PP_FALSE; |
| 38 return enter.object()->InitializeTrusted(size); | 38 return enter.object()->InitializeTrusted(); |
| 39 } | |
| 40 | |
| 41 PP_Bool GetRingBuffer(PP_Resource context, | |
| 42 int* shm_handle, | |
| 43 uint32_t* shm_size) { | |
| 44 EnterContext3D enter(context, true); | |
| 45 if (enter.failed()) | |
| 46 return PP_FALSE; | |
| 47 return enter.object()->GetRingBuffer(shm_handle, shm_size); | |
| 48 } | 39 } |
| 49 | 40 |
| 50 PP_Context3DTrustedState GetState(PP_Resource context) { | 41 PP_Context3DTrustedState GetState(PP_Resource context) { |
| 51 EnterContext3D enter(context, true); | 42 EnterContext3D enter(context, true); |
| 52 if (enter.failed()) | 43 if (enter.failed()) |
| 53 return GetErrorState(); | 44 return GetErrorState(); |
| 54 return enter.object()->GetState(); | 45 return enter.object()->GetState(); |
| 55 } | 46 } |
| 56 | 47 |
| 57 PP_Bool Flush(PP_Resource context, int32_t put_offset) { | 48 PP_Bool Flush(PP_Resource context, int32_t put_offset) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 int32_t last_known_get) { | 88 int32_t last_known_get) { |
| 98 EnterContext3D enter(context, true); | 89 EnterContext3D enter(context, true); |
| 99 if (enter.failed()) | 90 if (enter.failed()) |
| 100 return GetErrorState(); | 91 return GetErrorState(); |
| 101 return enter.object()->FlushSyncFast(put_offset, last_known_get); | 92 return enter.object()->FlushSyncFast(put_offset, last_known_get); |
| 102 } | 93 } |
| 103 | 94 |
| 104 const PPB_Context3DTrusted_Dev g_ppb_context_3d_trusted_thunk = { | 95 const PPB_Context3DTrusted_Dev g_ppb_context_3d_trusted_thunk = { |
| 105 &CreateRaw, | 96 &CreateRaw, |
| 106 &Initialize, | 97 &Initialize, |
| 107 &GetRingBuffer, | |
| 108 &GetState, | 98 &GetState, |
| 109 &Flush, | 99 &Flush, |
| 110 &FlushSync, | 100 &FlushSync, |
| 111 &CreateTransferBuffer, | 101 &CreateTransferBuffer, |
| 112 &DestroyTransferBuffer, | 102 &DestroyTransferBuffer, |
| 113 &GetTransferBuffer, | 103 &GetTransferBuffer, |
| 114 &FlushSyncFast, | 104 &FlushSyncFast, |
| 115 }; | 105 }; |
| 116 | 106 |
| 117 } // namespace | 107 } // namespace |
| 118 | 108 |
| 119 const PPB_Context3DTrusted_Dev* GetPPB_Context3DTrusted_Thunk() { | 109 const PPB_Context3DTrusted_Dev* GetPPB_Context3DTrusted_Thunk() { |
| 120 return &g_ppb_context_3d_trusted_thunk; | 110 return &g_ppb_context_3d_trusted_thunk; |
| 121 } | 111 } |
| 122 | 112 |
| 123 } // namespace thunk | 113 } // namespace thunk |
| 124 } // namespace ppapi | 114 } // namespace ppapi |
| OLD | NEW |