OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GPU_SCHEDULER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // false unschedules. Setting to true reschedules. Whether or not the | 39 // false unschedules. Setting to true reschedules. Whether or not the |
40 // scheduler is currently scheduled is "reference counted". Every call with | 40 // scheduler is currently scheduled is "reference counted". Every call with |
41 // false must eventually be paired by a call with true. | 41 // false must eventually be paired by a call with true. |
42 void SetScheduled(bool is_scheduled); | 42 void SetScheduled(bool is_scheduled); |
43 | 43 |
44 // Returns whether the scheduler is currently scheduled to process commands. | 44 // Returns whether the scheduler is currently scheduled to process commands. |
45 bool IsScheduled(); | 45 bool IsScheduled(); |
46 | 46 |
47 // Sets a callback that is invoked just before scheduler is rescheduled. | 47 // Sets a callback that is invoked just before scheduler is rescheduled. |
48 // Takes ownership of callback object. | 48 // Takes ownership of callback object. |
49 void SetScheduledCallback(Callback0::Type* scheduled_callback); | 49 void SetScheduledCallback(const base::Closure& scheduled_callback); |
50 | 50 |
51 // Implementation of CommandBufferEngine. | 51 // Implementation of CommandBufferEngine. |
52 virtual Buffer GetSharedMemoryBuffer(int32 shm_id) OVERRIDE; | 52 virtual Buffer GetSharedMemoryBuffer(int32 shm_id) OVERRIDE; |
53 virtual void set_token(int32 token) OVERRIDE; | 53 virtual void set_token(int32 token) OVERRIDE; |
54 virtual bool SetGetOffset(int32 offset) OVERRIDE; | 54 virtual bool SetGetOffset(int32 offset) OVERRIDE; |
55 virtual int32 GetGetOffset() OVERRIDE; | 55 virtual int32 GetGetOffset() OVERRIDE; |
56 | 56 |
57 void SetCommandProcessedCallback(Callback0::Type* callback); | 57 void SetCommandProcessedCallback(const base::Closure& callback); |
58 | 58 |
59 void DeferToFence(base::Closure task); | 59 void DeferToFence(base::Closure task); |
60 | 60 |
61 private: | 61 private: |
62 | 62 |
63 // The GpuScheduler holds a weak reference to the CommandBuffer. The | 63 // The GpuScheduler holds a weak reference to the CommandBuffer. The |
64 // CommandBuffer owns the GpuScheduler and holds a strong reference to it | 64 // CommandBuffer owns the GpuScheduler and holds a strong reference to it |
65 // through the ProcessCommands callback. | 65 // through the ProcessCommands callback. |
66 CommandBuffer* command_buffer_; | 66 CommandBuffer* command_buffer_; |
67 | 67 |
(...skipping 14 matching lines...) Expand all Loading... |
82 // are issued to it before all these fences have been crossed by the GPU. | 82 // are issued to it before all these fences have been crossed by the GPU. |
83 struct UnscheduleFence { | 83 struct UnscheduleFence { |
84 UnscheduleFence(); | 84 UnscheduleFence(); |
85 ~UnscheduleFence(); | 85 ~UnscheduleFence(); |
86 | 86 |
87 uint32 fence; | 87 uint32 fence; |
88 base::Closure task; | 88 base::Closure task; |
89 }; | 89 }; |
90 std::queue<UnscheduleFence> unschedule_fences_; | 90 std::queue<UnscheduleFence> unschedule_fences_; |
91 | 91 |
92 scoped_ptr<Callback0::Type> scheduled_callback_; | 92 base::Closure scheduled_callback_; |
93 scoped_ptr<Callback0::Type> command_processed_callback_; | 93 base::Closure command_processed_callback_; |
94 }; | 94 }; |
95 | 95 |
96 } // namespace gpu | 96 } // namespace gpu |
97 | 97 |
98 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 98 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
OLD | NEW |