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