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

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

Issue 2127693002: Use ChannelMojo for GpuChannels. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-channel-gpu
Patch Set: rebase 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
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('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 (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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 gpu_client_id_, gpu_client_tracing_id_, preempts, 146 gpu_client_id_, gpu_client_tracing_id_, preempts,
147 allow_view_command_buffers, allow_real_time_streams, 147 allow_view_command_buffers, allow_real_time_streams,
148 base::Bind( 148 base::Bind(
149 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO, 149 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO,
150 this)); 150 this));
151 } 151 }
152 152
153 void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( 153 void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO(
154 const IPC::ChannelHandle& channel_handle, 154 const IPC::ChannelHandle& channel_handle,
155 const gpu::GPUInfo& gpu_info) { 155 const gpu::GPUInfo& gpu_info) {
156 if (channel_handle.name.empty() && reused_gpu_process_) { 156 if (!channel_handle.mojo_handle.is_valid() && reused_gpu_process_) {
157 // We failed after re-using the GPU process, but it may have died in the 157 // We failed after re-using the GPU process, but it may have died in the
158 // mean time. Retry to have a chance to create a fresh GPU process. 158 // mean time. Retry to have a chance to create a fresh GPU process.
159 DVLOG(1) << "Failed to create channel on existing GPU process. Trying to " 159 DVLOG(1) << "Failed to create channel on existing GPU process. Trying to "
160 "restart GPU process."; 160 "restart GPU process.";
161 EstablishOnIO(); 161 EstablishOnIO();
162 } else { 162 } else {
163 channel_handle_ = channel_handle; 163 channel_handle_ = channel_handle;
164 gpu_info_ = gpu_info; 164 gpu_info_ = gpu_info;
165 FinishOnIO(); 165 FinishOnIO();
166 } 166 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 gpu::GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() { 330 gpu::GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() {
331 if (gpu_channel_.get() && !gpu_channel_->IsLost()) 331 if (gpu_channel_.get() && !gpu_channel_->IsLost())
332 return gpu_channel_.get(); 332 return gpu_channel_.get();
333 333
334 return NULL; 334 return NULL;
335 } 335 }
336 336
337 void BrowserGpuChannelHostFactory::GpuChannelEstablished() { 337 void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
338 DCHECK(IsMainThread()); 338 DCHECK(IsMainThread());
339 DCHECK(pending_request_.get()); 339 DCHECK(pending_request_.get());
340 if (pending_request_->channel_handle().name.empty()) { 340 if (!pending_request_->channel_handle().mojo_handle.is_valid()) {
341 DCHECK(!gpu_channel_.get()); 341 DCHECK(!gpu_channel_.get());
342 } else { 342 } else {
343 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866 343 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866
344 // is fixed. 344 // is fixed.
345 tracked_objects::ScopedTracker tracking_profile1( 345 tracked_objects::ScopedTracker tracking_profile1(
346 FROM_HERE_WITH_EXPLICIT_FUNCTION( 346 FROM_HERE_WITH_EXPLICIT_FUNCTION(
347 "466866 BrowserGpuChannelHostFactory::GpuChannelEstablished1")); 347 "466866 BrowserGpuChannelHostFactory::GpuChannelEstablished1"));
348 GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); 348 GetContentClient()->SetGpuInfo(pending_request_->gpu_info());
349 gpu_channel_ = gpu::GpuChannelHost::Create( 349 gpu_channel_ = gpu::GpuChannelHost::Create(
350 this, gpu_client_id_, pending_request_->gpu_info(), 350 this, gpu_client_id_, pending_request_->gpu_info(),
(...skipping 27 matching lines...) Expand all
378 } 378 }
379 379
380 // static 380 // static
381 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( 381 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO(
382 int gpu_client_id, 382 int gpu_client_id,
383 const base::FilePath& cache_dir) { 383 const base::FilePath& cache_dir) {
384 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); 384 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir);
385 } 385 }
386 386
387 } // namespace content 387 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698