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 13 matching lines...) Expand all Loading... |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate) | 26 GpuServiceProxy::GpuServiceProxy(GpuServiceProxyDelegate* delegate) |
27 : delegate_(delegate), | 27 : delegate_(delegate), |
28 next_client_id_(kInternalGpuChannelClientId + 1), | 28 next_client_id_(kInternalGpuChannelClientId + 1), |
29 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 29 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
30 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 30 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
31 base::WaitableEvent::InitialState::NOT_SIGNALED) { | 31 base::WaitableEvent::InitialState::NOT_SIGNALED) { |
32 gpu_main_.OnStart(); | 32 gpu_main_.OnStart(); |
33 // TODO(sad): Once GPU process is split, this would look like: | 33 // TODO(sad): Once GPU process is split, this would look like: |
34 // connector->ConnectToInterface("mojo:gpu", &gpu_service_); | 34 // connector->ConnectToInterface("service:gpu", &gpu_service_); |
35 gpu_main_.Create(GetProxy(&gpu_service_)); | 35 gpu_main_.Create(GetProxy(&gpu_service_)); |
36 gpu_service_->Initialize( | 36 gpu_service_->Initialize( |
37 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); | 37 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); |
38 } | 38 } |
39 | 39 |
40 GpuServiceProxy::~GpuServiceProxy() { | 40 GpuServiceProxy::~GpuServiceProxy() { |
41 if (gpu_channel_) | 41 if (gpu_channel_) |
42 gpu_channel_->DestroyChannel(); | 42 gpu_channel_->DestroyChannel(); |
43 } | 43 } |
44 | 44 |
(...skipping 75 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 |