summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-18 22:07:03 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-18 22:07:03 +0000
commit5b3af0d88a56073513a88e7ba311107a26e367cc (patch)
treec9f447bdae7714ee2ed5c4434c5f17617689ad71 /webkit
parentdfe9ac84eae9b1beb904ba71e3542f9ee888de0f (diff)
downloadchromium_src-5b3af0d88a56073513a88e7ba311107a26e367cc.zip
chromium_src-5b3af0d88a56073513a88e7ba311107a26e367cc.tar.gz
chromium_src-5b3af0d88a56073513a88e7ba311107a26e367cc.tar.bz2
Move the video decoder and video layer to the new API/thunk system.
This changes the video decoder API to make GetConfigs be a resource member function so it can be routed with the rest of the resource functions. This patch also removes the font_list_dev API which was never implemented and has been replaced with a function on the Font interface. TEST=manual BUG=none Review URL: http://codereview.chromium.org/7193018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc4
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc140
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h42
-rw-r--r--webkit/plugins/ppapi/ppb_video_layer_impl.cc76
-rw-r--r--webkit/plugins/ppapi/ppb_video_layer_impl.h18
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.cc12
-rw-r--r--webkit/plugins/ppapi/resource_creation_impl.h3
7 files changed, 73 insertions, 222 deletions
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 06e97a8..8181c96 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -325,9 +325,9 @@ const void* GetInterface(const char* name) {
if (strcmp(name, PPB_VAR_INTERFACE) == 0)
return Var::GetInterface();
if (strcmp(name, PPB_VIDEODECODER_DEV_INTERFACE) == 0)
- return PPB_VideoDecoder_Impl::GetInterface();
+ return ::ppapi::thunk::GetPPB_VideoDecoder_Thunk();
if (strcmp(name, PPB_VIDEOLAYER_DEV_INTERFACE) == 0)
- return PPB_VideoLayer_Impl::GetInterface();
+ return ::ppapi::thunk::GetPPB_VideoLayer_Thunk();
if (strcmp(name, PPB_WIDGET_DEV_INTERFACE) == 0)
return PPB_Widget_Impl::GetInterface();
if (strcmp(name, PPB_ZOOM_DEV_INTERFACE) == 0)
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index 47777c4..6e36e2e 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -23,128 +23,13 @@
#include "webkit/plugins/ppapi/resource_tracker.h"
#include "webkit/plugins/ppapi/var.h"
+using ppapi::thunk::PPB_VideoDecoder_API;
+
namespace webkit {
namespace ppapi {
namespace {
-PP_Bool GetConfigs(PP_Instance instance_id,
- const PP_VideoConfigElement* proto_config,
- PP_VideoConfigElement* matching_configs,
- uint32_t matching_configs_size,
- uint32_t* num_of_matching_configs) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return PP_FALSE;
-
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- new PPB_VideoDecoder_Impl(instance));
-
- return BoolToPPBool(decoder->GetConfigs(proto_config,
- matching_configs,
- matching_configs_size,
- num_of_matching_configs));
-}
-
-PP_Resource Create(PP_Instance instance_id) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
- if (!instance)
- return 0;
-
- PPB_VideoDecoder_Impl* decoder = new PPB_VideoDecoder_Impl(instance);
- return decoder->GetReference();
-}
-
-int32_t Initialize(PP_Resource video_decoder,
- PP_Resource context_id,
- const PP_VideoConfigElement* decoder_config,
- struct PP_CompletionCallback callback) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return PP_ERROR_BADRESOURCE;
-
- return decoder->Initialize(context_id, decoder_config, callback);
-}
-
-PP_Bool IsVideoDecoder(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<PPB_VideoDecoder_Impl>(resource));
-}
-
-int32_t Decode(PP_Resource decoder_id,
- const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
- PP_CompletionCallback callback) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(decoder_id));
- if (!decoder)
- return PP_ERROR_BADRESOURCE;
-
- return decoder->Decode(bitstream_buffer, callback);
-}
-
-void AssignGLESBuffers(PP_Resource video_decoder,
- uint32_t no_of_buffers,
- const PP_GLESBuffer_Dev* buffers) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return;
-
- decoder->AssignGLESBuffers(no_of_buffers, buffers);
-}
-
-void AssignSysmemBuffers(PP_Resource video_decoder,
- uint32_t no_of_buffers,
- const PP_SysmemBuffer_Dev* buffers) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return;
-
- decoder->AssignSysmemBuffers(no_of_buffers, buffers);
-}
-
-void ReusePictureBuffer(PP_Resource video_decoder, int32_t picture_buffer_id) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return;
-
- decoder->ReusePictureBuffer(picture_buffer_id);
-}
-
-int32_t Flush(PP_Resource video_decoder, PP_CompletionCallback callback) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return PP_ERROR_BADRESOURCE;
-
- return decoder->Flush(callback);
-}
-
-int32_t Abort(PP_Resource video_decoder,
- PP_CompletionCallback callback) {
- scoped_refptr<PPB_VideoDecoder_Impl> decoder(
- Resource::GetAs<PPB_VideoDecoder_Impl>(video_decoder));
- if (!decoder)
- return PP_ERROR_BADRESOURCE;
-
- return decoder->Abort(callback);
-}
-
-const PPB_VideoDecoder_Dev ppb_videodecoder = {
- &GetConfigs,
- &Create,
- &Initialize,
- &IsVideoDecoder,
- &Decode,
- &AssignGLESBuffers,
- &AssignSysmemBuffers,
- &ReusePictureBuffer,
- &Flush,
- &Abort,
-};
-
// Utility methods to convert data to and from the ppapi C-types and their
// C++ media-namespace equivalents.
void CopyToPictureDev(const media::Picture& input, PP_Picture_Dev* output) {
@@ -189,25 +74,30 @@ PPB_VideoDecoder_Impl::~PPB_VideoDecoder_Impl() {
}
// static
-const PPB_VideoDecoder_Dev* PPB_VideoDecoder_Impl::GetInterface() {
- return &ppb_videodecoder;
+PP_Resource PPB_VideoDecoder_Impl::Create(PP_Instance pp_instance) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
+ if (!instance)
+ return 0;
+
+ PPB_VideoDecoder_Impl* decoder = new PPB_VideoDecoder_Impl(instance);
+ return decoder->GetReference();
}
-PPB_VideoDecoder_Impl* PPB_VideoDecoder_Impl::AsPPB_VideoDecoder_Impl() {
+PPB_VideoDecoder_API* PPB_VideoDecoder_Impl::AsPPB_VideoDecoder_API() {
return this;
}
-bool PPB_VideoDecoder_Impl::GetConfigs(
+PP_Bool PPB_VideoDecoder_Impl::GetConfigs(
const PP_VideoConfigElement* requested_configs,
PP_VideoConfigElement* matching_configs,
uint32_t matching_configs_size,
uint32_t* num_of_matching_configs) {
if (!instance())
- return false;
+ return PP_FALSE;
if (!platform_video_decoder_.get())
- return false;
+ return PP_FALSE;
if (!matching_configs)
- return false;
+ return PP_FALSE;
std::vector<uint32> requested;
CopyToConfigList(requested_configs, &requested);
@@ -219,7 +109,7 @@ bool PPB_VideoDecoder_Impl::GetConfigs(
matching_configs[i] = matched[i];
*num_of_matching_configs = i;
- return true;
+ return PP_TRUE;
}
int32_t PPB_VideoDecoder_Impl::Initialize(
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index 7af31a0..0b39418 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/thunk/ppb_video_decoder_api.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/resource.h"
@@ -29,35 +30,34 @@ namespace ppapi {
class PluginInstance;
class PPB_VideoDecoder_Impl : public Resource,
+ public ::ppapi::thunk::PPB_VideoDecoder_API,
public media::VideoDecodeAccelerator::Client {
public:
explicit PPB_VideoDecoder_Impl(PluginInstance* instance);
virtual ~PPB_VideoDecoder_Impl();
- // Returns a pointer to the interface implementing PPB_VideoDecoder that is
- // exposed to the plugin.
- static const PPB_VideoDecoder_Dev* GetInterface();
+ static PP_Resource Create(PP_Instance instance);
- // Resource overrides.
- virtual PPB_VideoDecoder_Impl* AsPPB_VideoDecoder_Impl();
+ // ResourceObjectBase overrides.
+ virtual PPB_VideoDecoder_API* AsPPB_VideoDecoder_API() OVERRIDE;
// PPB_VideoDecoder implementation.
- bool GetConfigs(const PP_VideoConfigElement* requested_configs,
- PP_VideoConfigElement* matching_configs,
- uint32_t matching_configs_size,
- uint32_t* num_of_matching_configs);
- int32_t Initialize(PP_Resource context_id,
- const PP_VideoConfigElement* dec_config,
- PP_CompletionCallback callback);
- int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
- PP_CompletionCallback callback);
- void AssignGLESBuffers(uint32_t no_of_buffers,
- const PP_GLESBuffer_Dev* buffers);
- void AssignSysmemBuffers(uint32_t no_of_buffers,
- const PP_SysmemBuffer_Dev* buffers);
- void ReusePictureBuffer(int32_t picture_buffer_id);
- int32_t Flush(PP_CompletionCallback callback);
- int32_t Abort(PP_CompletionCallback callback);
+ virtual PP_Bool GetConfigs(const PP_VideoConfigElement* requested_configs,
+ PP_VideoConfigElement* matching_configs,
+ uint32_t matching_configs_size,
+ uint32_t* num_of_matching_configs) OVERRIDE;
+ virtual int32_t Initialize(PP_Resource context_id,
+ const PP_VideoConfigElement* dec_config,
+ PP_CompletionCallback callback) OVERRIDE;
+ virtual int32_t Decode(const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
+ PP_CompletionCallback callback) OVERRIDE;
+ virtual void AssignGLESBuffers(uint32_t no_of_buffers,
+ const PP_GLESBuffer_Dev* buffers) OVERRIDE;
+ virtual void AssignSysmemBuffers(uint32_t no_of_buffers,
+ const PP_SysmemBuffer_Dev* buffers) OVERRIDE;
+ virtual void ReusePictureBuffer(int32_t picture_buffer_id) OVERRIDE;
+ virtual int32_t Flush(PP_CompletionCallback callback) OVERRIDE;
+ virtual int32_t Abort(PP_CompletionCallback callback) OVERRIDE;
// media::VideoDecodeAccelerator::Client implementation.
virtual void ProvidePictureBuffers(
diff --git a/webkit/plugins/ppapi/ppb_video_layer_impl.cc b/webkit/plugins/ppapi/ppb_video_layer_impl.cc
index 95b192a..4bc201b 100644
--- a/webkit/plugins/ppapi/ppb_video_layer_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_layer_impl.cc
@@ -8,13 +8,22 @@
#include "webkit/plugins/ppapi/common.h"
#include "webkit/plugins/ppapi/ppb_video_layer_software.h"
+using ppapi::thunk::PPB_VideoLayer_API;
+
namespace webkit {
namespace ppapi {
-namespace {
+PPB_VideoLayer_Impl::PPB_VideoLayer_Impl(PluginInstance* instance)
+ : Resource(instance) {
+}
+
+PPB_VideoLayer_Impl::~PPB_VideoLayer_Impl() {
+}
-PP_Resource Create(PP_Instance instance_id, PP_VideoLayerMode_Dev mode) {
- PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
+// static
+PP_Resource PPB_VideoLayer_Impl::Create(PP_Instance pp_instance,
+ PP_VideoLayerMode_Dev mode) {
+ PluginInstance* instance = ResourceTracker::Get()->GetInstance(pp_instance);
if (!instance)
return 0;
@@ -26,68 +35,9 @@ PP_Resource Create(PP_Instance instance_id, PP_VideoLayerMode_Dev mode) {
return layer->GetReference();
}
-PP_Bool IsVideoLayer(PP_Resource resource) {
- return BoolToPPBool(!!Resource::GetAs<PPB_VideoLayer_Impl>(resource));
-}
-void SetPixelFormat(PP_Resource resource,
- PP_VideoLayerPixelFormat_Dev pixel_format) {
- scoped_refptr<PPB_VideoLayer_Impl> layer(
- Resource::GetAs<PPB_VideoLayer_Impl>(resource));
- layer->SetPixelFormat(pixel_format);
-}
-
-void SetNativeSize(PP_Resource resource, const struct PP_Size* size) {
- scoped_refptr<PPB_VideoLayer_Impl> layer(
- Resource::GetAs<PPB_VideoLayer_Impl>(resource));
- layer->SetNativeSize(size);
-}
-
-void SetClipRect(PP_Resource resource, const struct PP_Rect* clip_rect) {
- scoped_refptr<PPB_VideoLayer_Impl> layer(
- Resource::GetAs<PPB_VideoLayer_Impl>(resource));
- layer->SetClipRect(clip_rect);
-}
-
-PP_Bool IsReady(PP_Resource resource) {
- scoped_refptr<PPB_VideoLayer_Impl> layer(
- Resource::GetAs<PPB_VideoLayer_Impl>(resource));
- return layer->IsReady();
-}
-
-PP_Bool UpdateContent(PP_Resource resource, uint32_t no_of_planes,
- const void** planes) {
- scoped_refptr<PPB_VideoLayer_Impl> layer(
- Resource::GetAs<PPB_VideoLayer_Impl>(resource));
- return layer->UpdateContent(no_of_planes, planes);
-}
-
-const PPB_VideoLayer_Dev ppb_videolayer = {
- &Create,
- &IsVideoLayer,
- &SetPixelFormat,
- &SetNativeSize,
- &SetClipRect,
- &IsReady,
- &UpdateContent,
-};
-
-} // namespace
-
-PPB_VideoLayer_Impl::PPB_VideoLayer_Impl(PluginInstance* instance)
- : Resource(instance) {
-}
-
-PPB_VideoLayer_Impl::~PPB_VideoLayer_Impl() {
-}
-
-PPB_VideoLayer_Impl* PPB_VideoLayer_Impl::AsPPB_VideoLayer_Impl() {
+PPB_VideoLayer_API* PPB_VideoLayer_Impl::AsPPB_VideoLayer_API() {
return this;
}
-// static
-const PPB_VideoLayer_Dev* PPB_VideoLayer_Impl::GetInterface() {
- return &ppb_videolayer;
-}
-
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_video_layer_impl.h b/webkit/plugins/ppapi/ppb_video_layer_impl.h
index 2cfc181..6d7195e 100644
--- a/webkit/plugins/ppapi/ppb_video_layer_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_layer_impl.h
@@ -5,7 +5,7 @@
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_IMPL_H_
#define WEBKIT_PLUGINS_PPAPI_PPB_VIDEO_LAYER_IMPL_H_
-#include "ppapi/c/dev/ppb_video_layer_dev.h"
+#include "ppapi/thunk/ppb_video_layer_api.h"
#include "webkit/plugins/ppapi/resource.h"
struct PP_Rect;
@@ -16,22 +16,18 @@ namespace ppapi {
class PluginInstance;
-class PPB_VideoLayer_Impl : public Resource {
+class PPB_VideoLayer_Impl : public Resource,
+ public ::ppapi::thunk::PPB_VideoLayer_API {
public:
explicit PPB_VideoLayer_Impl(PluginInstance* instance);
virtual ~PPB_VideoLayer_Impl();
- static const PPB_VideoLayer_Dev* GetInterface();
+ static PP_Resource Create(PP_Instance instance, PP_VideoLayerMode_Dev mode);
- // Resource override.
- virtual PPB_VideoLayer_Impl* AsPPB_VideoLayer_Impl();
+ // ResourceObjectBase override.
+ virtual PPB_VideoLayer_API* AsPPB_VideoLayer_API() OVERRIDE;
- // Pure virtual methods to be implemented by subclasses.
- virtual void SetPixelFormat(PP_VideoLayerPixelFormat_Dev pixel_format) = 0;
- virtual void SetNativeSize(const PP_Size* size) = 0;
- virtual void SetClipRect(const PP_Rect* clip_rect) = 0;
- virtual PP_Bool IsReady() = 0;
- virtual PP_Bool UpdateContent(uint32_t no_of_planes, const void** planes) = 0;
+ // Derived classes must implement PPB_VideoLayer_API.
private:
DISALLOW_COPY_AND_ASSIGN(PPB_VideoLayer_Impl);
diff --git a/webkit/plugins/ppapi/resource_creation_impl.cc b/webkit/plugins/ppapi/resource_creation_impl.cc
index a8caf76..fe9588e 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.cc
+++ b/webkit/plugins/ppapi/resource_creation_impl.cc
@@ -20,8 +20,11 @@
#include "webkit/plugins/ppapi/ppb_font_impl.h"
#include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
#include "webkit/plugins/ppapi/ppb_image_data_impl.h"
+#include "webkit/plugins/ppapi/ppb_surface_3d_impl.h"
#include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
#include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
+#include "webkit/plugins/ppapi/ppb_video_decoder_impl.h"
+#include "webkit/plugins/ppapi/ppb_video_layer_impl.h"
namespace webkit {
namespace ppapi {
@@ -182,5 +185,14 @@ PP_Resource ResourceCreationImpl::CreateURLRequestInfo(PP_Instance instance) {
return PPB_URLRequestInfo_Impl::Create(instance);
}
+PP_Resource ResourceCreationImpl::CreateVideoDecoder(PP_Instance instance) {
+ return PPB_VideoDecoder_Impl::Create(instance);
+}
+
+PP_Resource ResourceCreationImpl::CreateVideoLayer(PP_Instance instance,
+ PP_VideoLayerMode_Dev mode) {
+ return PPB_VideoLayer_Impl::Create(instance, mode);
+}
+
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/resource_creation_impl.h b/webkit/plugins/ppapi/resource_creation_impl.h
index ad21a60..7d39a7e1 100644
--- a/webkit/plugins/ppapi/resource_creation_impl.h
+++ b/webkit/plugins/ppapi/resource_creation_impl.h
@@ -63,6 +63,9 @@ class ResourceCreationImpl : public ::ppapi::FunctionGroupBase,
const int32_t* attrib_list) OVERRIDE;
virtual PP_Resource CreateURLLoader(PP_Instance instance) OVERRIDE;
virtual PP_Resource CreateURLRequestInfo(PP_Instance instance) OVERRIDE;
+ virtual PP_Resource CreateVideoDecoder(PP_Instance instance) OVERRIDE;
+ virtual PP_Resource CreateVideoLayer(PP_Instance instance,
+ PP_VideoLayerMode_Dev mode) OVERRIDE;
private:
PluginInstance* instance_;