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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 11469015: Renderer process can allocate anonymous shared memory without help from browser process on Windows. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rebase Created 8 years 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 | chrome/renderer/print_web_view_helper_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper.cc
===================================================================
--- chrome/renderer/print_web_view_helper.cc (revision 172434)
+++ chrome/renderer/print_web_view_helper.cc (working copy)
@@ -1398,14 +1398,15 @@
printing::Metafile* metafile,
base::SharedMemoryHandle* shared_mem_handle) {
uint32 buf_size = metafile->GetDataSize();
- base::SharedMemoryHandle mem_handle =
- content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(buf_size);
- if (base::SharedMemory::IsHandleValid(mem_handle)) {
- base::SharedMemory shared_buf(mem_handle, false);
- if (shared_buf.Map(buf_size)) {
- metafile->GetData(shared_buf.memory(), buf_size);
- shared_buf.GiveToProcess(base::GetCurrentProcessHandle(),
- shared_mem_handle);
+ scoped_ptr<base::SharedMemory> shared_buf(
+ content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(
+ buf_size).release());
+
+ if (shared_buf.get()) {
+ if (shared_buf->Map(buf_size)) {
+ metafile->GetData(shared_buf->memory(), buf_size);
+ shared_buf->GiveToProcess(base::GetCurrentProcessHandle(),
+ shared_mem_handle);
return true;
}
}
« no previous file with comments | « no previous file | chrome/renderer/print_web_view_helper_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698