| 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/gpu/gpu_service_mus.h" | 5 #include "components/mus/gpu/gpu_service_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 thread_options = base::Thread::Options(base::MessageLoop::TYPE_IO, 0); | 170 thread_options = base::Thread::Options(base::MessageLoop::TYPE_IO, 0); |
| 171 thread_options.priority = base::ThreadPriority::NORMAL; | 171 thread_options.priority = base::ThreadPriority::NORMAL; |
| 172 #if defined(OS_ANDROID) | 172 #if defined(OS_ANDROID) |
| 173 // TODO(reveman): Remove this in favor of setting it explicitly for each type | 173 // TODO(reveman): Remove this in favor of setting it explicitly for each type |
| 174 // of process. | 174 // of process. |
| 175 thread_options.priority = base::ThreadPriority::DISPLAY; | 175 thread_options.priority = base::ThreadPriority::DISPLAY; |
| 176 #endif | 176 #endif |
| 177 CHECK(io_thread_.StartWithOptions(thread_options)); | 177 CHECK(io_thread_.StartWithOptions(thread_options)); |
| 178 | 178 |
| 179 IPC::ChannelHandle channel_handle; | 179 IPC::ChannelHandle channel_handle; |
| 180 bool manual_reset = true; | 180 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL, |
| 181 bool initially_signaled = false; | 181 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 182 base::WaitableEvent event(manual_reset, initially_signaled); | |
| 183 gpu_thread_.task_runner()->PostTask( | 182 gpu_thread_.task_runner()->PostTask( |
| 184 FROM_HERE, base::Bind(&GpuServiceMus::InitializeOnGpuThread, | 183 FROM_HERE, base::Bind(&GpuServiceMus::InitializeOnGpuThread, |
| 185 base::Unretained(this), &channel_handle, &event)); | 184 base::Unretained(this), &channel_handle, &event)); |
| 186 event.Wait(); | 185 event.Wait(); |
| 187 | 186 |
| 188 gpu_memory_buffer_manager_local_.reset(new MojoGpuMemoryBufferManager); | 187 gpu_memory_buffer_manager_local_.reset(new MojoGpuMemoryBufferManager); |
| 189 gpu_channel_local_ = gpu::GpuChannelHost::Create( | 188 gpu_channel_local_ = gpu::GpuChannelHost::Create( |
| 190 this, kLocalGpuChannelClientId, gpu_info_, channel_handle, | 189 this, kLocalGpuChannelClientId, gpu_info_, channel_handle, |
| 191 &shutdown_event_, gpu_memory_buffer_manager_local_.get()); | 190 &shutdown_event_, gpu_memory_buffer_manager_local_.get()); |
| 192 } | 191 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 return shm; | 266 return shm; |
| 268 } | 267 } |
| 269 | 268 |
| 270 // static | 269 // static |
| 271 GpuServiceMus* GpuServiceMus::GetInstance() { | 270 GpuServiceMus* GpuServiceMus::GetInstance() { |
| 272 return base::Singleton<GpuServiceMus, | 271 return base::Singleton<GpuServiceMus, |
| 273 base::LeakySingletonTraits<GpuServiceMus>>::get(); | 272 base::LeakySingletonTraits<GpuServiceMus>>::get(); |
| 274 } | 273 } |
| 275 | 274 |
| 276 } // namespace mus | 275 } // namespace mus |
| OLD | NEW |