Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 1778693002: Revert of Get rid of gpu related switches by passing gpu::GpuPreferences via IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu/gpu_host_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 9 #include <utility>
10 10
(...skipping 18 matching lines...) Expand all
29 #include "content/browser/gpu/gpu_surface_tracker.h" 29 #include "content/browser/gpu/gpu_surface_tracker.h"
30 #include "content/browser/gpu/shader_disk_cache.h" 30 #include "content/browser/gpu/shader_disk_cache.h"
31 #include "content/browser/mojo/mojo_application_host.h" 31 #include "content/browser/mojo/mojo_application_host.h"
32 #include "content/browser/renderer_host/render_widget_host_impl.h" 32 #include "content/browser/renderer_host/render_widget_host_impl.h"
33 #include "content/common/child_process_host_impl.h" 33 #include "content/common/child_process_host_impl.h"
34 #include "content/common/gpu/gpu_host_messages.h" 34 #include "content/common/gpu/gpu_host_messages.h"
35 #include "content/common/in_process_child_thread_params.h" 35 #include "content/common/in_process_child_thread_params.h"
36 #include "content/common/view_messages.h" 36 #include "content/common/view_messages.h"
37 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
38 #include "content/public/browser/content_browser_client.h" 38 #include "content/public/browser/content_browser_client.h"
39 #include "content/public/browser/gpu_utils.h"
40 #include "content/public/browser/render_process_host.h" 39 #include "content/public/browser/render_process_host.h"
41 #include "content/public/browser/render_widget_host_view.h" 40 #include "content/public/browser/render_widget_host_view.h"
42 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 41 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
43 #include "content/public/common/content_client.h" 42 #include "content/public/common/content_client.h"
44 #include "content/public/common/content_switches.h" 43 #include "content/public/common/content_switches.h"
45 #include "content/public/common/result_codes.h" 44 #include "content/public/common/result_codes.h"
46 #include "content/public/common/sandbox_type.h" 45 #include "content/public/common/sandbox_type.h"
47 #include "content/public/common/sandboxed_process_launcher_delegate.h" 46 #include "content/public/common/sandboxed_process_launcher_delegate.h"
48 #include "gpu/command_buffer/service/gpu_preferences.h"
49 #include "gpu/command_buffer/service/gpu_switches.h" 47 #include "gpu/command_buffer/service/gpu_switches.h"
50 #include "ipc/ipc_channel_handle.h" 48 #include "ipc/ipc_channel_handle.h"
51 #include "ipc/ipc_switches.h" 49 #include "ipc/ipc_switches.h"
52 #include "ipc/message_filter.h" 50 #include "ipc/message_filter.h"
53 #include "media/base/media_switches.h" 51 #include "media/base/media_switches.h"
54 #include "ui/base/ui_base_switches.h" 52 #include "ui/base/ui_base_switches.h"
55 #include "ui/events/latency_info.h" 53 #include "ui/events/latency_info.h"
56 #include "ui/gl/gl_switches.h" 54 #include "ui/gl/gl_switches.h"
57 55
58 #if defined(OS_ANDROID) 56 #if defined(OS_ANDROID)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 switches::kDisableLogging, 98 switches::kDisableLogging,
101 switches::kDisableSeccompFilterSandbox, 99 switches::kDisableSeccompFilterSandbox,
102 #if defined(ENABLE_WEBRTC) 100 #if defined(ENABLE_WEBRTC)
103 switches::kDisableWebRtcHWEncoding, 101 switches::kDisableWebRtcHWEncoding,
104 #endif 102 #endif
105 #if defined(OS_WIN) 103 #if defined(OS_WIN)
106 switches::kEnableAcceleratedVpxDecode, 104 switches::kEnableAcceleratedVpxDecode,
107 #endif 105 #endif
108 switches::kEnableHeapProfiling, 106 switches::kEnableHeapProfiling,
109 switches::kEnableLogging, 107 switches::kEnableLogging,
108 switches::kEnableShareGroupAsyncTextureUpload,
110 #if defined(OS_ANDROID) 109 #if defined(OS_ANDROID)
111 switches::kEnableUnifiedMediaPipeline, 110 switches::kEnableUnifiedMediaPipeline,
112 #endif 111 #endif
113 #if defined(OS_CHROMEOS) 112 #if defined(OS_CHROMEOS)
114 switches::kDisableVaapiAcceleratedVideoEncode, 113 switches::kDisableVaapiAcceleratedVideoEncode,
115 #endif 114 #endif
116 switches::kGpuStartupDialog, 115 switches::kGpuStartupDialog,
117 switches::kGpuSandboxAllowSysVShm, 116 switches::kGpuSandboxAllowSysVShm,
118 switches::kGpuSandboxFailuresFatal, 117 switches::kGpuSandboxFailuresFatal,
119 switches::kGpuSandboxStartEarly, 118 switches::kGpuSandboxStartEarly,
120 switches::kLoggingLevel, 119 switches::kLoggingLevel,
121 switches::kEnableLowEndDeviceMode, 120 switches::kEnableLowEndDeviceMode,
122 switches::kDisableLowEndDeviceMode, 121 switches::kDisableLowEndDeviceMode,
123 switches::kEnableMemoryBenchmarking, 122 switches::kEnableMemoryBenchmarking,
124 switches::kNoSandbox, 123 switches::kNoSandbox,
125 switches::kProfilerTiming, 124 switches::kProfilerTiming,
126 switches::kTestGLLib, 125 switches::kTestGLLib,
127 switches::kTraceConfigFile, 126 switches::kTraceConfigFile,
128 switches::kTraceStartup, 127 switches::kTraceStartup,
129 switches::kTraceToConsole, 128 switches::kTraceToConsole,
130 switches::kV, 129 switches::kV,
131 switches::kVModule, 130 switches::kVModule,
132 #if defined(OS_MACOSX) 131 #if defined(OS_MACOSX)
133 switches::kDisableRemoteCoreAnimation, 132 switches::kDisableRemoteCoreAnimation,
134 switches::kDisableMacOverlays, 133 switches::kDisableMacOverlays,
135 switches::kEnableSandboxLogging, 134 switches::kEnableSandboxLogging,
136 switches::kShowMacOverlayBorders, 135 switches::kShowMacOverlayBorders,
137 #endif 136 #endif
137 #if defined(USE_AURA)
138 switches::kUIPrioritizeInGpuProcess,
139 #endif
138 #if defined(USE_OZONE) 140 #if defined(USE_OZONE)
139 switches::kOzonePlatform, 141 switches::kOzonePlatform,
140 #endif 142 #endif
141 #if defined(USE_X11) && !defined(OS_CHROMEOS) 143 #if defined(USE_X11) && !defined(OS_CHROMEOS)
142 switches::kWindowDepth, 144 switches::kWindowDepth,
143 switches::kX11Display, 145 switches::kX11Display,
144 #endif 146 #endif
145 }; 147 };
146 148
147 enum GPUProcessLifetimeEvent { 149 enum GPUProcessLifetimeEvent {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 return false; 539 return false;
538 540
539 if (!SetupMojo()) 541 if (!SetupMojo())
540 return false; 542 return false;
541 543
542 if (in_process_) { 544 if (in_process_) {
543 DCHECK_CURRENTLY_ON(BrowserThread::IO); 545 DCHECK_CURRENTLY_ON(BrowserThread::IO);
544 DCHECK(g_gpu_main_thread_factory); 546 DCHECK(g_gpu_main_thread_factory);
545 in_process_gpu_thread_.reset( 547 in_process_gpu_thread_.reset(
546 g_gpu_main_thread_factory(InProcessChildThreadParams( 548 g_gpu_main_thread_factory(InProcessChildThreadParams(
547 channel_id, base::MessageLoop::current()->task_runner()), 549 channel_id, base::MessageLoop::current()->task_runner())));
548 GetGpuPreferencesFromCommandLine()));
549 base::Thread::Options options; 550 base::Thread::Options options;
550 #if defined(OS_WIN) 551 #if defined(OS_WIN)
551 // WGL needs to create its own window and pump messages on it. 552 // WGL needs to create its own window and pump messages on it.
552 options.message_loop_type = base::MessageLoop::TYPE_UI; 553 options.message_loop_type = base::MessageLoop::TYPE_UI;
553 #endif 554 #endif
554 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) 555 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
555 options.priority = base::ThreadPriority::DISPLAY; 556 options.priority = base::ThreadPriority::DISPLAY;
556 #endif 557 #endif
557 in_process_gpu_thread_->StartWithOptions(options); 558 in_process_gpu_thread_->StartWithOptions(options);
558 559
559 OnProcessLaunched(); // Fake a callback that the process is ready. 560 OnProcessLaunched(); // Fake a callback that the process is ready.
560 } else if (!LaunchGpuProcess(channel_id)) { 561 } else if (!LaunchGpuProcess(channel_id)) {
561 return false; 562 return false;
562 } 563 }
563 564
564 if (!Send(new GpuMsg_Initialize(GetGpuPreferencesFromCommandLine()))) 565 if (!Send(new GpuMsg_Initialize()))
565 return false; 566 return false;
566 567
567 return true; 568 return true;
568 } 569 }
569 570
570 bool GpuProcessHost::SetupMojo() { 571 bool GpuProcessHost::SetupMojo() {
571 DCHECK(!mojo_application_host_); 572 DCHECK(!mojo_application_host_);
572 mojo_application_host_.reset(new MojoApplicationHost); 573 mojo_application_host_.reset(new MojoApplicationHost);
573 return mojo_application_host_->Init(); 574 return mojo_application_host_->Init();
574 } 575 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id); 975 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id);
975 976
976 #if defined(OS_WIN) 977 #if defined(OS_WIN)
977 if (GetContentClient()->browser()->ShouldUseWindowsPrefetchArgument()) 978 if (GetContentClient()->browser()->ShouldUseWindowsPrefetchArgument())
978 cmd_line->AppendArg(switches::kPrefetchArgumentGpu); 979 cmd_line->AppendArg(switches::kPrefetchArgumentGpu);
979 #endif // defined(OS_WIN) 980 #endif // defined(OS_WIN)
980 981
981 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED) 982 if (kind_ == GPU_PROCESS_KIND_UNSANDBOXED)
982 cmd_line->AppendSwitch(switches::kDisableGpuSandbox); 983 cmd_line->AppendSwitch(switches::kDisableGpuSandbox);
983 984
984 // TODO(penghuang): Replace all GPU related switches with GpuPreferences.
985 // https://crbug.com/590825
986 // If you want a browser command-line switch passed to the GPU process 985 // If you want a browser command-line switch passed to the GPU process
987 // you need to add it to |kSwitchNames| at the beginning of this file. 986 // you need to add it to |kSwitchNames| at the beginning of this file.
988 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames, 987 cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames,
989 arraysize(kSwitchNames)); 988 arraysize(kSwitchNames));
990 cmd_line->CopySwitchesFrom( 989 cmd_line->CopySwitchesFrom(
990 browser_command_line, switches::kGpuSwitches, switches::kNumGpuSwitches);
991 cmd_line->CopySwitchesFrom(
991 browser_command_line, switches::kGLSwitchesCopiedFromGpuProcessHost, 992 browser_command_line, switches::kGLSwitchesCopiedFromGpuProcessHost,
992 switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches); 993 switches::kGLSwitchesCopiedFromGpuProcessHostNumSwitches);
993 994
994 GetContentClient()->browser()->AppendExtraCommandLineSwitches( 995 GetContentClient()->browser()->AppendExtraCommandLineSwitches(
995 cmd_line, process_->GetData().id); 996 cmd_line, process_->GetData().id);
996 997
997 GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line); 998 GpuDataManagerImpl::GetInstance()->AppendGpuCommandLine(cmd_line);
998 999
999 if (cmd_line->HasSwitch(switches::kUseGL)) { 1000 if (cmd_line->HasSwitch(switches::kUseGL)) {
1000 swiftshader_rendering_ = 1001 swiftshader_rendering_ =
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1156 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1156 ClientIdToShaderCacheMap::iterator iter = 1157 ClientIdToShaderCacheMap::iterator iter =
1157 client_id_to_shader_cache_.find(client_id); 1158 client_id_to_shader_cache_.find(client_id);
1158 // If the cache doesn't exist then this is an off the record profile. 1159 // If the cache doesn't exist then this is an off the record profile.
1159 if (iter == client_id_to_shader_cache_.end()) 1160 if (iter == client_id_to_shader_cache_.end())
1160 return; 1161 return;
1161 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1162 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1162 } 1163 }
1163 1164
1164 } // namespace content 1165 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698