Commit b86d19a6 authored by jbauman's avatar jbauman Committed by Commit bot

Fix race in HostSharedBitmapManager::AllocatedBitmapCount

This race should be benign, because the count is just used for a heuristic and can't truly be synchronized anyway, but best to use a lock with the access.

BUG=417194

Review URL: https://codereview.chromium.org/604583002

Cr-Commit-Position: refs/heads/master@{#296554}
parent da4b14f0
......@@ -187,6 +187,11 @@ void HostSharedBitmapManager::ProcessRemoved(
process_map_.erase(proc_it);
}
size_t HostSharedBitmapManager::AllocatedBitmapCount() const {
base::AutoLock lock(lock_);
return handle_map_.size();
}
void HostSharedBitmapManager::FreeSharedMemoryFromMap(
cc::SharedBitmap* bitmap) {
base::AutoLock lock(lock_);
......
......@@ -65,12 +65,12 @@ class CONTENT_EXPORT HostSharedBitmapManager : public cc::SharedBitmapManager {
void ChildDeletedSharedBitmap(const cc::SharedBitmapId& id);
void ProcessRemoved(base::ProcessHandle process_handle);
size_t AllocatedBitmapCount() const { return handle_map_.size(); }
size_t AllocatedBitmapCount() const;
private:
void FreeSharedMemoryFromMap(cc::SharedBitmap* bitmap);
base::Lock lock_;
mutable base::Lock lock_;
typedef base::hash_map<cc::SharedBitmapId, scoped_refptr<BitmapData> >
BitmapMap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment