| 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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 963 #else | 963 #else |
| 964 int child_flags = ChildProcessHost::CHILD_NORMAL; | 964 int child_flags = ChildProcessHost::CHILD_NORMAL; |
| 965 #endif | 965 #endif |
| 966 | 966 |
| 967 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); | 967 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); |
| 968 if (exe_path.empty()) | 968 if (exe_path.empty()) |
| 969 return false; | 969 return false; |
| 970 | 970 |
| 971 base::CommandLine* cmd_line = new base::CommandLine(exe_path); | 971 base::CommandLine* cmd_line = new base::CommandLine(exe_path); |
| 972 #endif | 972 #endif |
| 973 |
| 973 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); | 974 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
| 974 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); | 975 |
| 976 field_trial_state_ = |
| 977 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); |
| 975 | 978 |
| 976 #if defined(OS_WIN) | 979 #if defined(OS_WIN) |
| 977 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); | 980 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); |
| 978 #endif // defined(OS_WIN) | 981 #endif // defined(OS_WIN) |
| 979 | 982 |
| 980 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) | 983 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) |
| 981 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); | 984 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); |
| 982 | 985 |
| 983 // TODO(penghuang): Replace all GPU related switches with GpuPreferences. | 986 // TODO(penghuang): Replace all GPU related switches with GpuPreferences. |
| 984 // https://crbug.com/590825 | 987 // https://crbug.com/590825 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1008 } | 1011 } |
| 1009 | 1012 |
| 1010 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessSoftwareRendering", | 1013 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessSoftwareRendering", |
| 1011 swiftshader_rendering_); | 1014 swiftshader_rendering_); |
| 1012 | 1015 |
| 1013 // If specified, prepend a launcher program to the command line. | 1016 // If specified, prepend a launcher program to the command line. |
| 1014 if (!gpu_launcher.empty()) | 1017 if (!gpu_launcher.empty()) |
| 1015 cmd_line->PrependWrapper(gpu_launcher); | 1018 cmd_line->PrependWrapper(gpu_launcher); |
| 1016 | 1019 |
| 1017 process_->Launch( | 1020 process_->Launch( |
| 1018 new GpuSandboxedProcessLauncherDelegate(cmd_line, | 1021 new GpuSandboxedProcessLauncherDelegate(cmd_line, process_->GetHost()), |
| 1019 process_->GetHost()), | 1022 cmd_line, field_trial_state_.get(), true); |
| 1020 cmd_line, | |
| 1021 true); | |
| 1022 process_launched_ = true; | 1023 process_launched_ = true; |
| 1023 | 1024 |
| 1024 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 1025 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| 1025 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); | 1026 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); |
| 1026 return true; | 1027 return true; |
| 1027 } | 1028 } |
| 1028 | 1029 |
| 1029 void GpuProcessHost::SendOutstandingReplies() { | 1030 void GpuProcessHost::SendOutstandingReplies() { |
| 1030 valid_ = false; | 1031 valid_ = false; |
| 1031 // First send empty channel handles for all EstablishChannel requests. | 1032 // First send empty channel handles for all EstablishChannel requests. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1165 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1165 ClientIdToShaderCacheMap::iterator iter = | 1166 ClientIdToShaderCacheMap::iterator iter = |
| 1166 client_id_to_shader_cache_.find(client_id); | 1167 client_id_to_shader_cache_.find(client_id); |
| 1167 // If the cache doesn't exist then this is an off the record profile. | 1168 // If the cache doesn't exist then this is an off the record profile. |
| 1168 if (iter == client_id_to_shader_cache_.end()) | 1169 if (iter == client_id_to_shader_cache_.end()) |
| 1169 return; | 1170 return; |
| 1170 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1171 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1171 } | 1172 } |
| 1172 | 1173 |
| 1173 } // namespace content | 1174 } // namespace content |
| OLD | NEW |