| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/gles2/gpu_state.h" | 5 #include "components/mus/gles2/gpu_state.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/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| 11 #include "gpu/config/gpu_info_collector.h" | 11 #include "gpu/config/gpu_info_collector.h" |
| 12 #include "ui/gl/gl_implementation.h" | 12 #include "ui/gl/gl_implementation.h" |
| 13 #include "ui/gl/gl_surface.h" | 13 #include "ui/gl/init/gl_factory.h" |
| 14 | 14 |
| 15 #if defined(USE_OZONE) | 15 #if defined(USE_OZONE) |
| 16 #include "ui/ozone/public/ozone_platform.h" | 16 #include "ui/ozone/public/ozone_platform.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace mus { | 19 namespace mus { |
| 20 | 20 |
| 21 GpuState::GpuState() | 21 GpuState::GpuState() |
| 22 : gpu_thread_("gpu_thread"), | 22 : gpu_thread_("gpu_thread"), |
| 23 control_thread_("gpu_command_buffer_control"), | 23 control_thread_("gpu_command_buffer_control"), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 gpu_thread_.task_runner()->PostTask( | 41 gpu_thread_.task_runner()->PostTask( |
| 42 FROM_HERE, | 42 FROM_HERE, |
| 43 base::Bind(&GpuState::DestroyGpuSpecificStateOnGpuThread, this)); | 43 base::Bind(&GpuState::DestroyGpuSpecificStateOnGpuThread, this)); |
| 44 gpu_thread_.Stop(); | 44 gpu_thread_.Stop(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void GpuState::InitializeOnGpuThread(base::WaitableEvent* event) { | 47 void GpuState::InitializeOnGpuThread(base::WaitableEvent* event) { |
| 48 #if defined(USE_OZONE) | 48 #if defined(USE_OZONE) |
| 49 ui::OzonePlatform::InitializeForGPU(); | 49 ui::OzonePlatform::InitializeForGPU(); |
| 50 #endif | 50 #endif |
| 51 hardware_rendering_available_ = gfx::GLSurface::InitializeOneOff(); | 51 hardware_rendering_available_ = gl::init::InitializeGLOneOff(); |
| 52 command_buffer_task_runner_ = new CommandBufferTaskRunner; | 52 command_buffer_task_runner_ = new CommandBufferTaskRunner; |
| 53 driver_manager_.reset(new CommandBufferDriverManager); | 53 driver_manager_.reset(new CommandBufferDriverManager); |
| 54 sync_point_manager_.reset(new gpu::SyncPointManager(true)); | 54 sync_point_manager_.reset(new gpu::SyncPointManager(true)); |
| 55 share_group_ = new gfx::GLShareGroup; | 55 share_group_ = new gfx::GLShareGroup; |
| 56 mailbox_manager_ = new gpu::gles2::MailboxManagerImpl; | 56 mailbox_manager_ = new gpu::gles2::MailboxManagerImpl; |
| 57 | 57 |
| 58 // TODO(penghuang): investigate why gpu::CollectBasicGraphicsInfo() failed on | 58 // TODO(penghuang): investigate why gpu::CollectBasicGraphicsInfo() failed on |
| 59 // windows remote desktop. | 59 // windows remote desktop. |
| 60 const gfx::GLImplementation impl = gfx::GetGLImplementation(); | 60 const gfx::GLImplementation impl = gfx::GetGLImplementation(); |
| 61 if (impl != gfx::kGLImplementationNone && | 61 if (impl != gfx::kGLImplementationNone && |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 } | 72 } |
| 73 event->Signal(); | 73 event->Signal(); |
| 74 | 74 |
| 75 } | 75 } |
| 76 | 76 |
| 77 void GpuState::DestroyGpuSpecificStateOnGpuThread() { | 77 void GpuState::DestroyGpuSpecificStateOnGpuThread() { |
| 78 driver_manager_.reset(); | 78 driver_manager_.reset(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace mus | 81 } // namespace mus |
| OLD | NEW |