Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: components/printing/renderer/print_web_view_helper.cc

Issue 1714643002: printing: Sandboxed processes must ask the browser to allocate shared memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/printing/renderer/print_web_view_helper.cc
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc
index 91c72303c93818c2e93668d37be2479ac0c2f506..0a4d1eee41828dff4c84bc857b656243a77e9139 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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698