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

Unified Diff: content/child/child_shared_bitmap_manager.cc

Issue 2045713002: [Merge to 2743] Exit immediately on failure to allocate SharedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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: 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 3374f4a98ba32a39e14e78a68751bf81792ebfed..32ff1632861e5dac7736eecd9ce875923e3baba9 100644
--- a/content/child/child_shared_bitmap_manager.cc
+++ b/content/child/child_shared_bitmap_manager.cc
@@ -111,8 +111,12 @@ ChildSharedBitmapManager::AllocateSharedMemoryBitmap(const gfx::Size& size) {
bool send_success =
sender_->Send(new ChildProcessHostMsg_SyncAllocateSharedBitmap(
memory_size, id, &handle));
- if (!send_success)
- return nullptr;
+ if (!send_success) {
+ // Callers of this method are not prepared to handle failures during
+ // shutdown. Exit immediately. This is expected behavior during the Fast
+ // Shutdown path, so use EXIT_SUCCESS. https://crbug.com/615121.
+ exit(EXIT_SUCCESS);
+ }
memory = base::WrapUnique(new base::SharedMemory(handle, false));
if (!memory->Map(memory_size))
CollectMemoryUsageAndDie(size, memory_size);
@@ -121,10 +125,14 @@ ChildSharedBitmapManager::AllocateSharedMemoryBitmap(const gfx::Size& size) {
memory = ChildThreadImpl::AllocateSharedMemory(memory_size, sender_.get(),
&out_of_memory);
if (!memory) {
- if (out_of_memory)
+ if (out_of_memory) {
CollectMemoryUsageAndDie(size, memory_size);
- else
- return nullptr;
+ } else {
+ // Callers of this method are not prepared to handle failures during
+ // shutdown. Exit immediately. This is expected behavior during the Fast
+ // Shutdown path, so use EXIT_SUCCESS. https://crbug.com/615121.
+ exit(EXIT_SUCCESS);
+ }
}
if (!memory->Map(memory_size))
« 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