| 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/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Returns whether the scheduler is currently able to process more commands. | 73 // Returns whether the scheduler is currently able to process more commands. |
| 74 bool IsScheduled(); | 74 bool IsScheduled(); |
| 75 | 75 |
| 76 // Returns whether the scheduler needs to be polled again in the future. | 76 // Returns whether the scheduler needs to be polled again in the future. |
| 77 bool HasMoreWork(); | 77 bool HasMoreWork(); |
| 78 | 78 |
| 79 // Sets a callback that is invoked just before scheduler is rescheduled. | 79 // Sets a callback that is invoked just before scheduler is rescheduled. |
| 80 // Takes ownership of callback object. | 80 // Takes ownership of callback object. |
| 81 void SetScheduledCallback(const base::Closure& scheduled_callback); | 81 void SetScheduledCallback(const base::Closure& scheduled_callback); |
| 82 | 82 |
| 83 // Sets a callback that is invoked just before scheduler is descheduled. |
| 84 // Takes ownership of callback object. |
| 85 void SetDescheduledCallback(const base::Closure& descheduled_callback); |
| 86 |
| 83 // Implementation of CommandBufferEngine. | 87 // Implementation of CommandBufferEngine. |
| 84 virtual Buffer GetSharedMemoryBuffer(int32 shm_id) OVERRIDE; | 88 virtual Buffer GetSharedMemoryBuffer(int32 shm_id) OVERRIDE; |
| 85 virtual void set_token(int32 token) OVERRIDE; | 89 virtual void set_token(int32 token) OVERRIDE; |
| 86 virtual bool SetGetBuffer(int32 transfer_buffer_id) OVERRIDE; | 90 virtual bool SetGetBuffer(int32 transfer_buffer_id) OVERRIDE; |
| 87 virtual bool SetGetOffset(int32 offset) OVERRIDE; | 91 virtual bool SetGetOffset(int32 offset) OVERRIDE; |
| 88 virtual int32 GetGetOffset() OVERRIDE; | 92 virtual int32 GetGetOffset() OVERRIDE; |
| 89 | 93 |
| 90 void SetCommandProcessedCallback(const base::Closure& callback); | 94 void SetCommandProcessedCallback(const base::Closure& callback); |
| 91 | 95 |
| 92 void DeferToFence(base::Closure task); | 96 void DeferToFence(base::Closure task); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 struct UnscheduleFence { | 144 struct UnscheduleFence { |
| 141 UnscheduleFence(gfx::GLFence* fence, base::Closure task); | 145 UnscheduleFence(gfx::GLFence* fence, base::Closure task); |
| 142 ~UnscheduleFence(); | 146 ~UnscheduleFence(); |
| 143 | 147 |
| 144 scoped_ptr<gfx::GLFence> fence; | 148 scoped_ptr<gfx::GLFence> fence; |
| 145 base::Closure task; | 149 base::Closure task; |
| 146 }; | 150 }; |
| 147 std::queue<linked_ptr<UnscheduleFence> > unschedule_fences_; | 151 std::queue<linked_ptr<UnscheduleFence> > unschedule_fences_; |
| 148 | 152 |
| 149 base::Closure scheduled_callback_; | 153 base::Closure scheduled_callback_; |
| 154 base::Closure descheduled_callback_; |
| 150 base::Closure command_processed_callback_; | 155 base::Closure command_processed_callback_; |
| 151 | 156 |
| 152 // If non-NULL and |preemption_flag_->IsSet()|, exit PutChanged early. | 157 // If non-NULL and |preemption_flag_->IsSet()|, exit PutChanged early. |
| 153 scoped_refptr<PreemptionFlag> preemption_flag_; | 158 scoped_refptr<PreemptionFlag> preemption_flag_; |
| 154 bool was_preempted_; | 159 bool was_preempted_; |
| 155 | 160 |
| 156 DISALLOW_COPY_AND_ASSIGN(GpuScheduler); | 161 DISALLOW_COPY_AND_ASSIGN(GpuScheduler); |
| 157 }; | 162 }; |
| 158 | 163 |
| 159 } // namespace gpu | 164 } // namespace gpu |
| 160 | 165 |
| 161 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ | 166 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_SCHEDULER_H_ |
| OLD | NEW |