summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 02:17:03 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 02:17:03 +0000
commit1b866d76c905483bb2935627eaaebe9f785ef15b (patch)
tree6c9d4b8e1dcf5f5215f06deaa13fe2208905dc29 /ppapi
parentbac33eb460f7c94be8d30613ea8ed8804d63d23d (diff)
downloadchromium_src-1b866d76c905483bb2935627eaaebe9f785ef15b.zip
chromium_src-1b866d76c905483bb2935627eaaebe9f785ef15b.tar.gz
chromium_src-1b866d76c905483bb2935627eaaebe9f785ef15b.tar.bz2
Fixes the shared memory failure in OOO mode for the pepper example plugin
- We need to properly duplicate the memory section handle - Not clear if we should close the source handle, gut feeling says no BUG=none TEST= example plugin draws on windows with --ppapi-out-of-process --no-sandbox Review URL: http://codereview.chromium.org/6911039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/ppb_image_data_proxy.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index 3a2f788..0154a04 100644
--- a/ppapi/proxy/ppb_image_data_proxy.cc
+++ b/ppapi/proxy/ppb_image_data_proxy.cc
@@ -26,6 +26,8 @@
#elif defined(OS_MACOSX)
#include <sys/stat.h>
#include <sys/mman.h>
+#elif defined(OS_WIN)
+#include <windows.h>
#endif
namespace pp {
@@ -78,8 +80,9 @@ ImageData* ImageData::AsImageData() {
void* ImageData::Map() {
#if defined(OS_WIN)
- NOTIMPLEMENTED();
- return NULL;
+ mapped_data_ = ::MapViewOfFile(handle_, FILE_MAP_READ | FILE_MAP_WRITE,
+ 0, 0, 0);
+ return mapped_data_;
#elif defined(OS_MACOSX)
struct stat st;
if (fstat(handle_.fd, &st) != 0)
@@ -104,7 +107,8 @@ void* ImageData::Map() {
void ImageData::Unmap() {
#if defined(OS_WIN)
- NOTIMPLEMENTED();
+ if (mapped_data_)
+ ::UnmapViewOfFile(mapped_data_);
#elif defined(OS_MACOSX)
if (mapped_data_) {
struct stat st;
@@ -270,8 +274,15 @@ void PPB_ImageData_Proxy::OnMsgCreate(PP_Instance instance,
uint32_t byte_count = 0;
if (trusted) {
int32_t handle;
- if (trusted->GetSharedMemory(resource, &handle, &byte_count) == PP_OK)
- *result_image_handle = ImageData::HandleFromInt(handle);
+ if (trusted->GetSharedMemory(resource, &handle, &byte_count) == PP_OK) {
+#if defined(OS_WIN)
+ pp::proxy::ImageHandle ih = ImageData::HandleFromInt(handle);
+ *result_image_handle = dispatcher()->ShareHandleWithRemote(ih, false);
+#else
+ // TODO: This memory sharing is probaly broken on Mac.
+ *result_image_handle = ImageData::HandleFromInt(handle);
+#endif
+ }
}
result->SetHostResource(instance, resource);