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

Unified Diff: content/common/host_shared_bitmap_manager.cc

Issue 1464383004: Add lock around modification of HostSharedBitmapManagerClient::owned_bitmaps_ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 f913dba71bf0b5b31916fed5e5e431846837a4ac..04dcaa76363309682573b410303060121ed60484 100644
--- a/content/common/host_shared_bitmap_manager.cc
+++ b/content/common/host_shared_bitmap_manager.cc
@@ -63,6 +63,7 @@ HostSharedBitmapManagerClient::HostSharedBitmapManagerClient(
}
HostSharedBitmapManagerClient::~HostSharedBitmapManagerClient() {
+ base::AutoLock lock(lock_);
for (const auto& id : owned_bitmaps_)
manager_->ChildDeletedSharedBitmap(id);
}
@@ -72,6 +73,7 @@ void HostSharedBitmapManagerClient::AllocateSharedBitmapForChild(
size_t buffer_size,
const cc::SharedBitmapId& id,
base::SharedMemoryHandle* shared_memory_handle) {
+ base::AutoLock lock(lock_);
piman 2015/11/24 01:39:58 Is it possible to lock only when accessing the map
manager_->AllocateSharedBitmapForChild(process_handle, buffer_size, id,
shared_memory_handle);
owned_bitmaps_.insert(id);
@@ -82,12 +84,14 @@ void HostSharedBitmapManagerClient::ChildAllocatedSharedBitmap(
const base::SharedMemoryHandle& handle,
base::ProcessHandle process_handle,
const cc::SharedBitmapId& id) {
+ base::AutoLock lock(lock_);
manager_->ChildAllocatedSharedBitmap(buffer_size, handle, process_handle, id);
owned_bitmaps_.insert(id);
}
void HostSharedBitmapManagerClient::ChildDeletedSharedBitmap(
const cc::SharedBitmapId& id) {
+ base::AutoLock lock(lock_);
manager_->ChildDeletedSharedBitmap(id);
owned_bitmaps_.erase(id);
}
« 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