summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 20:07:18 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-07 20:07:18 +0000
commit6678946747a941d2a62c55751b547a5a06432157 (patch)
tree39fb30d4e62b89a0be4dc95933758efb6434cb10 /webkit/plugins
parent34e4dbd936dc10a2977a828f2713cbaba540bcc2 (diff)
downloadchromium_src-6678946747a941d2a62c55751b547a5a06432157.zip
chromium_src-6678946747a941d2a62c55751b547a5a06432157.tar.gz
chromium_src-6678946747a941d2a62c55751b547a5a06432157.tar.bz2
Added and partially implemented entry points for PPB_GRAPHICS_3D.
Review URL: http://codereview.chromium.org/6814023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80830 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.cc70
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.h18
2 files changed, 83 insertions, 5 deletions
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
index 36dc91b..af98225 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
@@ -4,9 +4,10 @@
#include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
+#include "base/logging.h"
+#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_var.h"
-#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
+#include "webkit/plugins/ppapi/common.h"
namespace webkit {
namespace ppapi {
@@ -30,18 +31,81 @@ PP_Var GetString(int32_t name) {
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);
+ if (!instance)
+ return 0;
+
+ scoped_refptr<PPB_Graphics3D_Impl> context(
+ new PPB_Graphics3D_Impl(instance));
+ if (!context->Init(config, share_context, attrib_list))
+ return 0;
+
+ return context->GetReference();
+}
+
+PP_Bool IsGraphics3D(PP_Resource resource) {
+ return BoolToPPBool(!!Resource::GetAs<PPB_Graphics3D_Impl>(resource));
+}
+
+int32_t GetAttribs(PP_Resource context, int32_t* attrib_list) {
+ // TODO(alokp): Implement me.
+ return 0;
+}
+
+int32_t SetAttribs(PP_Resource context, int32_t* attrib_list) {
+ // TODO(alokp): Implement me.
+ return 0;
+}
+
+int32_t SwapBuffers(PP_Resource context, PP_CompletionCallback callback) {
+ // TODO(alokp): Implement me.
+ return 0;
+}
+
const PPB_Graphics3D_Dev ppb_graphics3d = {
&GetConfigs,
&GetConfigAttribs,
- &GetString
+ &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) {
+ // TODO(alokp): Implement me.
+ return false;
+}
+
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
index c4738cc..b9dbc14 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
@@ -5,14 +5,28 @@
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
#define WEBKIT_PLUGINS_PPAPI_PPB_GRAPHICS_3D_IMPL_H_
-struct PPB_Graphics3D_Dev;
+#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
+#include "webkit/plugins/ppapi/resource.h"
namespace webkit {
namespace ppapi {
-class PPB_Graphics3D_Impl {
+class PPB_Graphics3D_Impl : public Resource {
public:
+ explicit PPB_Graphics3D_Impl(PluginInstance* instance);
+ virtual ~PPB_Graphics3D_Impl();
+
static const PPB_Graphics3D_Dev* GetInterface();
+
+ // Resource override.
+ virtual PPB_Graphics3D_Impl* AsPPB_Graphics3D_Impl();
+
+ bool Init(PP_Config3D_Dev config,
+ PP_Resource share_context,
+ const int32_t* attrib_list);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Impl);
};
} // namespace ppapi