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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 2038423004: Use ChannelMojo for Browser-GPU and Renderer-GPU IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-utility-channel-mojo
Patch Set: fix pepper Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 gpu_client_id_, gpu_client_tracing_id_, preempts, 142 gpu_client_id_, gpu_client_tracing_id_, preempts,
143 allow_view_command_buffers, allow_real_time_streams, 143 allow_view_command_buffers, allow_real_time_streams,
144 base::Bind( 144 base::Bind(
145 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO, 145 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO,
146 this)); 146 this));
147 } 147 }
148 148
149 void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( 149 void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO(
150 const IPC::ChannelHandle& channel_handle, 150 const IPC::ChannelHandle& channel_handle,
151 const gpu::GPUInfo& gpu_info) { 151 const gpu::GPUInfo& gpu_info) {
152 if (channel_handle.name.empty() && reused_gpu_process_) { 152 if (!channel_handle.mojo_handle.is_valid() && reused_gpu_process_) {
153 // We failed after re-using the GPU process, but it may have died in the 153 // We failed after re-using the GPU process, but it may have died in the
154 // mean time. Retry to have a chance to create a fresh GPU process. 154 // mean time. Retry to have a chance to create a fresh GPU process.
155 DVLOG(1) << "Failed to create channel on existing GPU process. Trying to " 155 DVLOG(1) << "Failed to create channel on existing GPU process. Trying to "
156 "restart GPU process."; 156 "restart GPU process.";
157 EstablishOnIO(); 157 EstablishOnIO();
158 } else { 158 } else {
159 channel_handle_ = channel_handle; 159 channel_handle_ = channel_handle;
160 gpu_info_ = gpu_info; 160 gpu_info_ = gpu_info;
161 FinishOnIO(); 161 FinishOnIO();
162 } 162 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 gpu::GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() { 323 gpu::GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() {
324 if (gpu_channel_.get() && !gpu_channel_->IsLost()) 324 if (gpu_channel_.get() && !gpu_channel_->IsLost())
325 return gpu_channel_.get(); 325 return gpu_channel_.get();
326 326
327 return NULL; 327 return NULL;
328 } 328 }
329 329
330 void BrowserGpuChannelHostFactory::GpuChannelEstablished() { 330 void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
331 DCHECK(IsMainThread()); 331 DCHECK(IsMainThread());
332 DCHECK(pending_request_.get()); 332 DCHECK(pending_request_.get());
333 if (pending_request_->channel_handle().name.empty()) { 333 if (!pending_request_->channel_handle().mojo_handle.is_valid()) {
334 DCHECK(!gpu_channel_.get()); 334 DCHECK(!gpu_channel_.get());
335 } else { 335 } else {
336 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866 336 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866
337 // is fixed. 337 // is fixed.
338 tracked_objects::ScopedTracker tracking_profile1( 338 tracked_objects::ScopedTracker tracking_profile1(
339 FROM_HERE_WITH_EXPLICIT_FUNCTION( 339 FROM_HERE_WITH_EXPLICIT_FUNCTION(
340 "466866 BrowserGpuChannelHostFactory::GpuChannelEstablished1")); 340 "466866 BrowserGpuChannelHostFactory::GpuChannelEstablished1"));
341 GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); 341 GetContentClient()->SetGpuInfo(pending_request_->gpu_info());
342 gpu_channel_ = gpu::GpuChannelHost::Create( 342 gpu_channel_ = gpu::GpuChannelHost::Create(
343 this, gpu_client_id_, pending_request_->gpu_info(), 343 this, gpu_client_id_, pending_request_->gpu_info(),
(...skipping 27 matching lines...) Expand all
371 } 371 }
372 372
373 // static 373 // static
374 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( 374 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO(
375 int gpu_client_id, 375 int gpu_client_id,
376 const base::FilePath& cache_dir) { 376 const base::FilePath& cache_dir) {
377 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); 377 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir);
378 } 378 }
379 379
380 } // namespace content 380 } // namespace content
OLDNEW
« no previous file with comments | « components/nacl/renderer/ppb_nacl_private_impl.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698