| 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..6a9595e137c6dfbd0775e4701729fdb41e470be2 100644
|
| --- a/content/common/host_shared_bitmap_manager.cc
|
| +++ b/content/common/host_shared_bitmap_manager.cc
|
| @@ -74,7 +74,10 @@ void HostSharedBitmapManagerClient::AllocateSharedBitmapForChild(
|
| base::SharedMemoryHandle* shared_memory_handle) {
|
| manager_->AllocateSharedBitmapForChild(process_handle, buffer_size, id,
|
| shared_memory_handle);
|
| - owned_bitmaps_.insert(id);
|
| + if (*shared_memory_handle != base::SharedMemory::NULLHandle()) {
|
| + base::AutoLock lock(lock_);
|
| + owned_bitmaps_.insert(id);
|
| + }
|
| }
|
|
|
| void HostSharedBitmapManagerClient::ChildAllocatedSharedBitmap(
|
| @@ -82,14 +85,20 @@ void HostSharedBitmapManagerClient::ChildAllocatedSharedBitmap(
|
| const base::SharedMemoryHandle& handle,
|
| base::ProcessHandle process_handle,
|
| const cc::SharedBitmapId& id) {
|
| - manager_->ChildAllocatedSharedBitmap(buffer_size, handle, process_handle, id);
|
| - owned_bitmaps_.insert(id);
|
| + if (manager_->ChildAllocatedSharedBitmap(buffer_size, handle, process_handle,
|
| + id)) {
|
| + base::AutoLock lock(lock_);
|
| + owned_bitmaps_.insert(id);
|
| + }
|
| }
|
|
|
| void HostSharedBitmapManagerClient::ChildDeletedSharedBitmap(
|
| const cc::SharedBitmapId& id) {
|
| manager_->ChildDeletedSharedBitmap(id);
|
| - owned_bitmaps_.erase(id);
|
| + {
|
| + base::AutoLock lock(lock_);
|
| + owned_bitmaps_.erase(id);
|
| + }
|
| }
|
|
|
| HostSharedBitmapManager::HostSharedBitmapManager() {}
|
| @@ -176,14 +185,14 @@ bool HostSharedBitmapManager::OnMemoryDump(
|
| return true;
|
| }
|
|
|
| -void HostSharedBitmapManager::ChildAllocatedSharedBitmap(
|
| +bool HostSharedBitmapManager::ChildAllocatedSharedBitmap(
|
| size_t buffer_size,
|
| const base::SharedMemoryHandle& handle,
|
| base::ProcessHandle process_handle,
|
| const cc::SharedBitmapId& id) {
|
| base::AutoLock lock(lock_);
|
| if (handle_map_.find(id) != handle_map_.end())
|
| - return;
|
| + return false;
|
| scoped_refptr<BitmapData> data(
|
| new BitmapData(process_handle, buffer_size));
|
|
|
| @@ -195,8 +204,9 @@ void HostSharedBitmapManager::ChildAllocatedSharedBitmap(
|
| data->memory =
|
| make_scoped_ptr(new base::SharedMemory(handle, false));
|
| #endif
|
| - data->memory->Map(data->buffer_size);
|
| - data->memory->Close();
|
| + data->memory->Map(data->buffer_size);
|
| + data->memory->Close();
|
| + return true;
|
| }
|
|
|
| void HostSharedBitmapManager::AllocateSharedBitmapForChild(
|
|
|