From c9db4db743afc8ddd0717f08099a2c41e19e637f Mon Sep 17 00:00:00 2001 From: jbauman Date: Fri, 12 Dec 2014 17:42:59 -0800 Subject: [PATCH] Close renderer SharedBitmap file descriptors immediately after mapping The file descriptors aren't needed anymore once the file is mapped, and we want to avoid running out. BUG=364272,362048,434890,425766,412136,376441,436677 Review URL: https://codereview.chromium.org/799133003 Cr-Commit-Position: refs/heads/master@{#308217} --- content/child/child_shared_bitmap_manager.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/child/child_shared_bitmap_manager.cc b/content/child/child_shared_bitmap_manager.cc index 9dc86bd679b5..aa9f1f37ba6d 100644 --- a/content/child/child_shared_bitmap_manager.cc +++ b/content/child/child_shared_bitmap_manager.cc @@ -55,7 +55,13 @@ ChildSharedBitmapManager::~ChildSharedBitmapManager() {} scoped_ptr ChildSharedBitmapManager::AllocateSharedBitmap( const gfx::Size& size) { - return AllocateSharedMemoryBitmap(size); + scoped_ptr bitmap = AllocateSharedMemoryBitmap(size); +#if defined(OS_POSIX) + // Close file descriptor to avoid running out. + if (bitmap) + bitmap->shared_memory()->Close(); +#endif + return bitmap.Pass(); } scoped_ptr -- 2.11.4.GIT