summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 03:06:51 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-09 03:06:51 +0000
commit3f5ca5c7f09aa0542d5e9bf9da76a4b1c408d1e0 (patch)
treeb877715dc62601ad153e89a5315a34b197398533
parentf9610ab5622cef8a8ac0d3ad421e0bd2d75a0d8f (diff)
downloadchromium_src-3f5ca5c7f09aa0542d5e9bf9da76a4b1c408d1e0.zip
chromium_src-3f5ca5c7f09aa0542d5e9bf9da76a4b1c408d1e0.tar.gz
chromium_src-3f5ca5c7f09aa0542d5e9bf9da76a4b1c408d1e0.tar.bz2
Change the private image data shared memory handle code to return a native
memory handle and a size rather than the internal TransportDIB structure. TEST=none BUG=none Review URL: http://codereview.chromium.org/4611001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65482 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc11
-rw-r--r--ppapi/c/trusted/ppb_image_data_trusted.h7
-rw-r--r--webkit/glue/plugins/pepper_image_data.cc8
-rw-r--r--webkit/glue/plugins/pepper_image_data.h2
-rw-r--r--webkit/glue/plugins/pepper_plugin_delegate.h7
5 files changed, 23 insertions, 12 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index d056fdb..f897435 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -65,8 +65,15 @@ class PlatformImage2DImpl : public pepper::PluginDelegate::PlatformImage2D {
return dib_->GetPlatformCanvas(width_, height_);
}
- virtual intptr_t GetSharedMemoryHandle() const {
- return reinterpret_cast<intptr_t>(dib_.get());
+ virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const {
+ *byte_count = dib_->size();
+#if defined(OS_WIN)
+ return reinterpret_cast<intptr_t>(dib_->handle());
+#elif defined(OS_MACOSX)
+ return static_cast<intptr_t>(dib_->handle().fd);
+#elif defined(OS_LINUX)
+ return static_cast<intptr_t>(dib_->handle());
+#endif
}
virtual TransportDIB* GetTransportDIB() const {
diff --git a/ppapi/c/trusted/ppb_image_data_trusted.h b/ppapi/c/trusted/ppb_image_data_trusted.h
index b72dcc2..7f3b410 100644
--- a/ppapi/c/trusted/ppb_image_data_trusted.h
+++ b/ppapi/c/trusted/ppb_image_data_trusted.h
@@ -8,14 +8,17 @@
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_resource.h"
-#define PPB_IMAGEDATA_TRUSTED_INTERFACE "PPB_ImageDataTrusted;0.1"
+#define PPB_IMAGEDATA_TRUSTED_INTERFACE "PPB_ImageDataTrusted;0.2"
struct PPB_ImageDataTrusted {
/**
* Returns the internal shared memory pointer associated with the given
* ImageData resource. Used for proxying. Returns the handle or 0 on failure.
+ * On success, the size in bytes of the shared memory region will be placed
+ * into |*byte_count|.
*/
- uint64_t (*GetNativeMemoryHandle)(PP_Resource image_data);
+ uint64_t (*GetNativeMemoryHandle)(PP_Resource image_data,
+ uint32_t* byte_count);
};
#endif // PPAPI_C_TRUSTED_PPB_IMAGE_DATA_TRUSTED_H_
diff --git a/webkit/glue/plugins/pepper_image_data.cc b/webkit/glue/plugins/pepper_image_data.cc
index 702abee..92d4364 100644
--- a/webkit/glue/plugins/pepper_image_data.cc
+++ b/webkit/glue/plugins/pepper_image_data.cc
@@ -79,10 +79,10 @@ void Unmap(PP_Resource resource) {
image_data->Unmap();
}
-uint64_t GetNativeMemoryHandle2(PP_Resource resource) {
+uint64_t GetNativeMemoryHandle2(PP_Resource resource, uint32_t* byte_count) {
scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource));
if (image_data)
- return image_data->GetNativeMemoryHandle();
+ return image_data->GetNativeMemoryHandle(byte_count);
return 0;
}
@@ -189,8 +189,8 @@ void ImageData::Unmap() {
// in the future to save some memory.
}
-uint64 ImageData::GetNativeMemoryHandle() const {
- return platform_image_->GetSharedMemoryHandle();
+uint64 ImageData::GetNativeMemoryHandle(uint32* byte_count) const {
+ return platform_image_->GetSharedMemoryHandle(byte_count);
}
const SkBitmap* ImageData::GetMappedBitmap() const {
diff --git a/webkit/glue/plugins/pepper_image_data.h b/webkit/glue/plugins/pepper_image_data.h
index b657173..473d4aa 100644
--- a/webkit/glue/plugins/pepper_image_data.h
+++ b/webkit/glue/plugins/pepper_image_data.h
@@ -64,7 +64,7 @@ class ImageData : public Resource {
void Unmap();
// PPB_ImageDataTrusted implementation.
- uint64 GetNativeMemoryHandle() const;
+ uint64 GetNativeMemoryHandle(uint32* byte_count) const;
// The mapped bitmap and canvas will be NULL if the image is not mapped.
skia::PlatformCanvas* mapped_canvas() const { return mapped_canvas_.get(); }
diff --git a/webkit/glue/plugins/pepper_plugin_delegate.h b/webkit/glue/plugins/pepper_plugin_delegate.h
index d2c67c7..5e6f9a2 100644
--- a/webkit/glue/plugins/pepper_plugin_delegate.h
+++ b/webkit/glue/plugins/pepper_plugin_delegate.h
@@ -78,9 +78,10 @@ class PluginDelegate {
virtual skia::PlatformCanvas* Map() = 0;
// Returns the platform-specific shared memory handle of the data backing
- // this image. This is used by NativeClient to send the image to the
- // out-of-process plugin. Returns 0 on failure.
- virtual intptr_t GetSharedMemoryHandle() const = 0;
+ // this image. This is used by PPAPI proxying to send the image to the
+ // out-of-process plugin. On success, the size in bytes will be placed into
+ // |*bytes_count|. Returns 0 on failure.
+ virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const = 0;
virtual TransportDIB* GetTransportDIB() const = 0;
};