| 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 "components/mus/common/gpu_service.h" | 5 #include "components/mus/common/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 "components/mus/common/gpu_type_converters.h" | 9 #include "components/mus/common/gpu_type_converters.h" |
| 10 #include "components/mus/common/mojo_gpu_memory_buffer_manager.h" | 10 #include "components/mus/common/mojo_gpu_memory_buffer_manager.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 mus::mojom::ChannelHandlePtr channel_handle, | 23 mus::mojom::ChannelHandlePtr channel_handle, |
| 24 mus::mojom::GpuInfoPtr gpu_info) { | 24 mus::mojom::GpuInfoPtr gpu_info) { |
| 25 *client_id_out = client_id; | 25 *client_id_out = client_id; |
| 26 *channel_handle_out = channel_handle.To<IPC::ChannelHandle>(); | 26 *channel_handle_out = channel_handle.To<IPC::ChannelHandle>(); |
| 27 // TODO(penghuang): Get the gpu info. | 27 // TODO(penghuang): Get the gpu info. |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 GpuService::GpuService() | 31 GpuService::GpuService() |
| 32 : main_message_loop_(base::MessageLoop::current()), | 32 : main_message_loop_(base::MessageLoop::current()), |
| 33 shutdown_event_(false, false), | 33 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 34 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 34 io_thread_("GPUIOThread"), | 35 io_thread_("GPUIOThread"), |
| 35 gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager) { | 36 gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager) { |
| 36 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 37 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
| 37 thread_options.priority = base::ThreadPriority::NORMAL; | 38 thread_options.priority = base::ThreadPriority::NORMAL; |
| 38 CHECK(io_thread_.StartWithOptions(thread_options)); | 39 CHECK(io_thread_.StartWithOptions(thread_options)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 GpuService::~GpuService() {} | 42 GpuService::~GpuService() {} |
| 42 | 43 |
| 43 // static | 44 // static |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 std::unique_ptr<base::SharedMemory> GpuService::AllocateSharedMemory( | 95 std::unique_ptr<base::SharedMemory> GpuService::AllocateSharedMemory( |
| 95 size_t size) { | 96 size_t size) { |
| 96 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); | 97 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
| 97 if (!shm->CreateAnonymous(size)) | 98 if (!shm->CreateAnonymous(size)) |
| 98 return std::unique_ptr<base::SharedMemory>(); | 99 return std::unique_ptr<base::SharedMemory>(); |
| 99 return shm; | 100 return shm; |
| 100 } | 101 } |
| 101 | 102 |
| 102 } // namespace mus | 103 } // namespace mus |
| OLD | NEW |