Index: content/child/child_thread_impl.cc |
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc |
index f9067a14cd64b0891077f0e5b489424254f5ae1f..0b5a69168c708b5c425758bc05c149bd00698ba1 100644 |
--- a/content/child/child_thread_impl.cc |
+++ b/content/child/child_thread_impl.cc |
@@ -583,13 +583,14 @@ IPC::MessageRouter* ChildThreadImpl::GetRouter() { |
std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( |
size_t buf_size) { |
DCHECK(base::MessageLoop::current() == message_loop()); |
- return AllocateSharedMemory(buf_size, this); |
+ return AllocateSharedMemory(buf_size, this, nullptr); |
} |
// static |
std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( |
size_t buf_size, |
- IPC::Sender* sender) { |
+ IPC::Sender* sender, |
+ bool* out_of_memory) { |
std::unique_ptr<base::SharedMemory> shared_buf; |
// Ask the browser to create the shared memory, since this is blocked by the |
// sandbox on most platforms. |
@@ -599,11 +600,15 @@ std::unique_ptr<base::SharedMemory> ChildThreadImpl::AllocateSharedMemory( |
if (base::SharedMemory::IsHandleValid(shared_mem_handle)) { |
shared_buf.reset(new base::SharedMemory(shared_mem_handle, false)); |
} else { |
- NOTREACHED() << "Browser failed to allocate shared memory"; |
+ LOG(WARNING) << "Browser failed to allocate shared memory"; |
+ if (out_of_memory) |
+ *out_of_memory = true; |
return nullptr; |
} |
} else { |
// Send is allowed to fail during shutdown. Return null in this case. |
+ if (out_of_memory) |
+ *out_of_memory = false; |
return nullptr; |
} |
return shared_buf; |