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" |
11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
12 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
13 #include "ui/gl/gl_surface_stub.h" | 13 #include "ui/gl/gl_surface_stub.h" |
| 14 #include "ui/gl/init/gl_factory.h" |
14 | 15 |
15 namespace android_webview { | 16 namespace android_webview { |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // "App" context is a bit of a stretch. Basically we use this context while | 20 // "App" context is a bit of a stretch. Basically we use this context while |
20 // saving and restoring the App GL state. | 21 // saving and restoring the App GL state. |
21 class AppContextSurface { | 22 class AppContextSurface { |
22 public: | 23 public: |
23 AppContextSurface() | 24 AppContextSurface() |
24 : surface(new gfx::GLSurfaceStub), | 25 : surface(new gfx::GLSurfaceStub), |
25 context(gfx::GLContext::CreateGLContext(NULL, | 26 context(gl::init::CreateGLContext(nullptr, |
26 surface.get(), | 27 surface.get(), |
27 gfx::PreferDiscreteGpu)) {} | 28 gfx::PreferDiscreteGpu)) {} |
28 void MakeCurrent() { context->MakeCurrent(surface.get()); } | 29 void MakeCurrent() { context->MakeCurrent(surface.get()); } |
29 | 30 |
30 private: | 31 private: |
31 scoped_refptr<gfx::GLSurfaceStub> surface; | 32 scoped_refptr<gfx::GLSurfaceStub> surface; |
32 scoped_refptr<gfx::GLContext> context; | 33 scoped_refptr<gfx::GLContext> context; |
33 | 34 |
34 DISALLOW_COPY_AND_ASSIGN(AppContextSurface); | 35 DISALLOW_COPY_AND_ASSIGN(AppContextSurface); |
35 }; | 36 }; |
36 | 37 |
37 base::LazyInstance<AppContextSurface> g_app_context_surface = | 38 base::LazyInstance<AppContextSurface> g_app_context_surface = |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {} | 423 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {} |
423 | 424 |
424 StencilState ScopedAppGLStateRestore::stencil_state() const { | 425 StencilState ScopedAppGLStateRestore::stencil_state() const { |
425 return impl_->stencil_state(); | 426 return impl_->stencil_state(); |
426 } | 427 } |
427 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { | 428 int ScopedAppGLStateRestore::framebuffer_binding_ext() const { |
428 return impl_->framebuffer_binding_ext(); | 429 return impl_->framebuffer_binding_ext(); |
429 } | 430 } |
430 | 431 |
431 } // namespace android_webview | 432 } // namespace android_webview |
OLD | NEW |