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/common/gpu_service.h" | 5 #include "services/ui/public/cpp/gpu_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" | 11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" |
12 #include "mojo/public/cpp/system/platform_handle.h" | 12 #include "mojo/public/cpp/system/platform_handle.h" |
13 #include "services/shell/public/cpp/connector.h" | 13 #include "services/shell/public/cpp/connector.h" |
14 #include "services/ui/common/gpu_type_converters.h" | 14 #include "services/ui/common/gpu_type_converters.h" |
15 #include "services/ui/common/mojo_gpu_memory_buffer_manager.h" | |
16 #include "services/ui/common/switches.h" | 15 #include "services/ui/common/switches.h" |
| 16 #include "services/ui/public/cpp/mojo_gpu_memory_buffer_manager.h" |
17 #include "services/ui/public/interfaces/gpu_service.mojom.h" | 17 #include "services/ui/public/interfaces/gpu_service.mojom.h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 void PostTask(scoped_refptr<base::SingleThreadTaskRunner> runner, | 23 void PostTask(scoped_refptr<base::SingleThreadTaskRunner> runner, |
24 const tracked_objects::Location& from_here, | 24 const tracked_objects::Location& from_here, |
25 const gpu::GpuChannelEstablishedCallback& callback, | 25 const gpu::GpuChannelEstablishedCallback& callback, |
26 scoped_refptr<gpu::GpuChannelHost> established_channel_host) { | 26 scoped_refptr<gpu::GpuChannelHost> established_channel_host) { |
27 runner->PostTask(from_here, | 27 runner->PostTask(from_here, |
28 base::Bind(callback, std::move(established_channel_host))); | 28 base::Bind(callback, std::move(established_channel_host))); |
29 } | 29 } |
30 | 30 |
31 } | 31 } // namespace |
32 | 32 |
33 GpuService::GpuService(shell::Connector* connector) | 33 GpuService::GpuService(shell::Connector* connector) |
34 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 34 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
35 connector_(connector), | 35 connector_(connector), |
36 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 36 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
37 base::WaitableEvent::InitialState::NOT_SIGNALED), | 37 base::WaitableEvent::InitialState::NOT_SIGNALED), |
38 io_thread_("GPUIOThread"), | 38 io_thread_("GPUIOThread"), |
39 gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager), | 39 gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager), |
40 is_establishing_(false), | 40 is_establishing_(false), |
41 establishing_condition_(&lock_) { | 41 establishing_condition_(&lock_) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 MojoResult result = mojo::UnwrapSharedMemoryHandle( | 217 MojoResult result = mojo::UnwrapSharedMemoryHandle( |
218 std::move(handle), &platform_handle, &shared_memory_size, &readonly); | 218 std::move(handle), &platform_handle, &shared_memory_size, &readonly); |
219 if (result != MOJO_RESULT_OK) | 219 if (result != MOJO_RESULT_OK) |
220 return nullptr; | 220 return nullptr; |
221 DCHECK_EQ(shared_memory_size, size); | 221 DCHECK_EQ(shared_memory_size, size); |
222 | 222 |
223 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); | 223 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); |
224 } | 224 } |
225 | 225 |
226 } // namespace ui | 226 } // namespace ui |
OLD | NEW |