| 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 "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/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/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "content/common/gpu/gpu_channel.h" | 16 #include "content/common/gpu/gpu_channel.h" |
| 17 #include "content/common/gpu/gpu_channel_manager_delegate.h" |
| 17 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 18 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 18 #include "content/common/gpu/gpu_memory_manager.h" | 19 #include "content/common/gpu/gpu_memory_manager.h" |
| 19 #include "content/common/gpu/gpu_messages.h" | 20 #include "content/common/gpu/gpu_messages.h" |
| 20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 21 #include "gpu/command_buffer/common/value_state.h" | 22 #include "gpu/command_buffer/common/value_state.h" |
| 22 #include "gpu/command_buffer/service/feature_info.h" | 23 #include "gpu/command_buffer/service/feature_info.h" |
| 23 #include "gpu/command_buffer/service/gpu_switches.h" | 24 #include "gpu/command_buffer/service/gpu_switches.h" |
| 24 #include "gpu/command_buffer/service/mailbox_manager.h" | 25 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 25 #include "gpu/command_buffer/service/memory_program_cache.h" | 26 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 26 #include "gpu/command_buffer/service/shader_translator_cache.h" | 27 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 // Amount of time we expect the GPU to stay powered up without being used. | 38 // Amount of time we expect the GPU to stay powered up without being used. |
| 38 const int kMaxGpuIdleTimeMs = 40; | 39 const int kMaxGpuIdleTimeMs = 40; |
| 39 // Maximum amount of time we keep pinging the GPU waiting for the client to | 40 // Maximum amount of time we keep pinging the GPU waiting for the client to |
| 40 // draw. | 41 // draw. |
| 41 const int kMaxKeepAliveTimeMs = 200; | 42 const int kMaxKeepAliveTimeMs = 200; |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 } | 45 } |
| 45 | 46 |
| 46 GpuChannelManager::GpuChannelManager( | 47 GpuChannelManager::GpuChannelManager( |
| 48 GpuChannelManagerDelegate* delegate, |
| 47 IPC::SyncChannel* channel, | 49 IPC::SyncChannel* channel, |
| 48 GpuWatchdog* watchdog, | 50 GpuWatchdog* watchdog, |
| 49 base::SingleThreadTaskRunner* task_runner, | 51 base::SingleThreadTaskRunner* task_runner, |
| 50 base::SingleThreadTaskRunner* io_task_runner, | 52 base::SingleThreadTaskRunner* io_task_runner, |
| 51 base::WaitableEvent* shutdown_event, | 53 base::WaitableEvent* shutdown_event, |
| 52 gpu::SyncPointManager* sync_point_manager, | 54 gpu::SyncPointManager* sync_point_manager, |
| 53 GpuMemoryBufferFactory* gpu_memory_buffer_factory) | 55 GpuMemoryBufferFactory* gpu_memory_buffer_factory) |
| 54 : task_runner_(task_runner), | 56 : task_runner_(task_runner), |
| 55 io_task_runner_(io_task_runner), | 57 io_task_runner_(io_task_runner), |
| 58 delegate_(delegate), |
| 56 channel_(channel), | 59 channel_(channel), |
| 57 watchdog_(watchdog), | 60 watchdog_(watchdog), |
| 58 shutdown_event_(shutdown_event), | 61 shutdown_event_(shutdown_event), |
| 59 share_group_(new gfx::GLShareGroup), | 62 share_group_(new gfx::GLShareGroup), |
| 60 mailbox_manager_(gpu::gles2::MailboxManager::Create()), | 63 mailbox_manager_(gpu::gles2::MailboxManager::Create()), |
| 61 gpu_memory_manager_(this), | 64 gpu_memory_manager_(this), |
| 62 sync_point_manager_(sync_point_manager), | 65 sync_point_manager_(sync_point_manager), |
| 63 sync_point_client_waiter_( | 66 sync_point_client_waiter_( |
| 64 sync_point_manager->CreateSyncPointClientWaiter()), | 67 sync_point_manager->CreateSyncPointClientWaiter()), |
| 65 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), | 68 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 } | 326 } |
| 324 } | 327 } |
| 325 if (!stub || !stub->decoder()->MakeCurrent()) | 328 if (!stub || !stub->decoder()->MakeCurrent()) |
| 326 return; | 329 return; |
| 327 glFinish(); | 330 glFinish(); |
| 328 DidAccessGpu(); | 331 DidAccessGpu(); |
| 329 } | 332 } |
| 330 #endif | 333 #endif |
| 331 | 334 |
| 332 } // namespace content | 335 } // namespace content |
| OLD | NEW |