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

Side by Side Diff: content/common/host_shared_bitmap_manager.cc

Issue 604583002: Fix race in HostSharedBitmapManager::AllocatedBitmapCount (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « content/common/host_shared_bitmap_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/host_shared_bitmap_manager.h" 5 #include "content/common/host_shared_bitmap_manager.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 base::hash_set<cc::SharedBitmapId>& res = proc_it->second; 180 base::hash_set<cc::SharedBitmapId>& res = proc_it->second;
181 181
182 for (base::hash_set<cc::SharedBitmapId>::iterator it = res.begin(); 182 for (base::hash_set<cc::SharedBitmapId>::iterator it = res.begin();
183 it != res.end(); 183 it != res.end();
184 ++it) { 184 ++it) {
185 handle_map_.erase(*it); 185 handle_map_.erase(*it);
186 } 186 }
187 process_map_.erase(proc_it); 187 process_map_.erase(proc_it);
188 } 188 }
189 189
190 size_t HostSharedBitmapManager::AllocatedBitmapCount() const {
191 base::AutoLock lock(lock_);
192 return handle_map_.size();
193 }
194
190 void HostSharedBitmapManager::FreeSharedMemoryFromMap( 195 void HostSharedBitmapManager::FreeSharedMemoryFromMap(
191 cc::SharedBitmap* bitmap) { 196 cc::SharedBitmap* bitmap) {
192 base::AutoLock lock(lock_); 197 base::AutoLock lock(lock_);
193 handle_map_.erase(bitmap->id()); 198 handle_map_.erase(bitmap->id());
194 } 199 }
195 200
196 } // namespace content 201 } // namespace content
OLDNEW
« 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