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/ws/gpu_service_proxy.h" | 5 #include "services/ui/ws/gpu_service_proxy.h" |
6 | 6 |
7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 constexpr bool is_gpu_host = true; | 51 constexpr bool is_gpu_host = true; |
52 gpu_service_->EstablishGpuChannel( | 52 gpu_service_->EstablishGpuChannel( |
53 kInternalGpuChannelClientId, kInternalGpuChannelClientTracingId, | 53 kInternalGpuChannelClientId, kInternalGpuChannelClientTracingId, |
54 is_gpu_host, base::Bind(&GpuServiceProxy::OnInternalGpuChannelEstablished, | 54 is_gpu_host, base::Bind(&GpuServiceProxy::OnInternalGpuChannelEstablished, |
55 base::Unretained(this))); | 55 base::Unretained(this))); |
56 next_client_id_ = kInternalGpuChannelClientId + 1; | 56 next_client_id_ = kInternalGpuChannelClientId + 1; |
57 } | 57 } |
58 | 58 |
59 void GpuServiceProxy::OnInternalGpuChannelEstablished( | 59 void GpuServiceProxy::OnInternalGpuChannelEstablished( |
60 mojo::ScopedMessagePipeHandle channel_handle) { | 60 mojo::ScopedMessagePipeHandle channel_handle) { |
61 io_thread_.reset(new base::Thread("GPUIOThread")); | 61 io_thread_ = base::MakeUnique<base::Thread>("GPUIOThread"); |
62 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 62 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
63 thread_options.priority = base::ThreadPriority::NORMAL; | 63 thread_options.priority = base::ThreadPriority::NORMAL; |
64 CHECK(io_thread_->StartWithOptions(thread_options)); | 64 CHECK(io_thread_->StartWithOptions(thread_options)); |
65 | 65 |
66 gpu_memory_buffer_manager_.reset(new MusGpuMemoryBufferManager( | 66 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( |
67 gpu_main_.gpu_service(), kInternalGpuChannelClientId)); | 67 gpu_main_.gpu_service(), kInternalGpuChannelClientId); |
68 gpu_channel_ = gpu::GpuChannelHost::Create( | 68 gpu_channel_ = gpu::GpuChannelHost::Create( |
69 this, kInternalGpuChannelClientId, gpu_info_, | 69 this, kInternalGpuChannelClientId, gpu_info_, |
70 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_, | 70 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_, |
71 gpu_memory_buffer_manager_.get()); | 71 gpu_memory_buffer_manager_.get()); |
72 if (delegate_) | 72 if (delegate_) |
73 delegate_->OnGpuChannelEstablished(gpu_channel_); | 73 delegate_->OnGpuChannelEstablished(gpu_channel_); |
74 } | 74 } |
75 | 75 |
76 void GpuServiceProxy::OnGpuChannelEstablished( | 76 void GpuServiceProxy::OnGpuChannelEstablished( |
77 const EstablishGpuChannelCallback& callback, | 77 const EstablishGpuChannelCallback& callback, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory( | 120 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory( |
121 size_t size) { | 121 size_t size) { |
122 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); | 122 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
123 if (!shm->CreateAnonymous(size)) | 123 if (!shm->CreateAnonymous(size)) |
124 shm.reset(); | 124 shm.reset(); |
125 return shm; | 125 return shm; |
126 } | 126 } |
127 | 127 |
128 } // namespace ws | 128 } // namespace ws |
129 } // namespace ui | 129 } // namespace ui |
OLD | NEW |