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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 if (rescheduled_count_ > 0) { | 117 if (rescheduled_count_ > 0) { |
118 --rescheduled_count_; | 118 --rescheduled_count_; |
119 return; | 119 return; |
120 } else { | 120 } else { |
121 --unscheduled_count_; | 121 --unscheduled_count_; |
122 } | 122 } |
123 | 123 |
124 DCHECK_GE(unscheduled_count_, 0); | 124 DCHECK_GE(unscheduled_count_, 0); |
125 | 125 |
126 if (unscheduled_count_ == 0) { | 126 if (unscheduled_count_ == 0) { |
127 TRACE_EVENT_ASYNC_END1("gpu", "Descheduled", this, "GpuScheduler", this); | 127 TRACE_EVENT_ASYNC_END1("gpu", "ProcessingSwap", this, |
128 "GpuScheduler", this); | |
nduca
2012/09/25 18:40:15
nit: indentation should match previous line
| |
128 // When the scheduler transitions from the unscheduled to the scheduled | 129 // When the scheduler transitions from the unscheduled to the scheduled |
129 // state, cancel the task that would reschedule it after a timeout. | 130 // state, cancel the task that would reschedule it after a timeout. |
130 reschedule_task_factory_.InvalidateWeakPtrs(); | 131 reschedule_task_factory_.InvalidateWeakPtrs(); |
131 | 132 |
132 if (!scheduled_callback_.is_null()) | 133 if (!scheduled_callback_.is_null()) |
133 scheduled_callback_.Run(); | 134 scheduled_callback_.Run(); |
134 } | 135 } |
135 } else { | 136 } else { |
136 if (unscheduled_count_ == 0) { | 137 if (unscheduled_count_ == 0) { |
137 TRACE_EVENT_ASYNC_BEGIN1("gpu", "Descheduled", this, | 138 TRACE_EVENT_ASYNC_BEGIN1("gpu", "ProcessingSwap", this, |
138 "GpuScheduler", this); | 139 "GpuScheduler", this); |
139 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
140 // When the scheduler transitions from scheduled to unscheduled, post a | 141 // When the scheduler transitions from scheduled to unscheduled, post a |
141 // delayed task that it will force it back into a scheduled state after a | 142 // delayed task that it will force it back into a scheduled state after a |
142 // timeout. | 143 // timeout. |
143 MessageLoop::current()->PostDelayedTask( | 144 MessageLoop::current()->PostDelayedTask( |
144 FROM_HERE, | 145 FROM_HERE, |
145 base::Bind(&GpuScheduler::RescheduleTimeOut, | 146 base::Bind(&GpuScheduler::RescheduleTimeOut, |
146 reschedule_task_factory_.GetWeakPtr()), | 147 reschedule_task_factory_.GetWeakPtr()), |
147 base::TimeDelta::FromMilliseconds(kRescheduleTimeOutDelay)); | 148 base::TimeDelta::FromMilliseconds(kRescheduleTimeOutDelay)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
256 } | 257 } |
257 | 258 |
258 GpuScheduler::UnscheduleFence::UnscheduleFence( | 259 GpuScheduler::UnscheduleFence::UnscheduleFence( |
259 gfx::GLFence* fence_, base::Closure task_): fence(fence_), task(task_) { | 260 gfx::GLFence* fence_, base::Closure task_): fence(fence_), task(task_) { |
260 } | 261 } |
261 | 262 |
262 GpuScheduler::UnscheduleFence::~UnscheduleFence() { | 263 GpuScheduler::UnscheduleFence::~UnscheduleFence() { |
263 } | 264 } |
264 | 265 |
265 } // namespace gpu | 266 } // namespace gpu |
OLD | NEW |