| 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 "ui/gl/gl_gl_api_implementation.h" | 5 #include "ui/gl/gl_gl_api_implementation.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 void InitializeStaticGLBindingsGL() { | 294 void InitializeStaticGLBindingsGL() { |
| 295 g_current_gl_context_tls = new base::ThreadLocalPointer<GLApi>; | 295 g_current_gl_context_tls = new base::ThreadLocalPointer<GLApi>; |
| 296 g_driver_gl.InitializeStaticBindings(); | 296 g_driver_gl.InitializeStaticBindings(); |
| 297 if (!g_real_gl) { | 297 if (!g_real_gl) { |
| 298 g_real_gl = new RealGLApi(); | 298 g_real_gl = new RealGLApi(); |
| 299 g_trace_gl = new TraceGLApi(g_real_gl); | 299 g_trace_gl = new TraceGLApi(g_real_gl); |
| 300 g_no_context_gl = new NoContextGLApi(); | 300 g_no_context_gl = new NoContextGLApi(); |
| 301 } | 301 } |
| 302 g_real_gl->Initialize(&g_driver_gl); | 302 g_real_gl->Initialize(&g_driver_gl); |
| 303 g_gl = g_real_gl; | 303 g_gl = g_real_gl; |
| 304 if (CommandLine::ForCurrentProcess()->HasSwitch( | 304 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 305 switches::kEnableGPUServiceTracing)) { | 305 switches::kEnableGPUServiceTracing)) { |
| 306 g_gl = g_trace_gl; | 306 g_gl = g_trace_gl; |
| 307 } | 307 } |
| 308 SetGLToRealGLApi(); | 308 SetGLToRealGLApi(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 GLApi* GetCurrentGLApi() { | 311 GLApi* GetCurrentGLApi() { |
| 312 return g_current_gl_context_tls->Get(); | 312 return g_current_gl_context_tls->Get(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 void SetGLApi(GLApi* api) { | 315 void SetGLApi(GLApi* api) { |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 ScopedSetGLToRealGLApi::ScopedSetGLToRealGLApi() | 536 ScopedSetGLToRealGLApi::ScopedSetGLToRealGLApi() |
| 537 : old_gl_api_(GetCurrentGLApi()) { | 537 : old_gl_api_(GetCurrentGLApi()) { |
| 538 SetGLToRealGLApi(); | 538 SetGLToRealGLApi(); |
| 539 } | 539 } |
| 540 | 540 |
| 541 ScopedSetGLToRealGLApi::~ScopedSetGLToRealGLApi() { | 541 ScopedSetGLToRealGLApi::~ScopedSetGLToRealGLApi() { |
| 542 SetGLApi(old_gl_api_); | 542 SetGLApi(old_gl_api_); |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace gfx | 545 } // namespace gfx |
| OLD | NEW |