| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 void BrowserGpuChannelHostFactory::Initialize(bool establish_gpu_channel) { | 205 void BrowserGpuChannelHostFactory::Initialize(bool establish_gpu_channel) { |
| 206 DCHECK(!instance_); | 206 DCHECK(!instance_); |
| 207 instance_ = new BrowserGpuChannelHostFactory(); | 207 instance_ = new BrowserGpuChannelHostFactory(); |
| 208 if (establish_gpu_channel) { | 208 if (establish_gpu_channel) { |
| 209 instance_->EstablishGpuChannel(gpu::GpuChannelEstablishedCallback()); | 209 instance_->EstablishGpuChannel(gpu::GpuChannelEstablishedCallback()); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 void BrowserGpuChannelHostFactory::Terminate() { | 213 void BrowserGpuChannelHostFactory::Terminate() { |
| 214 DCHECK(instance_); | 214 DCHECK(instance_); |
| 215 delete instance_; | 215 |
| 216 // Reset the |instance_| first so we don't receive any more Gpu Channel |
| 217 // initialization requests as we run the existing callbacks. |
| 218 BrowserGpuChannelHostFactory* current_instance = instance_; |
| 216 instance_ = NULL; | 219 instance_ = NULL; |
| 220 |
| 221 delete current_instance; |
| 217 } | 222 } |
| 218 | 223 |
| 219 BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() | 224 BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() |
| 220 : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 225 : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
| 221 gpu_client_tracing_id_(ChildProcessHost::kBrowserTracingProcessId), | 226 gpu_client_tracing_id_(ChildProcessHost::kBrowserTracingProcessId), |
| 222 shutdown_event_(new base::WaitableEvent( | 227 shutdown_event_(new base::WaitableEvent( |
| 223 base::WaitableEvent::ResetPolicy::MANUAL, | 228 base::WaitableEvent::ResetPolicy::MANUAL, |
| 224 base::WaitableEvent::InitialState::NOT_SIGNALED)), | 229 base::WaitableEvent::InitialState::NOT_SIGNALED)), |
| 225 gpu_memory_buffer_manager_( | 230 gpu_memory_buffer_manager_( |
| 226 new BrowserGpuMemoryBufferManager(gpu_client_id_, | 231 new BrowserGpuMemoryBufferManager(gpu_client_id_, |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 368 } |
| 364 | 369 |
| 365 // static | 370 // static |
| 366 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( | 371 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( |
| 367 int gpu_client_id, | 372 int gpu_client_id, |
| 368 const base::FilePath& cache_dir) { | 373 const base::FilePath& cache_dir) { |
| 369 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); | 374 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); |
| 370 } | 375 } |
| 371 | 376 |
| 372 } // namespace content | 377 } // namespace content |
| OLD | NEW |