| 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/gpu_process_host.h" | 5 #include "content/browser/gpu/gpu_process_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 child_token_, | 563 child_token_, |
| 564 MojoShellContext::GetConnectorForIOThread())); | 564 MojoShellContext::GetConnectorForIOThread())); |
| 565 | 565 |
| 566 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); | 566 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); |
| 567 if (in_process_) { | 567 if (in_process_) { |
| 568 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 568 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 569 DCHECK(g_gpu_main_thread_factory); | 569 DCHECK(g_gpu_main_thread_factory); |
| 570 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( | 570 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( |
| 571 InProcessChildThreadParams( | 571 InProcessChildThreadParams( |
| 572 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), | 572 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), |
| 573 mojo_child_connection_->shell_client_token()), | 573 mojo_child_connection_->service_token()), |
| 574 gpu_preferences)); | 574 gpu_preferences)); |
| 575 base::Thread::Options options; | 575 base::Thread::Options options; |
| 576 #if defined(OS_WIN) | 576 #if defined(OS_WIN) |
| 577 // WGL needs to create its own window and pump messages on it. | 577 // WGL needs to create its own window and pump messages on it. |
| 578 options.message_loop_type = base::MessageLoop::TYPE_UI; | 578 options.message_loop_type = base::MessageLoop::TYPE_UI; |
| 579 #endif | 579 #endif |
| 580 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 580 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 581 options.priority = base::ThreadPriority::DISPLAY; | 581 options.priority = base::ThreadPriority::DISPLAY; |
| 582 #endif | 582 #endif |
| 583 in_process_gpu_thread_->StartWithOptions(options); | 583 in_process_gpu_thread_->StartWithOptions(options); |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 | 987 |
| 988 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); | 988 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); |
| 989 if (exe_path.empty()) | 989 if (exe_path.empty()) |
| 990 return false; | 990 return false; |
| 991 | 991 |
| 992 base::CommandLine* cmd_line = new base::CommandLine(exe_path); | 992 base::CommandLine* cmd_line = new base::CommandLine(exe_path); |
| 993 #endif | 993 #endif |
| 994 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); | 994 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
| 995 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); | 995 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); |
| 996 cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, | 996 cmd_line->AppendSwitchASCII(switches::kMojoApplicationChannelToken, |
| 997 mojo_child_connection_->shell_client_token()); | 997 mojo_child_connection_->service_token()); |
| 998 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); | 998 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); |
| 999 | 999 |
| 1000 #if defined(OS_WIN) | 1000 #if defined(OS_WIN) |
| 1001 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); | 1001 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); |
| 1002 #endif // defined(OS_WIN) | 1002 #endif // defined(OS_WIN) |
| 1003 | 1003 |
| 1004 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) | 1004 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) |
| 1005 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); | 1005 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); |
| 1006 | 1006 |
| 1007 // TODO(penghuang): Replace all GPU related switches with GpuPreferences. | 1007 // TODO(penghuang): Replace all GPU related switches with GpuPreferences. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1182 ClientIdToShaderCacheMap::iterator iter = | 1182 ClientIdToShaderCacheMap::iterator iter = |
| 1183 client_id_to_shader_cache_.find(client_id); | 1183 client_id_to_shader_cache_.find(client_id); |
| 1184 // If the cache doesn't exist then this is an off the record profile. | 1184 // If the cache doesn't exist then this is an off the record profile. |
| 1185 if (iter == client_id_to_shader_cache_.end()) | 1185 if (iter == client_id_to_shader_cache_.end()) |
| 1186 return; | 1186 return; |
| 1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1188 } | 1188 } |
| 1189 | 1189 |
| 1190 } // namespace content | 1190 } // namespace content |
| OLD | NEW |