Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: services/ui/ws/gpu_service_proxy.cc

Issue 2366623002: services/ui: Initialize all of gpu in one thread. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 const uint64_t kInternalGpuChannelClientTracingId = 1; 22 const uint64_t kInternalGpuChannelClientTracingId = 1;
23 23
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), 28 next_client_id_(kInternalGpuChannelClientId),
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 // TODO(sad): Once GPU process is split, this would look like: 33 // TODO(sad): Once GPU process is split, this would look like:
33 // connector->ConnectToInterface("mojo:gpu", &gpu_service_); 34 // connector->ConnectToInterface("mojo:gpu", &gpu_service_);
34 gpu_main_.Add(GetProxy(&gpu_service_)); 35 gpu_main_.Create(GetProxy(&gpu_service_));
35 gpu_service_->Initialize( 36 gpu_service_->Initialize(
36 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this))); 37 base::Bind(&GpuServiceProxy::OnInitialized, base::Unretained(this)));
37 } 38 }
38 39
39 GpuServiceProxy::~GpuServiceProxy() { 40 GpuServiceProxy::~GpuServiceProxy() {
40 if (gpu_channel_) 41 if (gpu_channel_)
41 gpu_channel_->DestroyChannel(); 42 gpu_channel_->DestroyChannel();
42 } 43 }
43 44
44 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) { 45 void GpuServiceProxy::Add(mojom::GpuServiceRequest request) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory( 121 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory(
121 size_t size) { 122 size_t size) {
122 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); 123 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
123 if (!shm->CreateAnonymous(size)) 124 if (!shm->CreateAnonymous(size))
124 shm.reset(); 125 shm.reset();
125 return shm; 126 return shm;
126 } 127 }
127 128
128 } // namespace ws 129 } // namespace ws
129 } // namespace ui 130 } // namespace ui
OLDNEW
« services/ui/gpu/gpu_main.cc ('K') | « services/ui/gpu/gpu_service_internal.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698