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

Side by Side Diff: services/ui/common/gpu_service.cc

Issue 2133833002: gpu::GPUInfo::GPUDevice struct traits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary changes Created 4 years, 5 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/common/gpu_service.h" 5 #include "services/ui/common/gpu_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // In browser process, EstablishGpuChannelSync() is only used by testing & 172 // In browser process, EstablishGpuChannelSync() is only used by testing &
173 // GpuProcessTransportFactory::GetGLHelper(). For GetGLHelper(), it expects 173 // GpuProcessTransportFactory::GetGLHelper(). For GetGLHelper(), it expects
174 // the gpu channel has been established, so it should not reach here. 174 // the gpu channel has been established, so it should not reach here.
175 // For testing, the asyc method should not be used. 175 // For testing, the asyc method should not be used.
176 // In renderer process, we only use EstablishGpuChannelSync(). 176 // In renderer process, we only use EstablishGpuChannelSync().
177 // So the gpu_service_ should be null here. 177 // So the gpu_service_ should be null here.
178 DCHECK(!gpu_service_); 178 DCHECK(!gpu_service_);
179 179
180 int client_id = 0; 180 int client_id = 0;
181 mojom::ChannelHandlePtr channel_handle; 181 mojom::ChannelHandlePtr channel_handle;
182 mojom::GpuInfoPtr gpu_info; 182 gpu::GPUInfo gpu_info;
183 connector_->ConnectToInterface("mojo:ui", &gpu_service_); 183 connector_->ConnectToInterface("mojo:ui", &gpu_service_);
184 { 184 {
185 base::AutoUnlock auto_unlock(lock_); 185 base::AutoUnlock auto_unlock(lock_);
186 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; 186 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
187 if (!gpu_service_->EstablishGpuChannel(&client_id, &channel_handle, 187 if (!gpu_service_->EstablishGpuChannel(&client_id, &channel_handle,
188 &gpu_info)) { 188 &gpu_info)) {
189 DLOG(WARNING) 189 DLOG(WARNING)
190 << "Channel encountered error while establishing gpu channel."; 190 << "Channel encountered error while establishing gpu channel.";
191 return; 191 return;
192 } 192 }
193 } 193 }
194 const bool locked = true; 194 const bool locked = true;
195 EstablishGpuChannelOnMainThreadDone( 195 EstablishGpuChannelOnMainThreadDone(locked, client_id,
196 locked, client_id, std::move(channel_handle), std::move(gpu_info)); 196 std::move(channel_handle), gpu_info);
197 } 197 }
198 198
199 void GpuService::EstablishGpuChannelOnMainThreadDone( 199 void GpuService::EstablishGpuChannelOnMainThreadDone(
200 bool locked, 200 bool locked,
201 int client_id, 201 int client_id,
202 mojom::ChannelHandlePtr channel_handle, 202 mojom::ChannelHandlePtr channel_handle,
203 mojom::GpuInfoPtr gpu_info) { 203 const gpu::GPUInfo& gpu_info) {
204 DCHECK(IsMainThread()); 204 DCHECK(IsMainThread());
205 scoped_refptr<gpu::GpuChannelHost> gpu_channel; 205 scoped_refptr<gpu::GpuChannelHost> gpu_channel;
206 if (client_id) { 206 if (client_id) {
207 // TODO(penghuang): Get the real gpu info from mus. 207 // TODO(penghuang): Get the real gpu info from mus.
208 gpu_channel = gpu::GpuChannelHost::Create( 208 gpu_channel = gpu::GpuChannelHost::Create(
209 this, client_id, gpu::GPUInfo(), 209 this, client_id, gpu::GPUInfo(),
210 channel_handle.To<IPC::ChannelHandle>(), &shutdown_event_, 210 channel_handle.To<IPC::ChannelHandle>(), &shutdown_event_,
211 gpu_memory_buffer_manager_.get()); 211 gpu_memory_buffer_manager_.get());
212 } 212 }
213 213
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 MojoResult result = mojo::UnwrapSharedMemoryHandle( 248 MojoResult result = mojo::UnwrapSharedMemoryHandle(
249 std::move(handle), &platform_handle, &shared_memory_size, &readonly); 249 std::move(handle), &platform_handle, &shared_memory_size, &readonly);
250 if (result != MOJO_RESULT_OK) 250 if (result != MOJO_RESULT_OK)
251 return nullptr; 251 return nullptr;
252 DCHECK_EQ(shared_memory_size, size); 252 DCHECK_EQ(shared_memory_size, size);
253 253
254 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); 254 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly);
255 } 255 }
256 256
257 } // namespace ui 257 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698