diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:57:00 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-22 20:57:00 +0000 |
commit | e18e6392bb61e5a525b87951b9e42df0f2d07c83 (patch) | |
tree | 55c67d9ffaf42151ca259e32f043030c9afa7d16 /ppapi/thunk/ppb_graphics_3d_thunk.cc | |
parent | 627c4549e3d258ed34d896ac7910f04694cbc7b0 (diff) | |
download | chromium_src-e18e6392bb61e5a525b87951b9e42df0f2d07c83.zip chromium_src-e18e6392bb61e5a525b87951b9e42df0f2d07c83.tar.gz chromium_src-e18e6392bb61e5a525b87951b9e42df0f2d07c83.tar.bz2 |
Convert most remaining resources to use the API/thunk system. The significant
changes here are around the 3D API. Having separate files for the texture
mapping interface is no longer necessary for the proxy and the
implementation.
This also removes the uses of the "old" dynamic casting system (using
"GetAs") for other resources that I could find.
TEST=ui tests
BUG=none
Review URL: http://codereview.chromium.org/7206016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_graphics_3d_thunk.cc')
-rw-r--r-- | ppapi/thunk/ppb_graphics_3d_thunk.cc | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/ppapi/thunk/ppb_graphics_3d_thunk.cc b/ppapi/thunk/ppb_graphics_3d_thunk.cc new file mode 100644 index 0000000..edac937 --- /dev/null +++ b/ppapi/thunk/ppb_graphics_3d_thunk.cc @@ -0,0 +1,91 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/thunk/thunk.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_graphics_3d_api.h" +#include "ppapi/thunk/resource_creation_api.h" + +namespace ppapi { +namespace thunk { + +namespace { + +typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; + +int32_t GetConfigs(PP_Config3D_Dev* configs, + int32_t config_size, + int32_t* num_config) { + // TODO(alokp): Implement me. + return PP_ERROR_FAILED; +} + +int32_t GetConfigAttribs(PP_Config3D_Dev config, int32_t* attrib_list) { + // TODO(alokp): Implement me. + return PP_ERROR_FAILED; +} + +PP_Var GetString(int32_t name) { + // TODO(alokp): Implement me. + return PP_MakeUndefined(); +} + +PP_Resource Create(PP_Instance instance, + PP_Config3D_Dev config, + PP_Resource share_context, + const int32_t* attrib_list) { + EnterFunction<ResourceCreationAPI> enter(instance, true); + if (enter.failed()) + return 0; + return enter.functions()->CreateGraphics3D(instance, config, share_context, + attrib_list); +} + +PP_Bool IsGraphics3D(PP_Resource resource) { + EnterGraphics3D enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +int32_t GetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { + EnterGraphics3D enter(graphics_3d, true); + if (enter.failed()) + return PP_ERROR_BADRESOURCE; + return enter.object()->GetAttribs(attrib_list); +} + +int32_t SetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { + EnterGraphics3D enter(graphics_3d, true); + if (enter.failed()) + return PP_ERROR_BADRESOURCE; + return enter.object()->SetAttribs(attrib_list); +} + +int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { + EnterGraphics3D enter(graphics_3d, true); + if (enter.failed()) + return PP_ERROR_BADRESOURCE; + return enter.object()->SwapBuffers(callback); +} + +const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { + &GetConfigs, + &GetConfigAttribs, + &GetString, + &Create, + &IsGraphics3D, + &GetAttribs, + &SetAttribs, + &SwapBuffers +}; + +} // namespace + +const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { + return &g_ppb_graphics_3d_thunk; +} + +} // namespace thunk +} // namespace ppapi |