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

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

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 | « chrome/browser/net/connection_tester.h ('k') | content/common/gpu/sync_point_manager.cc » ('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 #ifndef CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_ 5 #ifndef CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_
6 #define CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_ 6 #define CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/hash_tables.h" 12 #include "base/hash_tables.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 16
17 // This class manages the sync points, which allow cross-channel 17 // This class manages the sync points, which allow cross-channel
18 // synchronization. 18 // synchronization.
19 class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager>, 19 class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager> {
20 public base::ThreadChecker {
21 public: 20 public:
22 SyncPointManager(); 21 SyncPointManager();
23 22
24 // Generates a sync point, returning its ID. This can me called on any thread. 23 // Generates a sync point, returning its ID. This can me called on any thread.
25 // IDs start at 1. 24 // IDs start at 1.
26 uint32 GenerateSyncPoint(); 25 uint32 GenerateSyncPoint();
27 26
28 // Retires a sync point. This will call all the registered callbacks for this 27 // Retires a sync point. This will call all the registered callbacks for this
29 // sync point. This can only be called on the main thread. 28 // sync point. This can only be called on the main thread.
30 void RetireSyncPoint(uint32 sync_point); 29 void RetireSyncPoint(uint32 sync_point);
31 30
32 // Adds a callback to the sync point. The callback will be called when the 31 // Adds a callback to the sync point. The callback will be called when the
33 // sync point is retired, or immediately (from within that function) if the 32 // sync point is retired, or immediately (from within that function) if the
34 // sync point was already retired (or not created yet). This can only be 33 // sync point was already retired (or not created yet). This can only be
35 // called on the main thread. 34 // called on the main thread.
36 void AddSyncPointCallback(uint32 sync_point, const base::Closure& callback); 35 void AddSyncPointCallback(uint32 sync_point, const base::Closure& callback);
37 36
38 private: 37 private:
39 friend class base::RefCountedThreadSafe<SyncPointManager>; 38 friend class base::RefCountedThreadSafe<SyncPointManager>;
40 typedef std::vector<base::Closure> ClosureList; 39 typedef std::vector<base::Closure> ClosureList;
41 typedef base::hash_map<uint32, ClosureList > SyncPointMap; 40 typedef base::hash_map<uint32, ClosureList > SyncPointMap;
42 41
43 ~SyncPointManager(); 42 ~SyncPointManager();
44 43
44 base::ThreadChecker thread_checker_;
45
45 // Protects the 2 fields below. Note: callbacks shouldn't be called with this 46 // Protects the 2 fields below. Note: callbacks shouldn't be called with this
46 // held. 47 // held.
47 base::Lock lock_; 48 base::Lock lock_;
48 SyncPointMap sync_point_map_; 49 SyncPointMap sync_point_map_;
49 uint32 next_sync_point_; 50 uint32 next_sync_point_;
50 51
51 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); 52 DISALLOW_COPY_AND_ASSIGN(SyncPointManager);
52 }; 53 };
53 54
54 #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_ 55 #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/connection_tester.h ('k') | content/common/gpu/sync_point_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698