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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
17 #include "base/win/scoped_com_initializer.h" | 17 #include "base/win/scoped_com_initializer.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "content/common/gpu/gpu_config.h" | 19 #include "content/common/gpu/gpu_config.h" |
20 #include "content/gpu/gpu_child_thread.h" | 20 #include "content/gpu/gpu_child_thread.h" |
21 #include "content/gpu/gpu_info_collector.h" | 21 #include "content/gpu/gpu_info_collector.h" |
22 #include "content/gpu/gpu_process.h" | 22 #include "content/gpu/gpu_process.h" |
23 #include "content/public/common/content_client.h" | 23 #include "content/public/common/content_client.h" |
24 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
25 #include "content/public/common/gpu_switching_option.h" | |
26 #include "content/public/common/main_function_params.h" | 25 #include "content/public/common/main_function_params.h" |
27 #include "crypto/hmac.h" | 26 #include "crypto/hmac.h" |
28 #include "ui/gl/gl_surface.h" | 27 #include "ui/gl/gl_surface.h" |
29 #include "ui/gl/gl_switches.h" | 28 #include "ui/gl/gl_switches.h" |
30 #include "ui/gl/gpu_switching_manager.h" | |
31 | 29 |
32 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
33 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" | 31 #include "content/common/gpu/media/dxva_video_decode_accelerator.h" |
34 #include "sandbox/win/src/sandbox.h" | 32 #include "sandbox/win/src/sandbox.h" |
35 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) | 33 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) |
36 #include "content/common/gpu/media/omx_video_decode_accelerator.h" | 34 #include "content/common/gpu/media/omx_video_decode_accelerator.h" |
37 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 35 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
38 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" | 36 #include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
39 #endif | 37 #endif |
40 | 38 |
(...skipping 27 matching lines...) Expand all Loading... |
68 // able to load a DLL. | 66 // able to load a DLL. |
69 SetErrorMode( | 67 SetErrorMode( |
70 SEM_FAILCRITICALERRORS | | 68 SEM_FAILCRITICALERRORS | |
71 SEM_NOGPFAULTERRORBOX | | 69 SEM_NOGPFAULTERRORBOX | |
72 SEM_NOOPENFILEERRORBOX); | 70 SEM_NOOPENFILEERRORBOX); |
73 #elif defined(USE_X11) | 71 #elif defined(USE_X11) |
74 ui::SetDefaultX11ErrorHandlers(); | 72 ui::SetDefaultX11ErrorHandlers(); |
75 #endif | 73 #endif |
76 } | 74 } |
77 | 75 |
78 if (command_line.HasSwitch(switches::kGpuSwitching)) { | |
79 std::string option = command_line.GetSwitchValueASCII( | |
80 switches::kGpuSwitching); | |
81 if (option == switches::kGpuSwitchingOptionNameForceDiscrete) | |
82 gfx::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); | |
83 else if (option == switches::kGpuSwitchingOptionNameForceIntegrated) | |
84 gfx::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); | |
85 } | |
86 | |
87 // Initialization of the OpenGL bindings may fail, in which case we | 76 // Initialization of the OpenGL bindings may fail, in which case we |
88 // will need to tear down this process. However, we can not do so | 77 // will need to tear down this process. However, we can not do so |
89 // safely until the IPC channel is set up, because the detection of | 78 // safely until the IPC channel is set up, because the detection of |
90 // early return of a child process is implemented using an IPC | 79 // early return of a child process is implemented using an IPC |
91 // channel error. If the IPC channel is not fully set up between the | 80 // channel error. If the IPC channel is not fully set up between the |
92 // browser and GPU process, and the GPU process crashes or exits | 81 // browser and GPU process, and the GPU process crashes or exits |
93 // early, the browser process will never detect it. For this reason | 82 // early, the browser process will never detect it. For this reason |
94 // we defer tearing down the GPU process until receiving the | 83 // we defer tearing down the GPU process until receiving the |
95 // GpuMsg_Initialize message from the browser. | 84 // GpuMsg_Initialize message from the browser. |
96 bool dead_on_arrival = false; | 85 bool dead_on_arrival = false; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 } | 298 } |
310 | 299 |
311 void CollectGraphicsInfo(content::GPUInfo* gpu_info) { | 300 void CollectGraphicsInfo(content::GPUInfo* gpu_info) { |
312 if (!gpu_info_collector::CollectGraphicsInfo(gpu_info)) | 301 if (!gpu_info_collector::CollectGraphicsInfo(gpu_info)) |
313 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed"; | 302 VLOG(1) << "gpu_info_collector::CollectGraphicsInfo failed"; |
314 content::GetContentClient()->SetGpuInfo(*gpu_info); | 303 content::GetContentClient()->SetGpuInfo(*gpu_info); |
315 } | 304 } |
316 | 305 |
317 } // namespace. | 306 } // namespace. |
318 | 307 |
OLD | NEW |