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 10 matching lines...) Expand all Loading... |
21 #include "content/browser/gpu/shader_cache_factory.h" | 21 #include "content/browser/gpu/shader_cache_factory.h" |
22 #include "content/common/child_process_host_impl.h" | 22 #include "content/common/child_process_host_impl.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/content_browser_client.h" | 24 #include "content/public/browser/content_browser_client.h" |
25 #include "content/public/browser/gpu_data_manager.h" | 25 #include "content/public/browser/gpu_data_manager.h" |
26 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
27 #include "gpu/command_buffer/service/gpu_switches.h" | 27 #include "gpu/command_buffer/service/gpu_switches.h" |
28 #include "gpu/ipc/common/gpu_messages.h" | 28 #include "gpu/ipc/common/gpu_messages.h" |
29 #include "ipc/ipc_channel_handle.h" | 29 #include "ipc/ipc_channel_handle.h" |
30 #include "ipc/message_filter.h" | 30 #include "ipc/message_filter.h" |
31 #include "services/resource_coordinator/public/interfaces/memory/constants.mojom
.h" | |
32 #include "services/service_manager/runner/common/client_util.h" | 31 #include "services/service_manager/runner/common/client_util.h" |
33 | 32 |
34 namespace content { | 33 namespace content { |
35 | 34 |
36 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; | 35 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; |
37 | 36 |
38 class BrowserGpuChannelHostFactory::EstablishRequest | 37 class BrowserGpuChannelHostFactory::EstablishRequest |
39 : public base::RefCountedThreadSafe<EstablishRequest> { | 38 : public base::RefCountedThreadSafe<EstablishRequest> { |
40 public: | 39 public: |
41 static scoped_refptr<EstablishRequest> Create(int gpu_client_id, | 40 static scoped_refptr<EstablishRequest> Create(int gpu_client_id, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 219 } |
221 | 220 |
222 void BrowserGpuChannelHostFactory::Terminate() { | 221 void BrowserGpuChannelHostFactory::Terminate() { |
223 DCHECK(instance_); | 222 DCHECK(instance_); |
224 delete instance_; | 223 delete instance_; |
225 instance_ = NULL; | 224 instance_ = NULL; |
226 } | 225 } |
227 | 226 |
228 BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() | 227 BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory() |
229 : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 228 : gpu_client_id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
230 gpu_client_tracing_id_( | 229 gpu_client_tracing_id_(ChildProcessHost::kBrowserTracingProcessId), |
231 memory_instrumentation::mojom::kServiceTracingProcessId), | |
232 shutdown_event_(new base::WaitableEvent( | 230 shutdown_event_(new base::WaitableEvent( |
233 base::WaitableEvent::ResetPolicy::MANUAL, | 231 base::WaitableEvent::ResetPolicy::MANUAL, |
234 base::WaitableEvent::InitialState::NOT_SIGNALED)), | 232 base::WaitableEvent::InitialState::NOT_SIGNALED)), |
235 gpu_memory_buffer_manager_( | 233 gpu_memory_buffer_manager_( |
236 new BrowserGpuMemoryBufferManager(gpu_client_id_, | 234 new BrowserGpuMemoryBufferManager(gpu_client_id_, |
237 gpu_client_tracing_id_)), | 235 gpu_client_tracing_id_)), |
238 gpu_host_id_(0) { | 236 gpu_host_id_(0) { |
239 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 237 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
240 switches::kDisableGpuShaderDiskCache)) { | 238 switches::kDisableGpuShaderDiskCache)) { |
241 DCHECK(GetContentClient()); | 239 DCHECK(GetContentClient()); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 374 } |
377 | 375 |
378 // static | 376 // static |
379 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( | 377 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( |
380 int gpu_client_id, | 378 int gpu_client_id, |
381 const base::FilePath& cache_dir) { | 379 const base::FilePath& cache_dir) { |
382 GetShaderCacheFactorySingleton()->SetCacheInfo(gpu_client_id, cache_dir); | 380 GetShaderCacheFactorySingleton()->SetCacheInfo(gpu_client_id, cache_dir); |
383 } | 381 } |
384 | 382 |
385 } // namespace content | 383 } // namespace content |
OLD | NEW |