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

Unified Diff: content/child/child_shared_bitmap_manager.cc

Issue 2010563004: content: Not all memory creation failures are out of memory errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « content/child/blob_storage/webblobregistry_impl.cc ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_shared_bitmap_manager.cc
diff --git a/content/child/child_shared_bitmap_manager.cc b/content/child/child_shared_bitmap_manager.cc
index daa46279bb74a343a54aa66b34b93b238c66abb3..3374f4a98ba32a39e14e78a68751bf81792ebfed 100644
--- a/content/child/child_shared_bitmap_manager.cc
+++ b/content/child/child_shared_bitmap_manager.cc
@@ -108,15 +108,24 @@ ChildSharedBitmapManager::AllocateSharedMemoryBitmap(const gfx::Size& size) {
std::unique_ptr<base::SharedMemory> memory;
#if defined(OS_POSIX)
base::SharedMemoryHandle handle;
- sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap(
- memory_size, id, &handle));
+ bool send_success =
+ sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap(
+ memory_size, id, &handle));
+ if (!send_success)
+ return nullptr;
memory = base::WrapUnique(new base::SharedMemory(handle, false));
if (!memory->Map(memory_size))
CollectMemoryUsageAndDie(size, memory_size);
#else
- memory = ChildThreadImpl::AllocateSharedMemory(memory_size, sender_.get());
- if (!memory)
- CollectMemoryUsageAndDie(size, memory_size);
+ bool out_of_memory;
+ memory = ChildThreadImpl::AllocateSharedMemory(memory_size, sender_.get(),
+ &out_of_memory);
+ if (!memory) {
+ if (out_of_memory)
+ CollectMemoryUsageAndDie(size, memory_size);
+ else
+ return nullptr;
+ }
if (!memory->Map(memory_size))
CollectMemoryUsageAndDie(size, memory_size);
« no previous file with comments | « content/child/blob_storage/webblobregistry_impl.cc ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698