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_context.h" | 5 #include "ui/gl/gl_context.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/threading/thread_local.h" | 16 #include "base/threading/thread_local.h" |
17 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
18 #include "ui/gl/gl_gl_api_implementation.h" | 18 #include "ui/gl/gl_gl_api_implementation.h" |
19 #include "ui/gl/gl_implementation.h" | 19 #include "ui/gl/gl_implementation.h" |
20 #include "ui/gl/gl_surface.h" | 20 #include "ui/gl/gl_surface.h" |
21 #include "ui/gl/gl_switches.h" | 21 #include "ui/gl/gl_switches.h" |
22 #include "ui/gl/gl_version_info.h" | 22 #include "ui/gl/gl_version_info.h" |
23 #include "ui/gl/gpu_timing.h" | 23 #include "ui/gl/gpu_timing.h" |
24 | 24 |
25 namespace gl { | 25 namespace gl { |
26 | 26 |
27 namespace { | 27 namespace { |
28 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky | 28 base::LazyInstance<base::ThreadLocalPointer<GLContext>>::Leaky |
29 current_context_ = LAZY_INSTANCE_INITIALIZER; | 29 current_context_ = LAZY_INSTANCE_INITIALIZER; |
30 | 30 |
31 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky | 31 base::LazyInstance<base::ThreadLocalPointer<GLContext>>::Leaky |
32 current_real_context_ = LAZY_INSTANCE_INITIALIZER; | 32 current_real_context_ = LAZY_INSTANCE_INITIALIZER; |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 GLContext::ScopedReleaseCurrent::ScopedReleaseCurrent() : canceled_(false) {} | 35 GLContext::ScopedReleaseCurrent::ScopedReleaseCurrent() : canceled_(false) {} |
36 | 36 |
37 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() { | 37 GLContext::ScopedReleaseCurrent::~ScopedReleaseCurrent() { |
38 if (!canceled_ && GetCurrent()) { | 38 if (!canceled_ && GetCurrent()) { |
39 GetCurrent()->ReleaseCurrent(nullptr); | 39 GetCurrent()->ReleaseCurrent(nullptr); |
40 } | 40 } |
41 } | 41 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, | 334 scoped_refptr<GLContext> InitializeGLContext(scoped_refptr<GLContext> context, |
335 GLSurface* compatible_surface, | 335 GLSurface* compatible_surface, |
336 const GLContextAttribs& attribs) { | 336 const GLContextAttribs& attribs) { |
337 if (!context->Initialize(compatible_surface, attribs)) | 337 if (!context->Initialize(compatible_surface, attribs)) |
338 return nullptr; | 338 return nullptr; |
339 return context; | 339 return context; |
340 } | 340 } |
341 | 341 |
342 } // namespace gl | 342 } // namespace gl |
OLD | NEW |