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 #include "gpu/command_buffer/service/gpu_scheduler.h" | 5 #include "gpu/command_buffer/service/gpu_scheduler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (rescheduled_count_ > 0) { | 122 if (rescheduled_count_ > 0) { |
123 --rescheduled_count_; | 123 --rescheduled_count_; |
124 return; | 124 return; |
125 } else { | 125 } else { |
126 --unscheduled_count_; | 126 --unscheduled_count_; |
127 } | 127 } |
128 | 128 |
129 DCHECK_GE(unscheduled_count_, 0); | 129 DCHECK_GE(unscheduled_count_, 0); |
130 | 130 |
131 if (unscheduled_count_ == 0) { | 131 if (unscheduled_count_ == 0) { |
132 TRACE_EVENT_ASYNC_END1("gpu", "Descheduled", this, "GpuScheduler", this); | 132 TRACE_EVENT_ASYNC_END1("gpu", "ProcessingSwap", this, |
| 133 "GpuScheduler", this); |
133 // When the scheduler transitions from the unscheduled to the scheduled | 134 // When the scheduler transitions from the unscheduled to the scheduled |
134 // state, cancel the task that would reschedule it after a timeout. | 135 // state, cancel the task that would reschedule it after a timeout. |
135 reschedule_task_factory_.InvalidateWeakPtrs(); | 136 reschedule_task_factory_.InvalidateWeakPtrs(); |
136 | 137 |
137 if (!scheduled_callback_.is_null()) | 138 if (!scheduled_callback_.is_null()) |
138 scheduled_callback_.Run(); | 139 scheduled_callback_.Run(); |
139 } | 140 } |
140 } else { | 141 } else { |
141 if (unscheduled_count_ == 0) { | 142 if (unscheduled_count_ == 0) { |
142 TRACE_EVENT_ASYNC_BEGIN1("gpu", "Descheduled", this, | 143 TRACE_EVENT_ASYNC_BEGIN1("gpu", "ProcessingSwap", this, |
143 "GpuScheduler", this); | 144 "GpuScheduler", this); |
144 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
145 // When the scheduler transitions from scheduled to unscheduled, post a | 146 // When the scheduler transitions from scheduled to unscheduled, post a |
146 // delayed task that it will force it back into a scheduled state after a | 147 // delayed task that it will force it back into a scheduled state after a |
147 // timeout. | 148 // timeout. |
148 MessageLoop::current()->PostDelayedTask( | 149 MessageLoop::current()->PostDelayedTask( |
149 FROM_HERE, | 150 FROM_HERE, |
150 base::Bind(&GpuScheduler::RescheduleTimeOut, | 151 base::Bind(&GpuScheduler::RescheduleTimeOut, |
151 reschedule_task_factory_.GetWeakPtr()), | 152 reschedule_task_factory_.GetWeakPtr()), |
152 base::TimeDelta::FromMilliseconds(kRescheduleTimeOutDelay)); | 153 base::TimeDelta::FromMilliseconds(kRescheduleTimeOutDelay)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 262 } |
262 | 263 |
263 GpuScheduler::UnscheduleFence::UnscheduleFence( | 264 GpuScheduler::UnscheduleFence::UnscheduleFence( |
264 gfx::GLFence* fence_, base::Closure task_): fence(fence_), task(task_) { | 265 gfx::GLFence* fence_, base::Closure task_): fence(fence_), task(task_) { |
265 } | 266 } |
266 | 267 |
267 GpuScheduler::UnscheduleFence::~UnscheduleFence() { | 268 GpuScheduler::UnscheduleFence::~UnscheduleFence() { |
268 } | 269 } |
269 | 270 |
270 } // namespace gpu | 271 } // namespace gpu |
OLD | NEW |