OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "android_webview/browser/scoped_app_gl_state_restore.h" | 5 #include "android_webview/browser/scoped_app_gl_state_restore.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 gl::GLContextAttribs())) {} | 28 gl::GLContextAttribs())) {} |
29 void MakeCurrent() { context->MakeCurrent(surface.get()); } | 29 void MakeCurrent() { context->MakeCurrent(surface.get()); } |
30 | 30 |
31 private: | 31 private: |
32 scoped_refptr<gl::GLSurfaceStub> surface; | 32 scoped_refptr<gl::GLSurfaceStub> surface; |
33 scoped_refptr<gl::GLContext> context; | 33 scoped_refptr<gl::GLContext> context; |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(AppContextSurface); | 35 DISALLOW_COPY_AND_ASSIGN(AppContextSurface); |
36 }; | 36 }; |
37 | 37 |
38 base::LazyInstance<AppContextSurface> g_app_context_surface = | 38 base::LazyInstance<AppContextSurface>::DestructorAtExit g_app_context_surface = |
39 LAZY_INSTANCE_INITIALIZER; | 39 LAZY_INSTANCE_INITIALIZER; |
40 | 40 |
41 // Make the global g_app_context_surface current so that the gl_binding is not | 41 // Make the global g_app_context_surface current so that the gl_binding is not |
42 // NULL for making gl* calls. The binding can be null if another GlContext was | 42 // NULL for making gl* calls. The binding can be null if another GlContext was |
43 // destroyed immediately before gl* calls here. | 43 // destroyed immediately before gl* calls here. |
44 void MakeAppContextCurrent() { | 44 void MakeAppContextCurrent() { |
45 g_app_context_surface.Get().MakeCurrent(); | 45 g_app_context_surface.Get().MakeCurrent(); |
46 } | 46 } |
47 | 47 |
48 void GLEnableDisable(GLenum cap, bool enable) { | 48 void GLEnableDisable(GLenum cap, bool enable) { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 } | 437 } |
438 | 438 |
439 StencilState ScopedAppGLStateRestore::stencil_state() const { | 439 StencilState ScopedAppGLStateRestore::stencil_state() const { |
440 return impl_->stencil_state(); | 440 return impl_->stencil_state(); |
441 } | 441 } |
442 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { | 442 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { |
443 return impl_->framebuffer_binding_ext(); | 443 return impl_->framebuffer_binding_ext(); |
444 } | 444 } |
445 | 445 |
446 } // namespace android_webview | 446 } // namespace android_webview |
OLD | NEW |