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