| 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_channel_manager.h" | 5 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 "keep_awake_time", (now - begin_wake_up_time_).InMilliseconds()); | 257 "keep_awake_time", (now - begin_wake_up_time_).InMilliseconds()); |
| 258 if (now - last_gpu_access_time_ < | 258 if (now - last_gpu_access_time_ < |
| 259 base::TimeDelta::FromMilliseconds(kMaxGpuIdleTimeMs)) | 259 base::TimeDelta::FromMilliseconds(kMaxGpuIdleTimeMs)) |
| 260 return; | 260 return; |
| 261 if (now - begin_wake_up_time_ > | 261 if (now - begin_wake_up_time_ > |
| 262 base::TimeDelta::FromMilliseconds(kMaxKeepAliveTimeMs)) | 262 base::TimeDelta::FromMilliseconds(kMaxKeepAliveTimeMs)) |
| 263 return; | 263 return; |
| 264 | 264 |
| 265 DoWakeUpGpu(); | 265 DoWakeUpGpu(); |
| 266 | 266 |
| 267 base::MessageLoop::current()->PostDelayedTask( | 267 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 268 FROM_HERE, base::Bind(&GpuChannelManager::ScheduleWakeUpGpu, | 268 FROM_HERE, base::Bind(&GpuChannelManager::ScheduleWakeUpGpu, |
| 269 weak_factory_.GetWeakPtr()), | 269 weak_factory_.GetWeakPtr()), |
| 270 base::TimeDelta::FromMilliseconds(kMaxGpuIdleTimeMs)); | 270 base::TimeDelta::FromMilliseconds(kMaxGpuIdleTimeMs)); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void GpuChannelManager::DoWakeUpGpu() { | 273 void GpuChannelManager::DoWakeUpGpu() { |
| 274 const GpuCommandBufferStub* stub = nullptr; | 274 const GpuCommandBufferStub* stub = nullptr; |
| 275 for (const auto& kv : gpu_channels_) { | 275 for (const auto& kv : gpu_channels_) { |
| 276 const GpuChannel* channel = kv.second; | 276 const GpuChannel* channel = kv.second; |
| 277 stub = channel->GetOneStub(); | 277 stub = channel->GetOneStub(); |
| 278 if (stub) { | 278 if (stub) { |
| 279 DCHECK(stub->decoder()); | 279 DCHECK(stub->decoder()); |
| 280 break; | 280 break; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 if (!stub || !stub->decoder()->MakeCurrent()) | 283 if (!stub || !stub->decoder()->MakeCurrent()) |
| 284 return; | 284 return; |
| 285 glFinish(); | 285 glFinish(); |
| 286 DidAccessGpu(); | 286 DidAccessGpu(); |
| 287 } | 287 } |
| 288 #endif | 288 #endif |
| 289 | 289 |
| 290 } // namespace gpu | 290 } // namespace gpu |
| OLD | NEW |