| OLD | NEW |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // failure in ChannelEstablishedOnIO, but we ended up with the same | 141 // failure in ChannelEstablishedOnIO, but we ended up with the same |
| 142 // process ID, meaning the failure was not because of a channel error, | 142 // process ID, meaning the failure was not because of a channel error, |
| 143 // but another reason. So fail now. | 143 // but another reason. So fail now. |
| 144 LOG(ERROR) << "Failed to create channel."; | 144 LOG(ERROR) << "Failed to create channel."; |
| 145 FinishOnIO(); | 145 FinishOnIO(); |
| 146 return; | 146 return; |
| 147 } | 147 } |
| 148 reused_gpu_process_ = true; | 148 reused_gpu_process_ = true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool preempts = true; |
| 152 bool preempted = false; |
| 153 bool allow_future_sync_points = true; |
| 154 bool allow_real_time_streams = true; |
| 151 host->EstablishGpuChannel( | 155 host->EstablishGpuChannel( |
| 152 gpu_client_id_, gpu_client_tracing_id_, true, true, true, | 156 gpu_client_id_, gpu_client_tracing_id_, preempts, preempted, |
| 157 allow_future_sync_points, allow_real_time_streams, |
| 153 base::Bind( | 158 base::Bind( |
| 154 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO, | 159 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO, |
| 155 this)); | 160 this)); |
| 156 } | 161 } |
| 157 | 162 |
| 158 void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( | 163 void BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO( |
| 159 const IPC::ChannelHandle& channel_handle, | 164 const IPC::ChannelHandle& channel_handle, |
| 160 const gpu::GPUInfo& gpu_info) { | 165 const gpu::GPUInfo& gpu_info) { |
| 161 if (channel_handle.name.empty() && reused_gpu_process_) { | 166 if (channel_handle.name.empty() && reused_gpu_process_) { |
| 162 // We failed after re-using the GPU process, but it may have died in the | 167 // We failed after re-using the GPU process, but it may have died in the |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 if (!host) { | 298 if (!host) { |
| 294 request->event.Signal(); | 299 request->event.Signal(); |
| 295 return; | 300 return; |
| 296 } | 301 } |
| 297 | 302 |
| 298 gfx::GLSurfaceHandle surface = | 303 gfx::GLSurfaceHandle surface = |
| 299 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id); | 304 GpuSurfaceTracker::Get()->GetSurfaceHandle(surface_id); |
| 300 | 305 |
| 301 host->CreateViewCommandBuffer( | 306 host->CreateViewCommandBuffer( |
| 302 surface, | 307 surface, |
| 303 surface_id, | |
| 304 gpu_client_id_, | 308 gpu_client_id_, |
| 305 init_params, | 309 init_params, |
| 306 request->route_id, | 310 request->route_id, |
| 307 base::Bind(&BrowserGpuChannelHostFactory::CommandBufferCreatedOnIO, | 311 base::Bind(&BrowserGpuChannelHostFactory::CommandBufferCreatedOnIO, |
| 308 request)); | 312 request)); |
| 309 } | 313 } |
| 310 | 314 |
| 311 // static | 315 // static |
| 312 void BrowserGpuChannelHostFactory::CommandBufferCreatedOnIO( | 316 void BrowserGpuChannelHostFactory::CommandBufferCreatedOnIO( |
| 313 CreateRequest* request, CreateCommandBufferResult result) { | 317 CreateRequest* request, CreateCommandBufferResult result) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 436 } |
| 433 | 437 |
| 434 // static | 438 // static |
| 435 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( | 439 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( |
| 436 int gpu_client_id, | 440 int gpu_client_id, |
| 437 const base::FilePath& cache_dir) { | 441 const base::FilePath& cache_dir) { |
| 438 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); | 442 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); |
| 439 } | 443 } |
| 440 | 444 |
| 441 } // namespace content | 445 } // namespace content |
| OLD | NEW |