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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
| 11 #include <memory> |
11 #include <queue> | 12 #include <queue> |
12 #include <unordered_map> | 13 #include <unordered_map> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/atomic_sequence_num.h" | 16 #include "base/atomic_sequence_num.h" |
16 #include "base/callback.h" | 17 #include "base/callback.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | |
21 #include "base/synchronization/condition_variable.h" | 21 #include "base/synchronization/condition_variable.h" |
22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
23 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
24 #include "gpu/command_buffer/common/command_buffer_id.h" | 24 #include "gpu/command_buffer/common/command_buffer_id.h" |
25 #include "gpu/command_buffer/common/constants.h" | 25 #include "gpu/command_buffer/common/constants.h" |
26 #include "gpu/gpu_export.h" | 26 #include "gpu/gpu_export.h" |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
30 } // namespace base | 30 } // namespace base |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 }; | 284 }; |
285 | 285 |
286 // This class manages the sync points, which allow cross-channel | 286 // This class manages the sync points, which allow cross-channel |
287 // synchronization. | 287 // synchronization. |
288 class GPU_EXPORT SyncPointManager { | 288 class GPU_EXPORT SyncPointManager { |
289 public: | 289 public: |
290 explicit SyncPointManager(bool allow_threaded_wait); | 290 explicit SyncPointManager(bool allow_threaded_wait); |
291 ~SyncPointManager(); | 291 ~SyncPointManager(); |
292 | 292 |
293 // Creates/Destroy a sync point client which message processors should hold. | 293 // Creates/Destroy a sync point client which message processors should hold. |
294 scoped_ptr<SyncPointClient> CreateSyncPointClient( | 294 std::unique_ptr<SyncPointClient> CreateSyncPointClient( |
295 scoped_refptr<SyncPointOrderData> order_data, | 295 scoped_refptr<SyncPointOrderData> order_data, |
296 CommandBufferNamespace namespace_id, | 296 CommandBufferNamespace namespace_id, |
297 CommandBufferId client_id); | 297 CommandBufferId client_id); |
298 | 298 |
299 // Creates a sync point client which cannot process order numbers but can only | 299 // Creates a sync point client which cannot process order numbers but can only |
300 // Wait out of order. | 300 // Wait out of order. |
301 scoped_ptr<SyncPointClient> CreateSyncPointClientWaiter(); | 301 std::unique_ptr<SyncPointClient> CreateSyncPointClientWaiter(); |
302 | 302 |
303 // Finds the state of an already created sync point client. | 303 // Finds the state of an already created sync point client. |
304 scoped_refptr<SyncPointClientState> GetSyncPointClientState( | 304 scoped_refptr<SyncPointClientState> GetSyncPointClientState( |
305 CommandBufferNamespace namespace_id, | 305 CommandBufferNamespace namespace_id, |
306 CommandBufferId client_id); | 306 CommandBufferId client_id); |
307 | 307 |
308 private: | 308 private: |
309 friend class SyncPointClient; | 309 friend class SyncPointClient; |
310 friend class SyncPointOrderData; | 310 friend class SyncPointOrderData; |
311 | 311 |
(...skipping 11 matching lines...) Expand all Loading... |
323 // Client map holds a map of clients id to client for each namespace. | 323 // Client map holds a map of clients id to client for each namespace. |
324 base::Lock client_maps_lock_; | 324 base::Lock client_maps_lock_; |
325 ClientMap client_maps_[NUM_COMMAND_BUFFER_NAMESPACES]; | 325 ClientMap client_maps_[NUM_COMMAND_BUFFER_NAMESPACES]; |
326 | 326 |
327 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); | 327 DISALLOW_COPY_AND_ASSIGN(SyncPointManager); |
328 }; | 328 }; |
329 | 329 |
330 } // namespace gpu | 330 } // namespace gpu |
331 | 331 |
332 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ | 332 #endif // GPU_COMMAND_BUFFER_SERVICE_SYNC_POINT_MANAGER_H_ |
OLD | NEW |