Chromium Code Reviews| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 void GpuCommandBufferStub::PerformWork() { | 297 void GpuCommandBufferStub::PerformWork() { |
| 298 TRACE_EVENT0("gpu", "GpuCommandBufferStub::PerformWork"); | 298 TRACE_EVENT0("gpu", "GpuCommandBufferStub::PerformWork"); |
| 299 | 299 |
| 300 FastSetActiveURL(active_url_, active_url_hash_, channel_); | 300 FastSetActiveURL(active_url_, active_url_hash_, channel_); |
| 301 if (decoder_.get() && !MakeCurrent()) | 301 if (decoder_.get() && !MakeCurrent()) |
| 302 return; | 302 return; |
| 303 | 303 |
| 304 if (executor_) { | 304 if (executor_) { |
| 305 uint32_t current_unprocessed_num = | 305 uint32_t current_unprocessed_num = |
| 306 channel()->gpu_channel_manager()->GetUnprocessedOrderNum(); | 306 channel()->gpu_channel_manager()->GetUnprocessedOrderNum(); |
| 307 // We're idle when no messages were processed or scheduled. | 307 // We're idle when no messages were processed or scheduled, or if the |
| 308 // executor is descheduled. | |
| 308 bool is_idle = (previous_processed_num_ == current_unprocessed_num); | 309 bool is_idle = (previous_processed_num_ == current_unprocessed_num); |
| 310 is_idle |= !executor_->scheduled(); | |
|
piman
2016/06/10 21:52:27
Trying to think a bit more about this...
We want
erikchen
2016/06/22 19:23:07
I think that your proposed solution still has edge
piman
2016/06/22 21:47:41
Yeah, I guess we should separate "polling work", w
| |
| 309 if (!is_idle && !last_idle_time_.is_null()) { | 311 if (!is_idle && !last_idle_time_.is_null()) { |
| 310 base::TimeDelta time_since_idle = | 312 base::TimeDelta time_since_idle = |
| 311 base::TimeTicks::Now() - last_idle_time_; | 313 base::TimeTicks::Now() - last_idle_time_; |
| 312 base::TimeDelta max_time_since_idle = | 314 base::TimeDelta max_time_since_idle = |
| 313 base::TimeDelta::FromMilliseconds(kMaxTimeSinceIdleMs); | 315 base::TimeDelta::FromMilliseconds(kMaxTimeSinceIdleMs); |
| 314 | 316 |
| 315 // Force idle when it's been too long since last time we were idle. | 317 // Force idle when it's been too long since last time we were idle. |
| 316 if (time_since_idle > max_time_since_idle) | 318 if (time_since_idle > max_time_since_idle) |
| 317 is_idle = true; | 319 is_idle = true; |
| 318 } | 320 } |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1113 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); | 1115 Send(new GpuCommandBufferMsg_SwapBuffersCompleted(route_id_, params)); |
| 1114 } | 1116 } |
| 1115 | 1117 |
| 1116 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, | 1118 void GpuCommandBufferStub::SendUpdateVSyncParameters(base::TimeTicks timebase, |
| 1117 base::TimeDelta interval) { | 1119 base::TimeDelta interval) { |
| 1118 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, | 1120 Send(new GpuCommandBufferMsg_UpdateVSyncParameters(route_id_, timebase, |
| 1119 interval)); | 1121 interval)); |
| 1120 } | 1122 } |
| 1121 | 1123 |
| 1122 } // namespace gpu | 1124 } // namespace gpu |
| OLD | NEW |