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

Unified Diff: content/child/child_thread_impl.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
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;
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/renderer/media/renderer_gpu_video_accelerator_factories.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698