Chromium Code Reviews| 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/location.h" | 9 #include "base/location.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 14 #include "base/trace_event/memory_dump_manager.h" | 15 #include "base/trace_event/memory_dump_manager.h" |
| 15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 16 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 17 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 17 #include "content/browser/gpu/gpu_data_manager_impl.h" | 18 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 18 #include "content/browser/gpu/gpu_process_host.h" | 19 #include "content/browser/gpu/gpu_process_host.h" |
| 19 #include "content/browser/gpu/gpu_surface_tracker.h" | 20 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 21 #include "content/browser/gpu/shader_disk_cache.h" | |
| 20 #include "content/common/child_process_host_impl.h" | 22 #include "content/common/child_process_host_impl.h" |
| 21 #include "content/common/gpu/gpu_messages.h" | 23 #include "content/common/gpu/gpu_messages.h" |
| 22 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/content_browser_client.h" | |
| 23 #include "content/public/browser/gpu_data_manager.h" | 26 #include "content/public/browser/gpu_data_manager.h" |
| 24 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
| 28 #include "gpu/command_buffer/service/gpu_switches.h" | |
| 25 #include "ipc/ipc_channel_handle.h" | 29 #include "ipc/ipc_channel_handle.h" |
| 26 #include "ipc/message_filter.h" | 30 #include "ipc/message_filter.h" |
| 27 | 31 |
| 28 namespace content { | 32 namespace content { |
| 29 | 33 |
| 30 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; | 34 BrowserGpuChannelHostFactory* BrowserGpuChannelHostFactory::instance_ = NULL; |
| 31 | 35 |
| 32 struct BrowserGpuChannelHostFactory::CreateRequest { | 36 struct BrowserGpuChannelHostFactory::CreateRequest { |
| 33 CreateRequest(int32 route_id) | 37 CreateRequest(int32 route_id) |
| 34 : event(true, false), | 38 : event(true, false), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 // failure in ChannelEstablishedOnIO, but we ended up with the same | 141 // failure in ChannelEstablishedOnIO, but we ended up with the same |
| 138 // 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, |
| 139 // but another reason. So fail now. | 143 // but another reason. So fail now. |
| 140 LOG(ERROR) << "Failed to create channel."; | 144 LOG(ERROR) << "Failed to create channel."; |
| 141 FinishOnIO(); | 145 FinishOnIO(); |
| 142 return; | 146 return; |
| 143 } | 147 } |
| 144 reused_gpu_process_ = true; | 148 reused_gpu_process_ = true; |
| 145 } | 149 } |
| 146 | 150 |
| 151 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 152 switches::kDisableGpuShaderDiskCache)) { | |
| 153 base::FilePath user_data_dir = | |
| 154 GetContentClient()->browser()->GetUserDataDirectory(); | |
| 155 if (!user_data_dir.empty()) { | |
| 156 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id_, | |
| 157 user_data_dir); | |
|
Ken Russell (switch to Gerrit)
2015/08/06 01:01:01
Something seems suspicious about this. GpuChannels
piman
2015/08/06 19:53:13
FYI, this code path is to setup the GpuChannelHost
| |
| 158 } else { | |
| 159 LOG(ERROR) << "Failed to init browser shader cache."; | |
| 160 } | |
| 161 } | |
| 162 | |
| 147 host->EstablishGpuChannel( | 163 host->EstablishGpuChannel( |
| 148 gpu_client_id_, | 164 gpu_client_id_, |
| 149 gpu_client_tracing_id_, | 165 gpu_client_tracing_id_, |
| 150 true, | 166 true, |
| 151 true, | 167 true, |
| 152 base::Bind( | 168 base::Bind( |
| 153 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO, | 169 &BrowserGpuChannelHostFactory::EstablishRequest::OnEstablishedOnIO, |
| 154 this)); | 170 this)); |
| 155 } | 171 } |
| 156 | 172 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 int host_id, | 428 int host_id, |
| 413 scoped_refptr<IPC::MessageFilter> filter) { | 429 scoped_refptr<IPC::MessageFilter> filter) { |
| 414 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 430 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 415 | 431 |
| 416 GpuProcessHost* host = GpuProcessHost::FromID(host_id); | 432 GpuProcessHost* host = GpuProcessHost::FromID(host_id); |
| 417 if (host) | 433 if (host) |
| 418 host->AddFilter(filter.get()); | 434 host->AddFilter(filter.get()); |
| 419 } | 435 } |
| 420 | 436 |
| 421 } // namespace content | 437 } // namespace content |
| OLD | NEW |