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_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/atomic_ref_count.h" | 10 #include "base/atomic_ref_count.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // This should be an argument to the constructor. | 129 // This should be an argument to the constructor. |
130 scoped_ptr<CommandParser> parser_; | 130 scoped_ptr<CommandParser> parser_; |
131 | 131 |
132 // Greater than zero if this is waiting to be rescheduled before continuing. | 132 // Greater than zero if this is waiting to be rescheduled before continuing. |
133 int unscheduled_count_; | 133 int unscheduled_count_; |
134 | 134 |
135 // The number of times this scheduler has been artificially rescheduled on | 135 // The number of times this scheduler has been artificially rescheduled on |
136 // account of a timeout. | 136 // account of a timeout. |
137 int rescheduled_count_; | 137 int rescheduled_count_; |
138 | 138 |
139 // A factory for outstanding rescheduling tasks that is invalidated whenever | |
140 // the scheduler is rescheduled. | |
141 base::WeakPtrFactory<GpuScheduler> reschedule_task_factory_; | |
142 | |
143 // The GpuScheduler will unschedule itself in the event that further GL calls | 139 // The GpuScheduler will unschedule itself in the event that further GL calls |
144 // are issued to it before all these fences have been crossed by the GPU. | 140 // are issued to it before all these fences have been crossed by the GPU. |
145 struct UnscheduleFence { | 141 struct UnscheduleFence { |
146 UnscheduleFence(gfx::GLFence* fence, base::Closure task); | 142 UnscheduleFence(gfx::GLFence* fence, base::Closure task); |
147 ~UnscheduleFence(); | 143 ~UnscheduleFence(); |
148 | 144 |
149 scoped_ptr<gfx::GLFence> fence; | 145 scoped_ptr<gfx::GLFence> fence; |
150 base::Time issue_time; | 146 base::Time issue_time; |
151 base::Closure task; | 147 base::Closure task; |
152 }; | 148 }; |
153 std::queue<linked_ptr<UnscheduleFence> > unschedule_fences_; | 149 std::queue<linked_ptr<UnscheduleFence> > unschedule_fences_; |
154 | 150 |
155 SchedulingChangedCallback scheduling_changed_callback_; | 151 SchedulingChangedCallback scheduling_changed_callback_; |
156 base::Closure descheduled_callback_; | 152 base::Closure descheduled_callback_; |
157 base::Closure command_processed_callback_; | 153 base::Closure command_processed_callback_; |
158 | 154 |
159 // If non-NULL and |preemption_flag_->IsSet()|, exit PutChanged early. | 155 // If non-NULL and |preemption_flag_->IsSet()|, exit PutChanged early. |
160 scoped_refptr<PreemptionFlag> preemption_flag_; | 156 scoped_refptr<PreemptionFlag> preemption_flag_; |
161 bool was_preempted_; | 157 bool was_preempted_; |
162 | 158 |
| 159 // A factory for outstanding rescheduling tasks that is invalidated whenever |
| 160 // the scheduler is rescheduled. |
| 161 base::WeakPtrFactory<GpuScheduler> reschedule_task_factory_; |
| 162 |
163 DISALLOW_COPY_AND_ASSIGN(GpuScheduler); | 163 DISALLOW_COPY_AND_ASSIGN(GpuScheduler); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace gpu | 166 } // namespace gpu |
167 | 167 |
168 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 168 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
OLD | NEW |