| 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/init/gl_factory.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"), |
| 24 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), | 24 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), |
| 25 hardware_rendering_available_(false) { | 25 hardware_rendering_available_(false) { |
| 26 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 26 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 27 gpu_thread_.Start(); | 27 gpu_thread_.Start(); |
| 28 control_thread_.Start(); | 28 control_thread_.Start(); |
| 29 control_thread_task_runner_ = control_thread_.task_runner(); | 29 control_thread_task_runner_ = control_thread_.task_runner(); |
| 30 base::WaitableEvent event(true, false); | 30 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 31 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 31 gpu_thread_.task_runner()->PostTask( | 32 gpu_thread_.task_runner()->PostTask( |
| 32 FROM_HERE, base::Bind(&GpuState::InitializeOnGpuThread, | 33 FROM_HERE, base::Bind(&GpuState::InitializeOnGpuThread, |
| 33 base::Unretained(this), &event)); | 34 base::Unretained(this), &event)); |
| 34 event.Wait(); | 35 event.Wait(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 GpuState::~GpuState() {} | 38 GpuState::~GpuState() {} |
| 38 | 39 |
| 39 void GpuState::StopThreads() { | 40 void GpuState::StopThreads() { |
| 40 control_thread_.Stop(); | 41 control_thread_.Stop(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 73 } |
| 73 event->Signal(); | 74 event->Signal(); |
| 74 | 75 |
| 75 } | 76 } |
| 76 | 77 |
| 77 void GpuState::DestroyGpuSpecificStateOnGpuThread() { | 78 void GpuState::DestroyGpuSpecificStateOnGpuThread() { |
| 78 driver_manager_.reset(); | 79 driver_manager_.reset(); |
| 79 } | 80 } |
| 80 | 81 |
| 81 } // namespace mus | 82 } // namespace mus |
| OLD | NEW |