Index: webkit/plugins/ppapi/ppb_graphics_3d_impl.cc |
=================================================================== |
--- webkit/plugins/ppapi/ppb_graphics_3d_impl.cc (revision 89672) |
+++ webkit/plugins/ppapi/ppb_graphics_3d_impl.cc (working copy) |
@@ -7,98 +7,55 @@ |
#include "base/logging.h" |
#include "ppapi/c/pp_completion_callback.h" |
#include "ppapi/c/pp_errors.h" |
-#include "webkit/plugins/ppapi/common.h" |
+#include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
+#include "webkit/plugins/ppapi/resource_tracker.h" |
+using ppapi::thunk::PPB_Graphics3D_API; |
+ |
namespace webkit { |
namespace ppapi { |
-namespace { |
- |
-int32_t GetConfigs(PP_Config3D_Dev* configs, |
- int32_t config_size, |
- int32_t* num_config) { |
- // TODO(alokp): Implement me. |
- return PP_ERROR_FAILED; |
+PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PluginInstance* instance) |
+ : Resource(instance) { |
} |
-int32_t GetConfigAttribs(PP_Config3D_Dev config, int32_t* attrib_list) { |
- // TODO(alokp): Implement me. |
- return PP_ERROR_FAILED; |
+PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
} |
-PP_Var GetString(int32_t name) { |
- // TODO(alokp): Implement me. |
- return PP_MakeUndefined(); |
-} |
- |
-PP_Resource Create(PP_Instance instance_id, |
- PP_Config3D_Dev config, |
- PP_Resource share_context, |
- const int32_t* attrib_list) { |
- // TODO(alokp): Support shared context. |
- DCHECK_EQ(0, share_context); |
- if (share_context != 0) |
- return 0; |
- |
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
+// static |
+PP_Resource PPB_Graphics3D_Impl::Create(PP_Instance pp_instance, |
+ PP_Config3D_Dev config, |
+ PP_Resource share_context, |
+ const int32_t* attrib_list) { |
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance); |
if (!instance) |
return 0; |
- scoped_refptr<PPB_Graphics3D_Impl> context( |
- new PPB_Graphics3D_Impl(instance)); |
- if (!context->Init(config, share_context, attrib_list)) |
+ scoped_refptr<PPB_Graphics3D_Impl> t(new PPB_Graphics3D_Impl(instance)); |
+ if (!t->Init(config, share_context, attrib_list)) |
return 0; |
- |
- return context->GetReference(); |
+ return t->GetReference(); |
} |
-PP_Bool IsGraphics3D(PP_Resource resource) { |
- return BoolToPPBool(!!Resource::GetAs<PPB_Graphics3D_Impl>(resource)); |
+PPB_Graphics3D_API* PPB_Graphics3D_Impl::AsPPB_Graphics3D_API() { |
+ return this; |
} |
-int32_t GetAttribs(PP_Resource context, int32_t* attrib_list) { |
+int32_t PPB_Graphics3D_Impl::GetAttribs(int32_t* attrib_list) { |
// TODO(alokp): Implement me. |
- return 0; |
+ return PP_ERROR_FAILED; |
} |
-int32_t SetAttribs(PP_Resource context, int32_t* attrib_list) { |
+int32_t PPB_Graphics3D_Impl::SetAttribs(int32_t* attrib_list) { |
// TODO(alokp): Implement me. |
- return 0; |
+ return PP_ERROR_FAILED; |
} |
-int32_t SwapBuffers(PP_Resource context, PP_CompletionCallback callback) { |
+int32_t PPB_Graphics3D_Impl::SwapBuffers(PP_CompletionCallback callback) { |
// TODO(alokp): Implement me. |
- return 0; |
+ return PP_ERROR_FAILED; |
} |
-const PPB_Graphics3D_Dev ppb_graphics3d = { |
- &GetConfigs, |
- &GetConfigAttribs, |
- &GetString, |
- &Create, |
- &IsGraphics3D, |
- &GetAttribs, |
- &SetAttribs, |
- &SwapBuffers |
-}; |
- |
-} // namespace |
- |
-PPB_Graphics3D_Impl::PPB_Graphics3D_Impl(PluginInstance* instance) |
- : Resource(instance) { |
-} |
- |
-PPB_Graphics3D_Impl::~PPB_Graphics3D_Impl() { |
-} |
- |
-const PPB_Graphics3D_Dev* PPB_Graphics3D_Impl::GetInterface() { |
- return &ppb_graphics3d; |
-} |
- |
-PPB_Graphics3D_Impl* PPB_Graphics3D_Impl::AsPPB_Graphics3D_Impl() { |
- return this; |
-} |
- |
bool PPB_Graphics3D_Impl::Init(PP_Config3D_Dev config, |
PP_Resource share_context, |
const int32_t* attrib_list) { |