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

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

Issue 288153004: SyncPointManager never returns 0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to ToT Created 6 years, 7 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 | « no previous file | 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 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 15
16 namespace content { 16 namespace content {
17 17
18 // This class manages the sync points, which allow cross-channel 18 // This class manages the sync points, which allow cross-channel
19 // synchronization. 19 // synchronization.
20 class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager> { 20 class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager> {
21 public: 21 public:
22 SyncPointManager(); 22 SyncPointManager();
23 23
24 // Generates a sync point, returning its ID. This can me called on any thread. 24 // Generates a sync point, returning its ID. This can me called on any thread.
25 // IDs start at 1. 25 // IDs start at a random number. Never return 0.
26 uint32 GenerateSyncPoint(); 26 uint32 GenerateSyncPoint();
27 27
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.
(...skipping 15 matching lines...) Expand all
51 base::Lock lock_; 51 base::Lock lock_;
52 SyncPointMap sync_point_map_; 52 SyncPointMap sync_point_map_;
53 uint32 next_sync_point_; 53 uint32 next_sync_point_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); 55 DISALLOW_COPY_AND_ASSIGN(SyncPointManager);
56 }; 56 };
57 57
58 } // namespace content 58 } // namespace content
59 59
60 #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_ 60 #endif // CONTENT_COMMON_GPU_SYNC_POINT_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/sync_point_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698