| Index: content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| index e45b4061743ae24ee5f28a615f366a1281ed4b0a..aea825dd2289ffe9c1b1d92c2969b7e725c0ed86 100644
|
| --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
|
| @@ -5,6 +5,7 @@
|
| #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/command_line.h"
|
| #include "base/location.h"
|
| #include "base/profiler/scoped_tracker.h"
|
| #include "base/single_thread_task_runner.h"
|
| @@ -17,11 +18,14 @@
|
| #include "content/browser/gpu/gpu_data_manager_impl.h"
|
| #include "content/browser/gpu/gpu_process_host.h"
|
| #include "content/browser/gpu/gpu_surface_tracker.h"
|
| +#include "content/browser/gpu/shader_disk_cache.h"
|
| #include "content/common/child_process_host_impl.h"
|
| #include "content/common/gpu/gpu_messages.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/content_browser_client.h"
|
| #include "content/public/browser/gpu_data_manager.h"
|
| #include "content/public/common/content_client.h"
|
| +#include "gpu/command_buffer/service/gpu_switches.h"
|
| #include "ipc/ipc_channel_handle.h"
|
| #include "ipc/message_filter.h"
|
|
|
| @@ -238,7 +242,23 @@ BrowserGpuChannelHostFactory::BrowserGpuChannelHostFactory()
|
| gpu_memory_buffer_manager_(
|
| new BrowserGpuMemoryBufferManager(gpu_client_id_,
|
| gpu_client_tracing_id_)),
|
| - gpu_host_id_(0) {}
|
| + gpu_host_id_(0) {
|
| + if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kDisableGpuShaderDiskCache)) {
|
| + DCHECK(GetContentClient());
|
| + base::FilePath cache_dir =
|
| + GetContentClient()->browser()->GetShaderDiskCacheDirectory();
|
| + if (!cache_dir.empty()) {
|
| + GetIOThreadTaskRunner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO,
|
| + gpu_client_id_, cache_dir));
|
| + } else {
|
| + LOG(ERROR) << "Failed to init browser shader disk cache.";
|
| + }
|
| + }
|
| +}
|
|
|
| BrowserGpuChannelHostFactory::~BrowserGpuChannelHostFactory() {
|
| DCHECK(IsMainThread());
|
| @@ -419,4 +439,11 @@ void BrowserGpuChannelHostFactory::AddFilterOnIO(
|
| host->AddFilter(filter.get());
|
| }
|
|
|
| +// static
|
| +void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO(
|
| + int gpu_client_id,
|
| + const base::FilePath& cache_dir) {
|
| + ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir);
|
| +}
|
| +
|
| } // namespace content
|
|
|