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 "content/common/gpu/gpu_channel_manager.h" | 5 #include "content/common/gpu/gpu_channel_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "content/common/gpu/gpu_channel.h" | 12 #include "content/common/gpu/gpu_channel.h" |
| 13 #include "content/common/gpu/gpu_memory_buffer_factory.h" | 13 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 14 #include "content/common/gpu/gpu_memory_manager.h" | 14 #include "content/common/gpu/gpu_memory_manager.h" |
| 15 #include "content/common/gpu/gpu_messages.h" | 15 #include "content/common/gpu/gpu_messages.h" |
| 16 #include "content/common/message_router.h" | 16 #include "content/common/message_router.h" |
| 17 #include "gpu/command_buffer/common/value_state.h" | 17 #include "gpu/command_buffer/common/value_state.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/gpu_switches.h" | 19 #include "gpu/command_buffer/service/gpu_switches.h" |
| 20 #include "gpu/command_buffer/service/mailbox_manager.h" | 20 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 21 #include "gpu/command_buffer/service/memory_program_cache.h" | 21 #include "gpu/command_buffer/service/memory_program_cache.h" |
| 22 #include "gpu/command_buffer/service/shader_translator_cache.h" | 22 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 23 #include "gpu/command_buffer/service/sync_point_manager.h" | 23 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 24 #include "ipc/message_filter.h" | 24 #include "ipc/message_filter.h" |
| 25 #include "ui/gl/gl_bindings.h" | 25 #include "ui/gl/gl_bindings.h" |
| 26 #include "ui/gl/gl_gl_api_implementation.h" | |
| 26 #include "ui/gl/gl_share_group.h" | 27 #include "ui/gl/gl_share_group.h" |
| 27 #if defined(USE_OZONE) | 28 #if defined(USE_OZONE) |
| 28 #include "ui/ozone/public/gpu_platform_support.h" | 29 #include "ui/ozone/public/gpu_platform_support.h" |
| 29 #include "ui/ozone/public/ozone_platform.h" | 30 #include "ui/ozone/public/ozone_platform.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 namespace content { | 33 namespace content { |
| 33 | 34 |
| 34 GpuChannelManager::GpuChannelManager( | 35 GpuChannelManager::GpuChannelManager( |
| 35 MessageRouter* router, | 36 MessageRouter* router, |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 61 gpu_channels_.clear(); | 62 gpu_channels_.clear(); |
| 62 if (default_offscreen_surface_.get()) { | 63 if (default_offscreen_surface_.get()) { |
| 63 default_offscreen_surface_->Destroy(); | 64 default_offscreen_surface_->Destroy(); |
| 64 default_offscreen_surface_ = NULL; | 65 default_offscreen_surface_ = NULL; |
| 65 } | 66 } |
| 66 } | 67 } |
| 67 | 68 |
| 68 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() { | 69 gpu::gles2::ProgramCache* GpuChannelManager::program_cache() { |
| 69 if (!program_cache_.get() && | 70 if (!program_cache_.get() && |
| 70 (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary || | 71 (gfx::g_driver_gl.ext.b_GL_ARB_get_program_binary || |
| 71 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary) && | 72 gfx::g_driver_gl.ext.b_GL_OES_get_program_binary || |
| 73 gfx::GetGLVersionInfo()->is_es3) && | |
|
Zhenyao Mo
2015/07/17 23:34:04
I feel somehow this decision should be made in com
no sievers
2015/07/17 23:39:10
Yes. I think it just exists this way using the sta
| |
| 72 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 74 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 73 switches::kDisableGpuProgramCache)) { | 75 switches::kDisableGpuProgramCache)) { |
| 74 program_cache_.reset(new gpu::gles2::MemoryProgramCache()); | 76 program_cache_.reset(new gpu::gles2::MemoryProgramCache()); |
| 75 } | 77 } |
| 76 return program_cache_.get(); | 78 return program_cache_.get(); |
| 77 } | 79 } |
| 78 | 80 |
| 79 gpu::gles2::ShaderTranslatorCache* | 81 gpu::gles2::ShaderTranslatorCache* |
| 80 GpuChannelManager::shader_translator_cache() { | 82 GpuChannelManager::shader_translator_cache() { |
| 81 if (!shader_translator_cache_.get()) | 83 if (!shader_translator_cache_.get()) |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 OnResourcesRelinquished(); | 309 OnResourcesRelinquished(); |
| 308 #endif | 310 #endif |
| 309 } | 311 } |
| 310 } | 312 } |
| 311 | 313 |
| 312 void GpuChannelManager::OnResourcesRelinquished() { | 314 void GpuChannelManager::OnResourcesRelinquished() { |
| 313 Send(new GpuHostMsg_ResourcesRelinquished()); | 315 Send(new GpuHostMsg_ResourcesRelinquished()); |
| 314 } | 316 } |
| 315 | 317 |
| 316 } // namespace content | 318 } // namespace content |
| OLD | NEW |