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

Unified Diff: content/common/host_shared_bitmap_manager.cc

Issue 310973003: Fix leak with SharedBitmaps allocated by new[] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « content/common/host_shared_bitmap_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/host_shared_bitmap_manager.cc
diff --git a/content/common/host_shared_bitmap_manager.cc b/content/common/host_shared_bitmap_manager.cc
index 1f412e42eef04f38f1c5acae05d55b8c90636d8e..ac1478fe5ea07dc244ff178382418e611bfcd95d 100644
--- a/content/common/host_shared_bitmap_manager.cc
+++ b/content/common/host_shared_bitmap_manager.cc
@@ -63,7 +63,10 @@ scoped_ptr<cc::SharedBitmap> HostSharedBitmapManager::AllocateSharedBitmap(
cc::SharedBitmapId id = cc::SharedBitmap::GenerateId();
handle_map_[id] = data;
return make_scoped_ptr(new cc::SharedBitmap(
- data->pixels.get(), id, base::Bind(&FreeSharedMemory, data)));
+ data->pixels.get(),
+ id,
+ base::Bind(&HostSharedBitmapManager::FreeSharedMemoryFromMap,
+ base::Unretained(this))));
}
scoped_ptr<cc::SharedBitmap> HostSharedBitmapManager::GetSharedBitmapFromId(
@@ -184,4 +187,10 @@ void HostSharedBitmapManager::ProcessRemoved(
process_map_.erase(proc_it);
}
+void HostSharedBitmapManager::FreeSharedMemoryFromMap(
+ cc::SharedBitmap* bitmap) {
+ base::AutoLock lock(lock_);
+ handle_map_.erase(bitmap->id());
+}
+
} // namespace content
« no previous file with comments | « content/common/host_shared_bitmap_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698