summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 04:16:26 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 04:16:26 +0000
commitea27c8684c2cf233dfa439a03bd4876947de26c4 (patch)
tree46f9e20c8300a61d1d088e4cf386c748421c9d4e /webkit
parentab2b315e40d21254d82a326330902ce4468687b5 (diff)
downloadchromium_src-ea27c8684c2cf233dfa439a03bd4876947de26c4.zip
chromium_src-ea27c8684c2cf233dfa439a03bd4876947de26c4.tar.gz
chromium_src-ea27c8684c2cf233dfa439a03bd4876947de26c4.tar.bz2
Re-land 60850 Implement PPB_ImageDataTrusted on the Chrome side. This just
connects the call to the existing backend implementation. Review URL: http://codereview.chromium.org/3473021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/pepper_image_data.cc21
-rw-r--r--webkit/glue/plugins/pepper_image_data.h5
-rw-r--r--webkit/glue/plugins/pepper_plugin_module.cc3
3 files changed, 29 insertions, 0 deletions
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..f2a110b 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;
}
+struct 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)