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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 void GpuServiceProxy::OnInternalGpuChannelEstablished( | 60 void GpuServiceProxy::OnInternalGpuChannelEstablished( |
61 mojo::ScopedMessagePipeHandle channel_handle) { | 61 mojo::ScopedMessagePipeHandle channel_handle) { |
62 io_thread_ = base::MakeUnique<base::Thread>("GPUIOThread"); | 62 io_thread_ = base::MakeUnique<base::Thread>("GPUIOThread"); |
63 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); | 63 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); |
64 thread_options.priority = base::ThreadPriority::NORMAL; | 64 thread_options.priority = base::ThreadPriority::NORMAL; |
65 CHECK(io_thread_->StartWithOptions(thread_options)); | 65 CHECK(io_thread_->StartWithOptions(thread_options)); |
66 | 66 |
67 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( | 67 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>( |
68 gpu_main_.gpu_service(), kInternalGpuChannelClientId); | 68 gpu_service_.get(), kInternalGpuChannelClientId); |
69 gpu_channel_ = gpu::GpuChannelHost::Create( | 69 gpu_channel_ = gpu::GpuChannelHost::Create( |
70 this, kInternalGpuChannelClientId, gpu_info_, | 70 this, kInternalGpuChannelClientId, gpu_info_, |
71 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_, | 71 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_, |
72 gpu_memory_buffer_manager_.get()); | 72 gpu_memory_buffer_manager_.get()); |
73 if (delegate_) | 73 if (delegate_) |
74 delegate_->OnGpuChannelEstablished(gpu_channel_); | 74 delegate_->OnGpuChannelEstablished(gpu_channel_); |
75 } | 75 } |
76 | 76 |
77 void GpuServiceProxy::OnGpuChannelEstablished( | 77 void GpuServiceProxy::OnGpuChannelEstablished( |
78 const EstablishGpuChannelCallback& callback, | 78 const EstablishGpuChannelCallback& callback, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory( | 121 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory( |
122 size_t size) { | 122 size_t size) { |
123 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); | 123 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
124 if (!shm->CreateAnonymous(size)) | 124 if (!shm->CreateAnonymous(size)) |
125 shm.reset(); | 125 shm.reset(); |
126 return shm; | 126 return shm; |
127 } | 127 } |
128 | 128 |
129 } // namespace ws | 129 } // namespace ws |
130 } // namespace ui | 130 } // namespace ui |
OLD | NEW |