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/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 30 matching lines...) Expand all Loading... | |
| 41 #include "content/common/mojo/mojo_child_connection.h" | 41 #include "content/common/mojo/mojo_child_connection.h" |
| 42 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
| 43 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
| 44 #include "content/public/browser/content_browser_client.h" | 44 #include "content/public/browser/content_browser_client.h" |
| 45 #include "content/public/browser/gpu_utils.h" | 45 #include "content/public/browser/gpu_utils.h" |
| 46 #include "content/public/browser/render_process_host.h" | 46 #include "content/public/browser/render_process_host.h" |
| 47 #include "content/public/browser/render_widget_host_view.h" | 47 #include "content/public/browser/render_widget_host_view.h" |
| 48 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 48 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 49 #include "content/public/common/connection_filter.h" | 49 #include "content/public/common/connection_filter.h" |
| 50 #include "content/public/common/content_client.h" | 50 #include "content/public/common/content_client.h" |
| 51 #include "content/public/common/content_features.h" | |
| 51 #include "content/public/common/content_switches.h" | 52 #include "content/public/common/content_switches.h" |
| 52 #include "content/public/common/mojo_channel_switches.h" | 53 #include "content/public/common/mojo_channel_switches.h" |
| 53 #include "content/public/common/mojo_shell_connection.h" | 54 #include "content/public/common/mojo_shell_connection.h" |
| 54 #include "content/public/common/result_codes.h" | 55 #include "content/public/common/result_codes.h" |
| 55 #include "content/public/common/sandbox_type.h" | 56 #include "content/public/common/sandbox_type.h" |
| 56 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 57 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 57 #include "content/public/common/service_names.h" | 58 #include "content/public/common/service_names.h" |
| 58 #include "gpu/command_buffer/service/gpu_preferences.h" | 59 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 59 #include "gpu/command_buffer/service/gpu_switches.h" | 60 #include "gpu/command_buffer/service/gpu_switches.h" |
| 60 #include "gpu/ipc/service/switches.h" | 61 #include "gpu/ipc/service/switches.h" |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 966 #else | 967 #else |
| 967 int child_flags = ChildProcessHost::CHILD_NORMAL; | 968 int child_flags = ChildProcessHost::CHILD_NORMAL; |
| 968 #endif | 969 #endif |
| 969 | 970 |
| 970 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); | 971 base::FilePath exe_path = ChildProcessHost::GetChildPath(child_flags); |
| 971 if (exe_path.empty()) | 972 if (exe_path.empty()) |
| 972 return false; | 973 return false; |
| 973 | 974 |
| 974 base::CommandLine* cmd_line = new base::CommandLine(exe_path); | 975 base::CommandLine* cmd_line = new base::CommandLine(exe_path); |
| 975 #endif | 976 #endif |
| 977 | |
| 976 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); | 978 cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess); |
| 977 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line); | 979 |
| 980 #if defined(OS_WIN) | |
| 981 if (base::FeatureList::IsEnabled( | |
| 982 features::kShareFieldTrialStateViaSharedMemory)) | |
|
Alexei Svitkine (slow)
2016/10/04 18:49:35
Nit: {}'s
lawrencewu
2016/10/05 20:57:56
Done.
| |
| 983 field_trial_state_.reset(new base::SharedMemory()); | |
| 984 #endif | |
| 985 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags( | |
| 986 cmd_line, field_trial_state_.get()); | |
| 987 #if defined(OS_WIN) | |
| 988 if (!field_trial_state_.get()->handle().GetHandle()) | |
|
Alexei Svitkine (slow)
2016/10/04 18:49:36
Is this just an error case? Needs a comment at the
lawrencewu
2016/10/05 20:57:56
Yes, it is the case when there were no field trial
| |
| 989 field_trial_state_.reset(); | |
| 990 #endif | |
| 978 | 991 |
| 979 #if defined(OS_WIN) | 992 #if defined(OS_WIN) |
| 980 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); | 993 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); |
| 981 #endif // defined(OS_WIN) | 994 #endif // defined(OS_WIN) |
| 982 | 995 |
| 983 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) | 996 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) |
| 984 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); | 997 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); |
| 985 | 998 |
| 986 // TODO(penghuang): Replace all GPU related switches with GpuPreferences. | 999 // TODO(penghuang): Replace all GPU related switches with GpuPreferences. |
| 987 // https://crbug.com/590825 | 1000 // https://crbug.com/590825 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1011 } | 1024 } |
| 1012 | 1025 |
| 1013 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessSoftwareRendering", | 1026 UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessSoftwareRendering", |
| 1014 swiftshader_rendering_); | 1027 swiftshader_rendering_); |
| 1015 | 1028 |
| 1016 // If specified, prepend a launcher program to the command line. | 1029 // If specified, prepend a launcher program to the command line. |
| 1017 if (!gpu_launcher.empty()) | 1030 if (!gpu_launcher.empty()) |
| 1018 cmd_line->PrependWrapper(gpu_launcher); | 1031 cmd_line->PrependWrapper(gpu_launcher); |
| 1019 | 1032 |
| 1020 process_->Launch( | 1033 process_->Launch( |
| 1021 new GpuSandboxedProcessLauncherDelegate(cmd_line, | 1034 new GpuSandboxedProcessLauncherDelegate(cmd_line, process_->GetHost()), |
| 1022 process_->GetHost()), | 1035 cmd_line, field_trial_state_.get(), true); |
| 1023 cmd_line, | |
| 1024 true); | |
| 1025 process_launched_ = true; | 1036 process_launched_ = true; |
| 1026 | 1037 |
| 1027 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", | 1038 UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents", |
| 1028 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); | 1039 LAUNCHED, GPU_PROCESS_LIFETIME_EVENT_MAX); |
| 1029 return true; | 1040 return true; |
| 1030 } | 1041 } |
| 1031 | 1042 |
| 1032 void GpuProcessHost::SendOutstandingReplies() { | 1043 void GpuProcessHost::SendOutstandingReplies() { |
| 1033 valid_ = false; | 1044 valid_ = false; |
| 1034 // First send empty channel handles for all EstablishChannel requests. | 1045 // 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"); | 1178 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1168 ClientIdToShaderCacheMap::iterator iter = | 1179 ClientIdToShaderCacheMap::iterator iter = |
| 1169 client_id_to_shader_cache_.find(client_id); | 1180 client_id_to_shader_cache_.find(client_id); |
| 1170 // If the cache doesn't exist then this is an off the record profile. | 1181 // If the cache doesn't exist then this is an off the record profile. |
| 1171 if (iter == client_id_to_shader_cache_.end()) | 1182 if (iter == client_id_to_shader_cache_.end()) |
| 1172 return; | 1183 return; |
| 1173 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1184 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1174 } | 1185 } |
| 1175 | 1186 |
| 1176 } // namespace content | 1187 } // namespace content |
| OLD | NEW |