| 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/ipc/service/gpu_command_buffer_stub.h" | 5 #include "gpu/ipc/service/gpu_command_buffer_stub.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 if (time_since_idle > max_time_since_idle) | 316 if (time_since_idle > max_time_since_idle) |
| 317 is_idle = true; | 317 is_idle = true; |
| 318 } | 318 } |
| 319 | 319 |
| 320 if (is_idle) { | 320 if (is_idle) { |
| 321 last_idle_time_ = base::TimeTicks::Now(); | 321 last_idle_time_ = base::TimeTicks::Now(); |
| 322 executor_->PerformIdleWork(); | 322 executor_->PerformIdleWork(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 executor_->ProcessPendingQueries(); | 325 executor_->ProcessPendingQueries(); |
| 326 executor_->PerformPollingWork(); |
| 326 } | 327 } |
| 327 | 328 |
| 328 ScheduleDelayedWork( | 329 ScheduleDelayedWork( |
| 329 base::TimeDelta::FromMilliseconds(kHandleMoreWorkPeriodBusyMs)); | 330 base::TimeDelta::FromMilliseconds(kHandleMoreWorkPeriodBusyMs)); |
| 330 } | 331 } |
| 331 | 332 |
| 332 bool GpuCommandBufferStub::HasUnprocessedCommands() { | 333 bool GpuCommandBufferStub::HasUnprocessedCommands() { |
| 333 if (command_buffer_) { | 334 if (command_buffer_) { |
| 334 CommandBuffer::State state = command_buffer_->GetLastState(); | 335 CommandBuffer::State state = command_buffer_->GetLastState(); |
| 335 return command_buffer_->GetPutOffset() != state.get_offset && | 336 return command_buffer_->GetPutOffset() != state.get_offset && |
| 336 !error::IsError(state.error); | 337 !error::IsError(state.error); |
| 337 } | 338 } |
| 338 return false; | 339 return false; |
| 339 } | 340 } |
| 340 | 341 |
| 341 void GpuCommandBufferStub::ScheduleDelayedWork(base::TimeDelta delay) { | 342 void GpuCommandBufferStub::ScheduleDelayedWork(base::TimeDelta delay) { |
| 342 bool has_more_work = executor_.get() && (executor_->HasPendingQueries() || | 343 bool has_more_work = executor_.get() && (executor_->HasPendingQueries() || |
| 343 executor_->HasMoreIdleWork()); | 344 executor_->HasMoreIdleWork() || |
| 345 executor_->HasPollingWork()); |
| 344 if (!has_more_work) { | 346 if (!has_more_work) { |
| 345 last_idle_time_ = base::TimeTicks(); | 347 last_idle_time_ = base::TimeTicks(); |
| 346 return; | 348 return; |
| 347 } | 349 } |
| 348 | 350 |
| 349 base::TimeTicks current_time = base::TimeTicks::Now(); | 351 base::TimeTicks current_time = base::TimeTicks::Now(); |
| 350 // |process_delayed_work_time_| is set if processing of delayed work is | 352 // |process_delayed_work_time_| is set if processing of delayed work is |
| 351 // already scheduled. Just update the time if already scheduled. | 353 // already scheduled. Just update the time if already scheduled. |
| 352 if (!process_delayed_work_time_.is_null()) { | 354 if (!process_delayed_work_time_.is_null()) { |
| 353 process_delayed_work_time_ = current_time + delay; | 355 process_delayed_work_time_ = current_time + delay; |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); | 1116 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); |
| 1115 } | 1117 } |
| 1116 | 1118 |
| 1117 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1119 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1118 base::TimeDelta interval) { | 1120 base::TimeDelta interval) { |
| 1119 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1121 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1120 interval)); | 1122 interval)); |
| 1121 } | 1123 } |
| 1122 | 1124 |
| 1123 } // namespace gpu | 1125 } // namespace gpu |
| OLD | NEW |