Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ui / gl / gl_egl_api_implementation.cc
blobba3e9cf923ce9a909015b6e18d2add3ac043b8a4
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
3 // found in the LICENSE file.
5 #include "ui/gl/gl_egl_api_implementation.h"
7 namespace gfx {
9 RealEGLApi* g_real_egl;
11 void InitializeGLBindingsEGL() {
12 g_driver_egl.InitializeBindings();
13 if (!g_real_egl) {
14 g_real_egl = new RealEGLApi();
16 g_real_egl->Initialize(&g_driver_egl);
17 g_current_egl_context = g_real_egl;
20 void InitializeGLExtensionBindingsEGL(GLContext* context) {
21 g_driver_egl.InitializeExtensionBindings(context);
24 void InitializeDebugGLBindingsEGL() {
25 g_driver_egl.InitializeDebugBindings();
28 void ClearGLBindingsEGL() {
29 if (g_real_egl) {
30 delete g_real_egl;
31 g_real_egl = NULL;
33 g_current_egl_context = NULL;
34 g_driver_egl.ClearBindings();
37 EGLApi::EGLApi() {
40 EGLApi::~EGLApi() {
43 EGLApiBase::EGLApiBase()
44 : driver_(NULL) {
47 EGLApiBase::~EGLApiBase() {
50 void EGLApiBase::InitializeBase(DriverEGL* driver) {
51 driver_ = driver;
54 RealEGLApi::RealEGLApi() {
57 RealEGLApi::~RealEGLApi() {
60 void RealEGLApi::Initialize(DriverEGL* driver) {
61 InitializeBase(driver);
64 TraceEGLApi::~TraceEGLApi() {
67 } // namespace gfx