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

Side by Side Diff: services/ui/gpu/gpu_service_mus.cc

Issue 2247183005: services/ui: Get rid of IPC::ChannelHandle type converter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: const IPC::ChannelHandle& -> IPC::ChannelHandle * Created 4 years, 4 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
« no previous file with comments | « services/ui/gpu/gpu_service_mus.h ('k') | services/ui/public/cpp/gpu_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gpu/gpu_service_mus.h" 5 #include "services/ui/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 24 matching lines...) Expand all
35 #endif 35 #endif
36 36
37 namespace ui { 37 namespace ui {
38 namespace { 38 namespace {
39 39
40 const int kLocalGpuChannelClientId = 1; 40 const int kLocalGpuChannelClientId = 1;
41 const uint64_t kLocalGpuChannelClientTracingId = 1; 41 const uint64_t kLocalGpuChannelClientTracingId = 1;
42 42
43 void EstablishGpuChannelDone( 43 void EstablishGpuChannelDone(
44 int client_id, 44 int client_id,
45 const IPC::ChannelHandle* channel_handle, 45 IPC::ChannelHandle* channel_handle,
46 const GpuServiceMus::EstablishGpuChannelCallback& callback) { 46 const GpuServiceMus::EstablishGpuChannelCallback& callback) {
47 callback.Run(channel_handle ? client_id : -1, *channel_handle); 47 callback.Run(channel_handle ? client_id : -1, channel_handle);
48 } 48 }
49 } 49 }
50 50
51 GpuServiceMus::GpuServiceMus() 51 GpuServiceMus::GpuServiceMus()
52 : next_client_id_(kLocalGpuChannelClientId), 52 : next_client_id_(kLocalGpuChannelClientId),
53 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), 53 main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
54 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL, 54 shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
55 base::WaitableEvent::InitialState::NOT_SIGNALED), 55 base::WaitableEvent::InitialState::NOT_SIGNALED),
56 gpu_thread_("GpuThread"), 56 gpu_thread_("GpuThread"),
57 io_thread_("GpuIOThread") { 57 io_thread_("GpuIOThread") {
(...skipping 11 matching lines...) Expand all
69 69
70 void GpuServiceMus::EstablishGpuChannel( 70 void GpuServiceMus::EstablishGpuChannel(
71 uint64_t client_tracing_id, 71 uint64_t client_tracing_id,
72 bool preempts, 72 bool preempts,
73 bool allow_view_command_buffers, 73 bool allow_view_command_buffers,
74 bool allow_real_time_streams, 74 bool allow_real_time_streams,
75 const EstablishGpuChannelCallback& callback) { 75 const EstablishGpuChannelCallback& callback) {
76 DCHECK(CalledOnValidThread()); 76 DCHECK(CalledOnValidThread());
77 77
78 if (!gpu_channel_manager_) { 78 if (!gpu_channel_manager_) {
79 callback.Run(-1, IPC::ChannelHandle()); 79 callback.Run(-1, nullptr);
dcheng 2016/08/18 00:06:01 I would probably just throw a IPC::ChannelHandle o
80 return; 80 return;
81 } 81 }
82 82
83 const int client_id = ++next_client_id_; 83 const int client_id = ++next_client_id_;
84 IPC::ChannelHandle* channel_handle = new IPC::ChannelHandle; 84 IPC::ChannelHandle* channel_handle = new IPC::ChannelHandle;
85 gpu_thread_.task_runner()->PostTaskAndReply( 85 gpu_thread_.task_runner()->PostTaskAndReply(
86 FROM_HERE, 86 FROM_HERE,
87 base::Bind(&GpuServiceMus::EstablishGpuChannelOnGpuThread, 87 base::Bind(&GpuServiceMus::EstablishGpuChannelOnGpuThread,
88 base::Unretained(this), client_id, client_tracing_id, preempts, 88 base::Unretained(this), client_id, client_tracing_id, preempts,
89 allow_view_command_buffers, allow_real_time_streams, 89 allow_view_command_buffers, allow_real_time_streams,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 return shm; 266 return shm;
267 } 267 }
268 268
269 // static 269 // static
270 GpuServiceMus* GpuServiceMus::GetInstance() { 270 GpuServiceMus* GpuServiceMus::GetInstance() {
271 return base::Singleton<GpuServiceMus, 271 return base::Singleton<GpuServiceMus,
272 base::LeakySingletonTraits<GpuServiceMus>>::get(); 272 base::LeakySingletonTraits<GpuServiceMus>>::get();
273 } 273 }
274 274
275 } // namespace ui 275 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service_mus.h ('k') | services/ui/public/cpp/gpu_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698