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

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

Issue 128123002: gpu: Early return GpuCommandBufferStub::OnWaitSyncPoint() if the sync point is retired. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 11 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
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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 17 matching lines...) Expand all
28 // Retires a sync point. This will call all the registered callbacks for this 28 // 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. 29 // sync point. This can only be called on the main thread.
30 void RetireSyncPoint(uint32 sync_point); 30 void RetireSyncPoint(uint32 sync_point);
31 31
32 // Adds a callback to the sync point. The callback will be called when the 32 // 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 33 // 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 34 // sync point was already retired (or not created yet). This can only be
35 // called on the main thread. 35 // called on the main thread.
36 void AddSyncPointCallback(uint32 sync_point, const base::Closure& callback); 36 void AddSyncPointCallback(uint32 sync_point, const base::Closure& callback);
37 37
38 bool IsSyncPointRetired(uint32 sync_point);
39
38 private: 40 private:
39 friend class base::RefCountedThreadSafe<SyncPointManager>; 41 friend class base::RefCountedThreadSafe<SyncPointManager>;
40 typedef std::vector<base::Closure> ClosureList; 42 typedef std::vector<base::Closure> ClosureList;
41 typedef base::hash_map<uint32, ClosureList > SyncPointMap; 43 typedef base::hash_map<uint32, ClosureList > SyncPointMap;
42 44
43 ~SyncPointManager(); 45 ~SyncPointManager();
44 46
45 base::ThreadChecker thread_checker_; 47 base::ThreadChecker thread_checker_;
46 48
47 // Protects the 2 fields below. Note: callbacks shouldn't be called with this 49 // Protects the 2 fields below. Note: callbacks shouldn't be called with this
48 // held. 50 // held.
49 base::Lock lock_; 51 base::Lock lock_;
50 SyncPointMap sync_point_map_; 52 SyncPointMap sync_point_map_;
51 uint32 next_sync_point_; 53 uint32 next_sync_point_;
52 54
53 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); 55 DISALLOW_COPY_AND_ASSIGN(SyncPointManager);
54 }; 56 };
55 57
56 } // namespace content 58 } // namespace content
57 59
58 #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_ 60 #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698