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 <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // On Chrome OS ARM, GPU driver userspace creates threads when initializing | 212 // On Chrome OS ARM, GPU driver userspace creates threads when initializing |
213 // a GL context, so start the sandbox early. | 213 // a GL context, so start the sandbox early. |
214 gpu_info.sandboxed = StartSandboxLinux(gpu_info, watchdog_thread.get(), | 214 gpu_info.sandboxed = StartSandboxLinux(gpu_info, watchdog_thread.get(), |
215 should_initialize_gl_context); | 215 should_initialize_gl_context); |
216 initialized_sandbox = true; | 216 initialized_sandbox = true; |
217 #endif | 217 #endif |
218 #endif // defined(OS_LINUX) | 218 #endif // defined(OS_LINUX) |
219 | 219 |
220 base::TimeTicks before_initialize_one_off = base::TimeTicks::Now(); | 220 base::TimeTicks before_initialize_one_off = base::TimeTicks::Now(); |
221 | 221 |
| 222 // Determine if we need to initialize GL here or it has already been done. |
| 223 bool gl_already_initialized = false; |
| 224 #if defined(OS_MACOSX) |
| 225 // On Mac, GLSurface::InitializeOneOff() is called from the sandbox warmup |
| 226 // code before getting here. |
| 227 gl_already_initialized = true; |
| 228 #endif |
| 229 if (command_line.HasSwitch(switches::kInProcessGPU)) { |
| 230 // With in-process GPU, GLSurface::InitializeOneOff() is called from |
| 231 // GpuChildThread before getting here. |
| 232 gl_already_initialized = true; |
| 233 } |
| 234 |
222 // Load and initialize the GL implementation and locate the GL entry points. | 235 // Load and initialize the GL implementation and locate the GL entry points. |
223 if (gfx::GLSurface::InitializeOneOff()) { | 236 bool gl_initialized = |
| 237 gl_already_initialized |
| 238 ? gfx::GetGLImplementation() != gfx::kGLImplementationNone |
| 239 : gfx::GLSurface::InitializeOneOff(); |
| 240 if (gl_initialized) { |
224 // We need to collect GL strings (VENDOR, RENDERER) for blacklisting | 241 // We need to collect GL strings (VENDOR, RENDERER) for blacklisting |
225 // purposes. However, on Mac we don't actually use them. As documented in | 242 // purposes. However, on Mac we don't actually use them. As documented in |
226 // crbug.com/222934, due to some driver issues, glGetString could take | 243 // crbug.com/222934, due to some driver issues, glGetString could take |
227 // multiple seconds to finish, which in turn cause the GPU process to | 244 // multiple seconds to finish, which in turn cause the GPU process to |
228 // crash. | 245 // crash. |
229 // By skipping the following code on Mac, we don't really lose anything, | 246 // By skipping the following code on Mac, we don't really lose anything, |
230 // because the basic GPU information is passed down from browser process | 247 // because the basic GPU information is passed down from browser process |
231 // and we already registered them through SetGpuInfo() above. | 248 // and we already registered them through SetGpuInfo() above. |
232 base::TimeTicks before_collect_context_graphics_info = | 249 base::TimeTicks before_collect_context_graphics_info = |
233 base::TimeTicks::Now(); | 250 base::TimeTicks::Now(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 return true; | 445 return true; |
429 } | 446 } |
430 | 447 |
431 return false; | 448 return false; |
432 } | 449 } |
433 #endif // defined(OS_WIN) | 450 #endif // defined(OS_WIN) |
434 | 451 |
435 } // namespace. | 452 } // namespace. |
436 | 453 |
437 } // namespace content | 454 } // namespace content |
OLD | NEW |