diff options
author | erikchen <erikchen@chromium.org> | 2016-02-18 17:30:17 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-19 01:31:15 +0000 |
commit | 72780b29dcf5642ad50df5c3421e6e2e625c704e (patch) | |
tree | 28a8e90b4b0f91f55d1287da8f355d5b9111d1ce /components | |
parent | 2ac89b3d8c3acc46b44e8f593220f5114047f210 (diff) | |
download | chromium_src-72780b29dcf5642ad50df5c3421e6e2e625c704e.zip chromium_src-72780b29dcf5642ad50df5c3421e6e2e625c704e.tar.gz chromium_src-72780b29dcf5642ad50df5c3421e6e2e625c704e.tar.bz2 |
printing: Sandboxed processes must ask the browser to allocate shared memory.
SharedMemory is being changed on Windows so that the underlying File Mapping
Object is always named. This means that sandboxed processes must request the
object from the browser process, just like on POSIX.
BUG=493414
Review URL: https://codereview.chromium.org/1714643002
Cr-Commit-Position: refs/heads/master@{#376335}
Diffstat (limited to 'components')
-rw-r--r-- | components/printing/renderer/print_web_view_helper.cc | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc index 91c7230..0a4d1ee 100644 --- a/components/printing/renderer/print_web_view_helper.cc +++ b/components/printing/renderer/print_web_view_helper.cc @@ -1811,19 +1811,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( if (buf_size == 0) return false; -#if defined(OS_WIN) - base::SharedMemory shared_buf; - // Allocate a shared memory buffer to hold the generated metafile data. - if (!shared_buf.CreateAndMapAnonymous(buf_size)) - return false; - - // Copy the bits into shared memory. - if (!metafile.GetData(shared_buf.memory(), buf_size)) - return false; - - *shared_mem_handle = base::SharedMemory::DuplicateHandle(shared_buf.handle()); - return true; -#else scoped_ptr<base::SharedMemory> shared_buf( content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(buf_size)); if (!shared_buf) @@ -1835,9 +1822,9 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( if (!metafile.GetData(shared_buf->memory(), buf_size)) return false; - return shared_buf->GiveToProcess(base::GetCurrentProcessHandle(), - shared_mem_handle); -#endif // defined(OS_WIN) + *shared_mem_handle = + base::SharedMemory::DuplicateHandle(shared_buf->handle()); + return true; } #if defined(ENABLE_PRINT_PREVIEW) |