Chromium Code Reviews| 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/c/pp_completion_callback.h" | 5 #include "ppapi/c/pp_completion_callback.h" |
| 6 #include "ppapi/c/pp_errors.h" | 6 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
| 8 #include "ppapi/thunk/thunk.h" | 8 #include "ppapi/thunk/thunk.h" |
| 9 #include "ppapi/thunk/ppb_graphics_3d_api.h" | 9 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 namespace thunk { | 13 namespace thunk { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; | 17 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; |
| 18 | 18 |
| 19 int32_t GetAttribMaxValue(PP_Instance instance, | 19 int32_t GetAttribMaxValue(PP_Instance instance, |
| 20 int32_t attribute, | 20 int32_t attribute, |
| 21 int32_t* value) { | 21 int32_t* value) { |
| 22 // TODO(alokp): Implement me. | 22 // TODO(alokp): Implement me. |
| 23 return PP_ERROR_FAILED; | 23 return PP_ERROR_FAILED; |
| 24 } | 24 } |
| 25 | 25 |
| 26 PP_Resource Create(PP_Instance instance, | 26 PP_Resource Create(PP_Instance instance, |
| 27 PP_Resource share_context, | 27 PP_Resource share_context, |
| 28 const int32_t attrib_list[]) { | 28 const int32_t attrib_list[]) { |
| 29 EnterResourceCreation enter(instance); | 29 EnterResourceCreation enter(instance); |
| 30 if (enter.failed()) | 30 EnterGraphics3D enter_share(share_context, true); |
|
piman
2012/05/16 23:38:45
This should be EnterResourceNoLock, since the lock
(scshunt)
2012/05/17 16:55:45
Ah ok.
| |
| 31 if (enter.failed() || enter_share.failed()) | |
| 31 return 0; | 32 return 0; |
| 32 return enter.functions()->CreateGraphics3D( | 33 return enter.functions()->CreateGraphics3D( |
| 33 instance, share_context, attrib_list); | 34 instance, enter_share.object(), attrib_list); |
| 34 } | 35 } |
| 35 | 36 |
| 36 PP_Bool IsGraphics3D(PP_Resource resource) { | 37 PP_Bool IsGraphics3D(PP_Resource resource) { |
| 37 EnterGraphics3D enter(resource, false); | 38 EnterGraphics3D enter(resource, false); |
| 38 return PP_FromBool(enter.succeeded()); | 39 return PP_FromBool(enter.succeeded()); |
| 39 } | 40 } |
| 40 | 41 |
| 41 int32_t GetAttribs(PP_Resource graphics_3d, int32_t attrib_list[]) { | 42 int32_t GetAttribs(PP_Resource graphics_3d, int32_t attrib_list[]) { |
| 42 EnterGraphics3D enter(graphics_3d, true); | 43 EnterGraphics3D enter(graphics_3d, true); |
| 43 if (enter.failed()) | 44 if (enter.failed()) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 } // namespace | 88 } // namespace |
| 88 | 89 |
| 89 const PPB_Graphics3D_1_0* GetPPB_Graphics3D_1_0_Thunk() { | 90 const PPB_Graphics3D_1_0* GetPPB_Graphics3D_1_0_Thunk() { |
| 90 return &g_ppb_graphics_3d_thunk; | 91 return &g_ppb_graphics_3d_thunk; |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace thunk | 94 } // namespace thunk |
| 94 } // namespace ppapi | 95 } // namespace ppapi |
| OLD | NEW |