diff options
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_image_data.cc | 21 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_image_data.h | 5 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_module.cc | 3 |
4 files changed, 30 insertions, 1 deletions
@@ -172,7 +172,7 @@ deps = { Var("libvpx_revision"), "src/third_party/ppapi": - (Var("googlecode_url") % "ppapi") + "/trunk@264", + (Var("googlecode_url") % "ppapi") + "/trunk@265", "src/third_party/libjingle/source": (Var("googlecode_url") % "libjingle") + "/branches/nextsnap@" + diff --git a/webkit/glue/plugins/pepper_image_data.cc b/webkit/glue/plugins/pepper_image_data.cc index d3246c2..aeb2c88 100644 --- a/webkit/glue/plugins/pepper_image_data.cc +++ b/webkit/glue/plugins/pepper_image_data.cc @@ -14,6 +14,7 @@ #include "third_party/ppapi/c/pp_module.h" #include "third_party/ppapi/c/pp_resource.h" #include "third_party/ppapi/c/ppb_image_data.h" +#include "third_party/ppapi/c/trusted/ppb_image_data_trusted.h" #include "webkit/glue/plugins/pepper_plugin_instance.h" #include "webkit/glue/plugins/pepper_plugin_module.h" @@ -68,6 +69,13 @@ void Unmap(PP_Resource resource) { image_data->Unmap(); } +uint64_t GetNativeMemoryHandle2(PP_Resource resource) { + scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource)); + if (image_data) + return image_data->GetNativeMemoryHandle(); + return 0; +} + const PPB_ImageData ppb_imagedata = { &GetNativeImageDataFormat, &Create, @@ -77,6 +85,10 @@ const PPB_ImageData ppb_imagedata = { &Unmap, }; +const PPB_ImageDataTrusted ppb_imagedata_trusted = { + &GetNativeMemoryHandle2, +}; + } // namespace ImageData::ImageData(PluginModule* module) @@ -93,6 +105,11 @@ const PPB_ImageData* ImageData::GetInterface() { return &ppb_imagedata; } +// static +const PPB_ImageDataTrusted* ImageData::GetTrustedInterface() { + return &ppb_imagedata_trusted; +} + bool ImageData::Init(PP_ImageDataFormat format, int width, int height, bool init_to_zero) { @@ -143,6 +160,10 @@ void ImageData::Unmap() { // in the future to save some memory. } +uint64 ImageData::GetNativeMemoryHandle() const { + return platform_image_->GetSharedMemoryHandle(); +} + const SkBitmap* ImageData::GetMappedBitmap() const { if (!mapped_canvas_.get()) return NULL; diff --git a/webkit/glue/plugins/pepper_image_data.h b/webkit/glue/plugins/pepper_image_data.h index 04d769c..4fc66f5 100644 --- a/webkit/glue/plugins/pepper_image_data.h +++ b/webkit/glue/plugins/pepper_image_data.h @@ -15,6 +15,7 @@ namespace skia { class PlatformCanvas; } +class PPB_ImageDataTrusted; class SkBitmap; namespace pepper { @@ -44,6 +45,7 @@ class ImageData : public Resource { // Returns a pointer to the interface implementing PPB_ImageData that is // exposed to the plugin. static const PPB_ImageData* GetInterface(); + static const PPB_ImageDataTrusted* GetTrustedInterface(); // Resource overrides. virtual ImageData* AsImageData() { return this; } @@ -56,6 +58,9 @@ class ImageData : public Resource { void* Map(); void Unmap(); + // PPB_ImageDataTrusted implementation. + uint64 GetNativeMemoryHandle() const; + // The mapped bitmap and canvas will be NULL if the image is not mapped. skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); } const SkBitmap* GetMappedBitmap() const; diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc index e43735f..251023f 100644 --- a/webkit/glue/plugins/pepper_plugin_module.cc +++ b/webkit/glue/plugins/pepper_plugin_module.cc @@ -34,6 +34,7 @@ #include "third_party/ppapi/c/dev/ppb_url_util_dev.h" #include "third_party/ppapi/c/dev/ppb_video_decoder_dev.h" #include "third_party/ppapi/c/dev/ppb_widget_dev.h" +#include "third_party/ppapi/c/trusted/ppb_image_data_trusted.h" #include "third_party/ppapi/c/pp_module.h" #include "third_party/ppapi/c/pp_resource.h" #include "third_party/ppapi/c/pp_var.h" @@ -209,6 +210,8 @@ const void* GetInterface(const char* name) { return PluginInstance::GetInterface(); if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0) return ImageData::GetInterface(); + if (strcmp(name, PPB_IMAGEDATA_TRUSTED_INTERFACE) == 0) + return ImageData::GetTrustedInterface(); if (strcmp(name, PPB_AUDIO_CONFIG_DEV_INTERFACE) == 0) return AudioConfig::GetInterface(); if (strcmp(name, PPB_AUDIO_DEV_INTERFACE) == 0) |