| 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 | |
| 235 // Load and initialize the GL implementation and locate the GL entry points. | 222 // Load and initialize the GL implementation and locate the GL entry points. |
| 236 bool gl_initialized = | 223 if (gfx::GLSurface::InitializeOneOff()) { |
| 237 gl_already_initialized | |
| 238 ? gfx::GetGLImplementation() != gfx::kGLImplementationNone | |
| 239 : gfx::GLSurface::InitializeOneOff(); | |
| 240 if (gl_initialized) { | |
| 241 // We need to collect GL strings (VENDOR, RENDERER) for blacklisting | 224 // We need to collect GL strings (VENDOR, RENDERER) for blacklisting |
| 242 // purposes. However, on Mac we don't actually use them. As documented in | 225 // purposes. However, on Mac we don't actually use them. As documented in |
| 243 // crbug.com/222934, due to some driver issues, glGetString could take | 226 // crbug.com/222934, due to some driver issues, glGetString could take |
| 244 // multiple seconds to finish, which in turn cause the GPU process to | 227 // multiple seconds to finish, which in turn cause the GPU process to |
| 245 // crash. | 228 // crash. |
| 246 // By skipping the following code on Mac, we don't really lose anything, | 229 // By skipping the following code on Mac, we don't really lose anything, |
| 247 // because the basic GPU information is passed down from browser process | 230 // because the basic GPU information is passed down from browser process |
| 248 // and we already registered them through SetGpuInfo() above. | 231 // and we already registered them through SetGpuInfo() above. |
| 249 base::TimeTicks before_collect_context_graphics_info = | 232 base::TimeTicks before_collect_context_graphics_info = |
| 250 base::TimeTicks::Now(); | 233 base::TimeTicks::Now(); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 return true; | 428 return true; |
| 446 } | 429 } |
| 447 | 430 |
| 448 return false; | 431 return false; |
| 449 } | 432 } |
| 450 #endif // defined(OS_WIN) | 433 #endif // defined(OS_WIN) |
| 451 | 434 |
| 452 } // namespace. | 435 } // namespace. |
| 453 | 436 |
| 454 } // namespace content | 437 } // namespace content |
| OLD | NEW |