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

Side by Side Diff: content/common/gpu/sync_point_manager.cc

Issue 10694111: RefCounted types should not have public destructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android & Win compiles Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/sync_point_manager.h ('k') | gpu/command_buffer/service/shader_translator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gpu/sync_point_manager.h" 5 #include "content/common/gpu/sync_point_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 SyncPointManager::SyncPointManager() 9 SyncPointManager::SyncPointManager()
10 : next_sync_point_(1) { 10 : next_sync_point_(1) {
(...skipping 10 matching lines...) Expand all
21 // insert sync points in a loop, but if that were to happen, better explicitly 21 // insert sync points in a loop, but if that were to happen, better explicitly
22 // crash the GPU process than risk worse. 22 // crash the GPU process than risk worse.
23 // For normal operation (at most a few per frame), it would take ~a year to 23 // For normal operation (at most a few per frame), it would take ~a year to
24 // wrap. 24 // wrap.
25 CHECK(sync_point_map_.find(sync_point) == sync_point_map_.end()); 25 CHECK(sync_point_map_.find(sync_point) == sync_point_map_.end());
26 sync_point_map_.insert(std::make_pair(sync_point, ClosureList())); 26 sync_point_map_.insert(std::make_pair(sync_point, ClosureList()));
27 return sync_point; 27 return sync_point;
28 } 28 }
29 29
30 void SyncPointManager::RetireSyncPoint(uint32 sync_point) { 30 void SyncPointManager::RetireSyncPoint(uint32 sync_point) {
31 DCHECK(CalledOnValidThread()); 31 DCHECK(thread_checker_.CalledOnValidThread());
32 ClosureList list; 32 ClosureList list;
33 { 33 {
34 base::AutoLock lock(lock_); 34 base::AutoLock lock(lock_);
35 SyncPointMap::iterator it = sync_point_map_.find(sync_point); 35 SyncPointMap::iterator it = sync_point_map_.find(sync_point);
36 DCHECK(it != sync_point_map_.end()); 36 DCHECK(it != sync_point_map_.end());
37 list.swap(it->second); 37 list.swap(it->second);
38 sync_point_map_.erase(it); 38 sync_point_map_.erase(it);
39 } 39 }
40 for (ClosureList::iterator i = list.begin(); i != list.end(); ++i) 40 for (ClosureList::iterator i = list.begin(); i != list.end(); ++i)
41 i->Run(); 41 i->Run();
42 } 42 }
43 43
44 void SyncPointManager::AddSyncPointCallback(uint32 sync_point, 44 void SyncPointManager::AddSyncPointCallback(uint32 sync_point,
45 const base::Closure& callback) { 45 const base::Closure& callback) {
46 DCHECK(CalledOnValidThread()); 46 DCHECK(thread_checker_.CalledOnValidThread());
47 { 47 {
48 base::AutoLock lock(lock_); 48 base::AutoLock lock(lock_);
49 SyncPointMap::iterator it = sync_point_map_.find(sync_point); 49 SyncPointMap::iterator it = sync_point_map_.find(sync_point);
50 if (it != sync_point_map_.end()) { 50 if (it != sync_point_map_.end()) {
51 it->second.push_back(callback); 51 it->second.push_back(callback);
52 return; 52 return;
53 } 53 }
54 } 54 }
55 callback.Run(); 55 callback.Run();
56 } 56 }
OLDNEW
« no previous file with comments | « content/common/gpu/sync_point_manager.h ('k') | gpu/command_buffer/service/shader_translator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698