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

Side by Side Diff: content/gpu/gpu_main.cc

Issue 803813003: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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/gpu/gpu_child_thread.cc ('k') | content/plugin/plugin_channel.cc » ('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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <dwmapi.h> 8 #include <dwmapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include <sanitizer/asan_interface.h> 62 #include <sanitizer/asan_interface.h>
63 #endif 63 #endif
64 64
65 const int kGpuTimeout = 10000; 65 const int kGpuTimeout = 10000;
66 66
67 namespace content { 67 namespace content {
68 68
69 namespace { 69 namespace {
70 70
71 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, 71 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info,
72 const CommandLine& command_line); 72 const base::CommandLine& command_line);
73 bool WarmUpSandbox(const CommandLine& command_line); 73 bool WarmUpSandbox(const base::CommandLine& command_line);
74 74
75 #if !defined(OS_MACOSX) 75 #if !defined(OS_MACOSX)
76 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info); 76 bool CollectGraphicsInfo(gpu::GPUInfo& gpu_info);
77 #endif 77 #endif
78 78
79 #if defined(OS_LINUX) 79 #if defined(OS_LINUX)
80 #if !defined(OS_CHROMEOS) 80 #if !defined(OS_CHROMEOS)
81 bool CanAccessNvidiaDeviceFile(); 81 bool CanAccessNvidiaDeviceFile();
82 #endif 82 #endif
83 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool); 83 bool StartSandboxLinux(const gpu::GPUInfo&, GpuWatchdogThread*, bool);
(...skipping 17 matching lines...) Expand all
101 101
102 } // namespace anonymous 102 } // namespace anonymous
103 103
104 // Main function for starting the Gpu process. 104 // Main function for starting the Gpu process.
105 int GpuMain(const MainFunctionParams& parameters) { 105 int GpuMain(const MainFunctionParams& parameters) {
106 TRACE_EVENT0("gpu", "GpuMain"); 106 TRACE_EVENT0("gpu", "GpuMain");
107 base::debug::TraceLog::GetInstance()->SetProcessName("GPU Process"); 107 base::debug::TraceLog::GetInstance()->SetProcessName("GPU Process");
108 base::debug::TraceLog::GetInstance()->SetProcessSortIndex( 108 base::debug::TraceLog::GetInstance()->SetProcessSortIndex(
109 kTraceEventGpuProcessSortIndex); 109 kTraceEventGpuProcessSortIndex);
110 110
111 const CommandLine& command_line = parameters.command_line; 111 const base::CommandLine& command_line = parameters.command_line;
112 if (command_line.HasSwitch(switches::kGpuStartupDialog)) { 112 if (command_line.HasSwitch(switches::kGpuStartupDialog)) {
113 ChildProcess::WaitForDebugger("Gpu"); 113 ChildProcess::WaitForDebugger("Gpu");
114 } 114 }
115 115
116 base::Time start_time = base::Time::Now(); 116 base::Time start_time = base::Time::Now();
117 117
118 #if defined(OS_WIN) 118 #if defined(OS_WIN)
119 // Prevent Windows from displaying a modal dialog on failures like not being 119 // Prevent Windows from displaying a modal dialog on failures like not being
120 // able to load a DLL. 120 // able to load a DLL.
121 SetErrorMode( 121 SetErrorMode(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 base::TimeTicks::Now(); 270 base::TimeTicks::Now();
271 #if !defined(OS_MACOSX) 271 #if !defined(OS_MACOSX)
272 if (!CollectGraphicsInfo(gpu_info)) 272 if (!CollectGraphicsInfo(gpu_info))
273 dead_on_arrival = true; 273 dead_on_arrival = true;
274 274
275 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 275 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
276 // Recompute gpu driver bug workarounds - this is specifically useful 276 // Recompute gpu driver bug workarounds - this is specifically useful
277 // on systems where vendor_id/device_id aren't available. 277 // on systems where vendor_id/device_id aren't available.
278 if (!command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { 278 if (!command_line.HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
279 gpu::ApplyGpuDriverBugWorkarounds( 279 gpu::ApplyGpuDriverBugWorkarounds(
280 gpu_info, const_cast<CommandLine*>(&command_line)); 280 gpu_info, const_cast<base::CommandLine*>(&command_line));
281 } 281 }
282 #endif 282 #endif
283 283
284 #if defined(OS_LINUX) 284 #if defined(OS_LINUX)
285 initialized_gl_context = true; 285 initialized_gl_context = true;
286 #if !defined(OS_CHROMEOS) 286 #if !defined(OS_CHROMEOS)
287 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA 287 if (gpu_info.gpu.vendor_id == 0x10de && // NVIDIA
288 gpu_info.driver_vendor == "NVIDIA" && 288 gpu_info.driver_vendor == "NVIDIA" &&
289 !CanAccessNvidiaDeviceFile()) 289 !CanAccessNvidiaDeviceFile())
290 dead_on_arrival = true; 290 dead_on_arrival = true;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 child_thread->StopWatchdog(); 367 child_thread->StopWatchdog();
368 368
369 return 0; 369 return 0;
370 } 370 }
371 371
372 namespace { 372 namespace {
373 373
374 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, 374 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info,
375 const CommandLine& command_line) { 375 const base::CommandLine& command_line) {
376 DCHECK(command_line.HasSwitch(switches::kGpuVendorID) && 376 DCHECK(command_line.HasSwitch(switches::kGpuVendorID) &&
377 command_line.HasSwitch(switches::kGpuDeviceID) && 377 command_line.HasSwitch(switches::kGpuDeviceID) &&
378 command_line.HasSwitch(switches::kGpuDriverVersion)); 378 command_line.HasSwitch(switches::kGpuDriverVersion));
379 bool success = base::HexStringToUInt( 379 bool success = base::HexStringToUInt(
380 command_line.GetSwitchValueASCII(switches::kGpuVendorID), 380 command_line.GetSwitchValueASCII(switches::kGpuVendorID),
381 &gpu_info.gpu.vendor_id); 381 &gpu_info.gpu.vendor_id);
382 DCHECK(success); 382 DCHECK(success);
383 success = base::HexStringToUInt( 383 success = base::HexStringToUInt(
384 command_line.GetSwitchValueASCII(switches::kGpuDeviceID), 384 command_line.GetSwitchValueASCII(switches::kGpuDeviceID),
385 &gpu_info.gpu.device_id); 385 &gpu_info.gpu.device_id);
386 DCHECK(success); 386 DCHECK(success);
387 gpu_info.driver_vendor = 387 gpu_info.driver_vendor =
388 command_line.GetSwitchValueASCII(switches::kGpuDriverVendor); 388 command_line.GetSwitchValueASCII(switches::kGpuDriverVendor);
389 gpu_info.driver_version = 389 gpu_info.driver_version =
390 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion); 390 command_line.GetSwitchValueASCII(switches::kGpuDriverVersion);
391 GetContentClient()->SetGpuInfo(gpu_info); 391 GetContentClient()->SetGpuInfo(gpu_info);
392 } 392 }
393 393
394 bool WarmUpSandbox(const CommandLine& command_line) { 394 bool WarmUpSandbox(const base::CommandLine& command_line) {
395 { 395 {
396 TRACE_EVENT0("gpu", "Warm up rand"); 396 TRACE_EVENT0("gpu", "Warm up rand");
397 // Warm up the random subsystem, which needs to be done pre-sandbox on all 397 // Warm up the random subsystem, which needs to be done pre-sandbox on all
398 // platforms. 398 // platforms.
399 (void) base::RandUint64(); 399 (void) base::RandUint64();
400 } 400 }
401 return true; 401 return true;
402 } 402 }
403 403
404 #if !defined(OS_MACOSX) 404 #if !defined(OS_MACOSX)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 return true; 525 return true;
526 } 526 }
527 527
528 return false; 528 return false;
529 } 529 }
530 #endif // defined(OS_WIN) 530 #endif // defined(OS_WIN)
531 531
532 } // namespace. 532 } // namespace.
533 533
534 } // namespace content 534 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | content/plugin/plugin_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698