diff options
author | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 00:09:07 +0000 |
---|---|---|
committer | nfullagar@google.com <nfullagar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-02 00:09:07 +0000 |
commit | 867b76d63d12736535ab4519ba706d08fbd3ad77 (patch) | |
tree | c254f26d3a37cbf1a3bf95f5d81e85b296914f80 /webkit/glue/plugins | |
parent | acfd49c7e6f6ffbcb4b74aa35cc7d7926cd47771 (diff) | |
download | chromium_src-867b76d63d12736535ab4519ba706d08fbd3ad77.zip chromium_src-867b76d63d12736535ab4519ba706d08fbd3ad77.tar.gz chromium_src-867b76d63d12736535ab4519ba706d08fbd3ad77.tar.bz2 |
Change trusted shared memory interface to match audio.
- shm handle uint64_t -> int
- more unification of shm size from int32_t -> uint32_t
- GetNativeMemoryHandle() -> GetSharedMemory()
BUG=none
TEST=src/ppapi/examples/
Review URL: http://codereview.chromium.org/5410001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/pepper_buffer.cc | 8 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_buffer.h | 8 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_image_data.cc | 16 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_image_data.h | 2 |
4 files changed, 19 insertions, 15 deletions
diff --git a/webkit/glue/plugins/pepper_buffer.cc b/webkit/glue/plugins/pepper_buffer.cc index cee10c9..b17370e 100644 --- a/webkit/glue/plugins/pepper_buffer.cc +++ b/webkit/glue/plugins/pepper_buffer.cc @@ -20,7 +20,7 @@ namespace pepper { namespace { -PP_Resource Create(PP_Module module_id, int32_t size) { +PP_Resource Create(PP_Module module_id, uint32_t size) { PluginModule* module = ResourceTracker::Get()->GetModule(module_id); if (!module) return 0; @@ -36,7 +36,7 @@ PP_Bool IsBuffer(PP_Resource resource) { return BoolToPPBool(!!Resource::GetAs<Buffer>(resource)); } -PP_Bool Describe(PP_Resource resource, int32_t* size_in_bytes) { +PP_Bool Describe(PP_Resource resource, uint32_t* size_in_bytes) { scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(resource)); if (!buffer) return PP_FALSE; @@ -81,7 +81,7 @@ const PPB_Buffer_Dev* Buffer::GetInterface() { return &ppb_buffer; } -bool Buffer::Init(int size) { +bool Buffer::Init(uint32_t size) { if (size == 0) return false; Unmap(); @@ -89,7 +89,7 @@ bool Buffer::Init(int size) { return true; } -void Buffer::Describe(int* size_in_bytes) const { +void Buffer::Describe(uint32_t* size_in_bytes) const { *size_in_bytes = size_; } diff --git a/webkit/glue/plugins/pepper_buffer.h b/webkit/glue/plugins/pepper_buffer.h index 2f20e55..2066bc1 100644 --- a/webkit/glue/plugins/pepper_buffer.h +++ b/webkit/glue/plugins/pepper_buffer.h @@ -20,7 +20,7 @@ class Buffer : public Resource { explicit Buffer(PluginModule* module); virtual ~Buffer(); - int size() const { return size_; } + uint32_t size() const { return size_; } unsigned char* mapped_buffer() { return mem_buffer_.get(); } // Returns true if this buffer is mapped. False means that the buffer is @@ -35,8 +35,8 @@ class Buffer : public Resource { Buffer* AsBuffer() { return this; } // PPB_Buffer implementation. - bool Init(int size); - void Describe(int* size_in_bytes) const; + bool Init(uint32_t size); + void Describe(uint32_t* size_in_bytes) const; void* Map(); void Unmap(); @@ -44,7 +44,7 @@ class Buffer : public Resource { void Swap(Buffer* other); private: - int size_; + uint32_t size_; scoped_array<unsigned char> mem_buffer_; DISALLOW_COPY_AND_ASSIGN(Buffer); diff --git a/webkit/glue/plugins/pepper_image_data.cc b/webkit/glue/plugins/pepper_image_data.cc index 92d4364..7a0ecb1 100644 --- a/webkit/glue/plugins/pepper_image_data.cc +++ b/webkit/glue/plugins/pepper_image_data.cc @@ -79,11 +79,15 @@ void Unmap(PP_Resource resource) { image_data->Unmap(); } -uint64_t GetNativeMemoryHandle2(PP_Resource resource, uint32_t* byte_count) { +int32_t GetSharedMemory(PP_Resource resource, + int* handle, + uint32_t* byte_count) { scoped_refptr<ImageData> image_data(Resource::GetAs<ImageData>(resource)); - if (image_data) - return image_data->GetNativeMemoryHandle(byte_count); - return 0; + if (image_data) { + *handle = image_data->GetSharedMemoryHandle(byte_count); + return PP_OK; + } + return PP_ERROR_BADRESOURCE; } const PPB_ImageData ppb_imagedata = { @@ -97,7 +101,7 @@ const PPB_ImageData ppb_imagedata = { }; const PPB_ImageDataTrusted ppb_imagedata_trusted = { - &GetNativeMemoryHandle2, + &GetSharedMemory, }; } // namespace @@ -189,7 +193,7 @@ void ImageData::Unmap() { // in the future to save some memory. } -uint64 ImageData::GetNativeMemoryHandle(uint32* byte_count) const { +int ImageData::GetSharedMemoryHandle(uint32* byte_count) const { return platform_image_->GetSharedMemoryHandle(byte_count); } diff --git a/webkit/glue/plugins/pepper_image_data.h b/webkit/glue/plugins/pepper_image_data.h index 473d4aa..75bead7 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(uint32* byte_count) const; + int GetSharedMemoryHandle(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(); } |