OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/gpu/gpu_service.h" | 5 #include "services/ui/gpu/gpu_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "ui/gl/gl_switches.h" | 33 #include "ui/gl/gl_switches.h" |
34 #include "ui/gl/gpu_switching_manager.h" | 34 #include "ui/gl/gpu_switching_manager.h" |
35 #include "ui/gl/init/gl_factory.h" | 35 #include "ui/gl/init/gl_factory.h" |
36 #include "url/gurl.h" | 36 #include "url/gurl.h" |
37 | 37 |
38 namespace ui { | 38 namespace ui { |
39 | 39 |
40 GpuService::GpuService(const gpu::GPUInfo& gpu_info, | 40 GpuService::GpuService(const gpu::GPUInfo& gpu_info, |
41 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, | 41 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, |
42 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, | 42 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, |
43 scoped_refptr<base::SingleThreadTaskRunner> io_runner) | 43 scoped_refptr<base::SingleThreadTaskRunner> io_runner, |
| 44 const gpu::GpuFeatureInfo& gpu_feature_info) |
44 : io_runner_(std::move(io_runner)), | 45 : io_runner_(std::move(io_runner)), |
45 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, | 46 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
46 base::WaitableEvent::InitialState::NOT_SIGNALED), | 47 base::WaitableEvent::InitialState::NOT_SIGNALED), |
47 watchdog_thread_(std::move(watchdog_thread)), | 48 watchdog_thread_(std::move(watchdog_thread)), |
48 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), | 49 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), |
49 gpu_info_(gpu_info), | 50 gpu_info_(gpu_info), |
| 51 gpu_feature_info_(gpu_feature_info), |
50 sync_point_manager_(nullptr) {} | 52 sync_point_manager_(nullptr) {} |
51 | 53 |
52 GpuService::~GpuService() { | 54 GpuService::~GpuService() { |
53 bindings_.CloseAllBindings(); | 55 bindings_.CloseAllBindings(); |
54 media_gpu_channel_manager_.reset(); | 56 media_gpu_channel_manager_.reset(); |
55 gpu_channel_manager_.reset(); | 57 gpu_channel_manager_.reset(); |
56 owned_sync_point_manager_.reset(); | 58 owned_sync_point_manager_.reset(); |
57 | 59 |
58 // Signal this event before destroying the child process. That way all | 60 // Signal this event before destroying the child process. That way all |
59 // background threads can cleanup. | 61 // background threads can cleanup. |
(...skipping 26 matching lines...) Expand all Loading... |
86 sync_point_manager_ = owned_sync_point_manager_.get(); | 88 sync_point_manager_ = owned_sync_point_manager_.get(); |
87 } | 89 } |
88 | 90 |
89 // Defer creation of the render thread. This is to prevent it from handling | 91 // Defer creation of the render thread. This is to prevent it from handling |
90 // IPC messages before the sandbox has been enabled and all other necessary | 92 // IPC messages before the sandbox has been enabled and all other necessary |
91 // initialization has succeeded. | 93 // initialization has succeeded. |
92 gpu_channel_manager_.reset(new gpu::GpuChannelManager( | 94 gpu_channel_manager_.reset(new gpu::GpuChannelManager( |
93 gpu_preferences_, this, watchdog_thread_.get(), | 95 gpu_preferences_, this, watchdog_thread_.get(), |
94 base::ThreadTaskRunnerHandle::Get().get(), io_runner_.get(), | 96 base::ThreadTaskRunnerHandle::Get().get(), io_runner_.get(), |
95 shutdown_event ? shutdown_event : &shutdown_event_, sync_point_manager_, | 97 shutdown_event ? shutdown_event : &shutdown_event_, sync_point_manager_, |
96 gpu_memory_buffer_factory_)); | 98 gpu_memory_buffer_factory_, gpu_feature_info_)); |
97 | 99 |
98 media_gpu_channel_manager_.reset( | 100 media_gpu_channel_manager_.reset( |
99 new media::MediaGpuChannelManager(gpu_channel_manager_.get())); | 101 new media::MediaGpuChannelManager(gpu_channel_manager_.get())); |
100 } | 102 } |
101 | 103 |
102 void GpuService::Bind(mojom::GpuServiceRequest request) { | 104 void GpuService::Bind(mojom::GpuServiceRequest request) { |
103 bindings_.AddBinding(this, std::move(request)); | 105 bindings_.AddBinding(this, std::move(request)); |
104 } | 106 } |
105 | 107 |
106 void GpuService::CreateGpuMemoryBuffer( | 108 void GpuService::CreateGpuMemoryBuffer( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 mojo::ScopedMessagePipeHandle channel_handle; | 182 mojo::ScopedMessagePipeHandle channel_handle; |
181 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( | 183 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( |
182 client_id, client_tracing_id, preempts, allow_view_command_buffers, | 184 client_id, client_tracing_id, preempts, allow_view_command_buffers, |
183 allow_real_time_streams); | 185 allow_real_time_streams); |
184 channel_handle.reset(handle.mojo_handle); | 186 channel_handle.reset(handle.mojo_handle); |
185 media_gpu_channel_manager_->AddChannel(client_id); | 187 media_gpu_channel_manager_->AddChannel(client_id); |
186 callback.Run(std::move(channel_handle)); | 188 callback.Run(std::move(channel_handle)); |
187 } | 189 } |
188 | 190 |
189 } // namespace ui | 191 } // namespace ui |
OLD | NEW |