| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "gpu/command_buffer/common/sync_token.h" | 17 #include "gpu/command_buffer/common/sync_token.h" |
| 18 #include "gpu/command_buffer/service/feature_info.h" | 18 #include "gpu/command_buffer/service/feature_info.h" |
| 19 #include "gpu/command_buffer/service/mailbox_manager.h" | 19 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 20 #include "gpu/command_buffer/service/memory_program_cache.h" | 20 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 21 #include "gpu/command_buffer/service/shader_translator_cache.h" | 21 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 22 #include "gpu/command_buffer/service/sync_point_manager.h" | 22 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 23 #include "gpu/ipc/common/gpu_messages.h" | 23 #include "gpu/ipc/common/gpu_messages.h" |
| 24 #include "gpu/ipc/service/gpu_channel.h" | 24 #include "gpu/ipc/service/gpu_channel.h" |
| 25 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 25 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
| 26 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" | 26 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" |
| 27 #include "gpu/ipc/service/gpu_memory_manager.h" | 27 #include "gpu/ipc/service/gpu_memory_manager.h" |
| 28 #include "ui/gl/gl_bindings.h" | 28 #include "ui/gl/gl_bindings.h" |
| 29 #include "ui/gl/gl_share_group.h" | 29 #include "ui/gl/gl_share_group.h" |
| 30 #include "ui/gl/init/gl_factory.h" |
| 30 | 31 |
| 31 namespace gpu { | 32 namespace gpu { |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 35 // Amount of time we expect the GPU to stay powered up without being used. | 36 // Amount of time we expect the GPU to stay powered up without being used. |
| 36 const int kMaxGpuIdleTimeMs = 40; | 37 const int kMaxGpuIdleTimeMs = 40; |
| 37 // Maximum amount of time we keep pinging the GPU waiting for the client to | 38 // Maximum amount of time we keep pinging the GPU waiting for the client to |
| 38 // draw. | 39 // draw. |
| 39 const int kMaxKeepAliveTimeMs = 200; | 40 const int kMaxKeepAliveTimeMs = 200; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 | 230 |
| 230 void GpuChannelManager::DestroyAllChannels() { | 231 void GpuChannelManager::DestroyAllChannels() { |
| 231 gpu_channels_.clear(); | 232 gpu_channels_.clear(); |
| 232 } | 233 } |
| 233 | 234 |
| 234 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { | 235 gfx::GLSurface* GpuChannelManager::GetDefaultOffscreenSurface() { |
| 235 if (!default_offscreen_surface_.get()) { | 236 if (!default_offscreen_surface_.get()) { |
| 236 default_offscreen_surface_ = | 237 default_offscreen_surface_ = |
| 237 gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size()); | 238 gl::init::CreateOffscreenGLSurface(gfx::Size()); |
| 238 } | 239 } |
| 239 return default_offscreen_surface_.get(); | 240 return default_offscreen_surface_.get(); |
| 240 } | 241 } |
| 241 | 242 |
| 242 #if defined(OS_ANDROID) | 243 #if defined(OS_ANDROID) |
| 243 void GpuChannelManager::DidAccessGpu() { | 244 void GpuChannelManager::DidAccessGpu() { |
| 244 last_gpu_access_time_ = base::TimeTicks::Now(); | 245 last_gpu_access_time_ = base::TimeTicks::Now(); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void GpuChannelManager::WakeUpGpu() { | 248 void GpuChannelManager::WakeUpGpu() { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 281 } |
| 281 } | 282 } |
| 282 if (!stub || !stub->decoder()->MakeCurrent()) | 283 if (!stub || !stub->decoder()->MakeCurrent()) |
| 283 return; | 284 return; |
| 284 glFinish(); | 285 glFinish(); |
| 285 DidAccessGpu(); | 286 DidAccessGpu(); |
| 286 } | 287 } |
| 287 #endif | 288 #endif |
| 288 | 289 |
| 289 } // namespace gpu | 290 } // namespace gpu |
| OLD | NEW |