OLD | NEW |
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 GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 void RetireSyncPoint(uint32 sync_point); | 32 void RetireSyncPoint(uint32 sync_point); |
33 | 33 |
34 // Adds a callback to the sync point. The callback will be called when the | 34 // Adds a callback to the sync point. The callback will be called when the |
35 // sync point is retired, or immediately (from within that function) if the | 35 // sync point is retired, or immediately (from within that function) if the |
36 // sync point was already retired (or not created yet). This can only be | 36 // sync point was already retired (or not created yet). This can only be |
37 // called on the main thread. | 37 // called on the main thread. |
38 void AddSyncPointCallback(uint32 sync_point, const base::Closure& callback); | 38 void AddSyncPointCallback(uint32 sync_point, const base::Closure& callback); |
39 | 39 |
40 bool IsSyncPointRetired(uint32 sync_point); | 40 bool IsSyncPointRetired(uint32 sync_point); |
41 | 41 |
| 42 bool WasSyncPointGenerated(uint32 sync_point); |
| 43 |
42 private: | 44 private: |
43 friend class base::RefCountedThreadSafe<SyncPointManager>; | 45 friend class base::RefCountedThreadSafe<SyncPointManager>; |
44 typedef std::vector<base::Closure> ClosureList; | 46 typedef std::vector<base::Closure> ClosureList; |
45 typedef base::hash_map<uint32, ClosureList> SyncPointMap; | 47 typedef base::hash_map<uint32, ClosureList> SyncPointMap; |
46 | 48 |
47 ~SyncPointManager(); | 49 ~SyncPointManager(); |
48 | 50 |
49 base::ThreadChecker thread_checker_; | 51 base::ThreadChecker thread_checker_; |
50 | 52 |
51 // Protects the 2 fields below. Note: callbacks shouldn't be called with this | 53 // Protects the 2 fields below. Note: callbacks shouldn't be called with this |
52 // held. | 54 // held. |
53 base::Lock lock_; | 55 base::Lock lock_; |
54 SyncPointMap sync_point_map_; | 56 SyncPointMap sync_point_map_; |
55 uint32 next_sync_point_; | 57 uint32 next_sync_point_; |
56 | 58 |
57 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); | 59 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); |
58 }; | 60 }; |
59 | 61 |
60 } // namespace gpu | 62 } // namespace gpu |
61 | 63 |
62 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ | 64 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ |
OLD | NEW |