[Mac] Enable CrZombie for subprocesses in release builds.
[chromium-blink-merge.git] / ppapi / thunk / ppb_context_3d_thunk.cc
blob200e04478e503d50dd9faa54684cd07190dd1370
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
3 // found in the LICENSE file.
5 #include "ppapi/c/pp_errors.h"
6 #include "ppapi/thunk/thunk.h"
7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/ppb_context_3d_api.h"
9 #include "ppapi/thunk/resource_creation_api.h"
11 namespace ppapi {
12 namespace thunk {
14 namespace {
16 typedef EnterResource<PPB_Context3D_API> EnterContext3D;
18 PP_Resource Create(PP_Instance instance,
19 PP_Config3D_Dev config,
20 PP_Resource share_context,
21 const int32_t* attrib_list) {
22 EnterFunction<ResourceCreationAPI> enter(instance, true);
23 if (enter.failed())
24 return 0;
25 return enter.functions()->CreateContext3D(instance, config, share_context,
26 attrib_list);
29 PP_Bool IsContext3D(PP_Resource resource) {
30 EnterContext3D enter(resource, false);
31 return PP_FromBool(enter.succeeded());
34 int32_t GetAttrib(PP_Resource context, int32_t attribute, int32_t* value) {
35 EnterContext3D enter(context, true);
36 if (enter.failed())
37 return PP_ERROR_BADRESOURCE;
38 return enter.object()->GetAttrib(attribute, value);
41 int32_t BindSurfaces(PP_Resource context, PP_Resource draw, PP_Resource read) {
42 EnterContext3D enter(context, true);
43 if (enter.failed())
44 return PP_ERROR_BADRESOURCE;
45 return enter.object()->BindSurfaces(draw, read);
48 int32_t GetBoundSurfaces(PP_Resource context,
49 PP_Resource* draw,
50 PP_Resource* read) {
51 EnterContext3D enter(context, true);
52 if (enter.failed())
53 return PP_ERROR_BADRESOURCE;
54 return enter.object()->GetBoundSurfaces(draw, read);
57 const PPB_Context3D_Dev g_ppb_context_3d_thunk = {
58 &Create,
59 &IsContext3D,
60 &GetAttrib,
61 &BindSurfaces,
62 &GetBoundSurfaces
65 } // namespace
67 const PPB_Context3D_Dev* GetPPB_Context3D_Dev_Thunk() {
68 return &g_ppb_context_3d_thunk;
71 } // namespace thunk
72 } // namespace ppapi