Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: ui/gl/gl_osmesa_api_implementation.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_osmesa_api_implementation.h ('k') | ui/gl/gl_stub_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_osmesa_api_implementation.h" 5 #include "ui/gl/gl_osmesa_api_implementation.h"
6 6
7 namespace gl { 7 namespace gl {
8 8
9 RealOSMESAApi* g_real_osmesa; 9 RealOSMESAApi* g_real_osmesa = nullptr;
10 DebugOSMESAApi* g_debug_osmesa = nullptr;
10 11
11 void InitializeStaticGLBindingsOSMESA() { 12 void InitializeStaticGLBindingsOSMESA() {
12 g_driver_osmesa.InitializeStaticBindings(); 13 g_driver_osmesa.InitializeStaticBindings();
13 if (!g_real_osmesa) { 14 if (!g_real_osmesa) {
14 g_real_osmesa = new RealOSMESAApi(); 15 g_real_osmesa = new RealOSMESAApi();
15 } 16 }
16 g_real_osmesa->Initialize(&g_driver_osmesa); 17 g_real_osmesa->Initialize(&g_driver_osmesa);
17 g_current_osmesa_context = g_real_osmesa; 18 g_current_osmesa_context = g_real_osmesa;
18 g_driver_osmesa.InitializeExtensionBindings(); 19 g_driver_osmesa.InitializeExtensionBindings();
19 } 20 }
20 21
21 void InitializeDebugGLBindingsOSMESA() { 22 void InitializeDebugGLBindingsOSMESA() {
22 g_driver_osmesa.InitializeDebugBindings(); 23 if (!g_debug_osmesa) {
24 g_debug_osmesa = new DebugOSMESAApi(g_real_osmesa);
25 }
26 g_current_osmesa_context = g_debug_osmesa;
23 } 27 }
24 28
25 void ClearBindingsOSMESA() { 29 void ClearBindingsOSMESA() {
30 if (g_debug_osmesa) {
31 delete g_debug_osmesa;
32 g_debug_osmesa = NULL;
33 }
26 if (g_real_osmesa) { 34 if (g_real_osmesa) {
27 delete g_real_osmesa; 35 delete g_real_osmesa;
28 g_real_osmesa = NULL; 36 g_real_osmesa = NULL;
29 } 37 }
30 g_current_osmesa_context = NULL; 38 g_current_osmesa_context = NULL;
31 g_driver_osmesa.ClearBindings(); 39 g_driver_osmesa.ClearBindings();
32 } 40 }
33 41
34 OSMESAApi::OSMESAApi() { 42 OSMESAApi::OSMESAApi() {
35 } 43 }
(...skipping 15 matching lines...) Expand all
51 RealOSMESAApi::RealOSMESAApi() { 59 RealOSMESAApi::RealOSMESAApi() {
52 } 60 }
53 61
54 RealOSMESAApi::~RealOSMESAApi() { 62 RealOSMESAApi::~RealOSMESAApi() {
55 } 63 }
56 64
57 void RealOSMESAApi::Initialize(DriverOSMESA* driver) { 65 void RealOSMESAApi::Initialize(DriverOSMESA* driver) {
58 InitializeBase(driver); 66 InitializeBase(driver);
59 } 67 }
60 68
69 DebugOSMESAApi::DebugOSMESAApi(OSMESAApi* osmesa_api)
70 : osmesa_api_(osmesa_api) {}
71 DebugOSMESAApi::~DebugOSMESAApi() {}
72
61 TraceOSMESAApi::~TraceOSMESAApi() { 73 TraceOSMESAApi::~TraceOSMESAApi() {
62 } 74 }
63 75
64 } // namespace gl 76 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_osmesa_api_implementation.h ('k') | ui/gl/gl_stub_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698