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

Unified Diff: content/child/child_shared_bitmap_manager.cc

Issue 2544953002: content: Some code cleanup related to shared memory allocation. (Closed)
Patch Set: . Created 4 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 | « 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 b0a46299d8951f66b64ca92a966f5a6b532a65ad..b26de442161f2ca69c732992761c2b10c418ab31 100644
--- a/content/child/child_shared_bitmap_manager.cc
+++ b/content/child/child_shared_bitmap_manager.cc
@@ -102,22 +102,9 @@ ChildSharedBitmapManager::AllocateSharedBitmap(const gfx::Size& size) {
if (!cc::SharedBitmap::SizeInBytes(size, &memory_size))
return std::unique_ptr<SharedMemoryBitmap>();
cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
- bool out_of_memory = false;
std::unique_ptr<base::SharedMemory> memory =
- ChildThreadImpl::AllocateSharedMemory(memory_size, nullptr,
- &out_of_memory);
- if (!memory) {
- if (out_of_memory) {
- CollectMemoryUsageAndDie(size, memory_size);
- } 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))
+ ChildThreadImpl::AllocateSharedMemory(memory_size);
+ if (!memory || !memory->Map(memory_size))
CollectMemoryUsageAndDie(size, memory_size);
NotifyAllocatedSharedBitmap(memory.get(), id);
« 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