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

Side by Side Diff: ui/gl/init/gl_initializer_ozone.cc

Issue 2723613003: Remove deprecated SurfaceFactoryOzone methods. (Closed)
Patch Set: Brackets. Created 3 years, 9 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/init/gl_factory_ozone.cc ('k') | ui/ozone/public/surface_factory_ozone.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/init/gl_initializer.h" 5 #include "ui/gl/init/gl_initializer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 #include "ui/gl/gl_egl_api_implementation.h"
10 #include "ui/gl/gl_gl_api_implementation.h" 9 #include "ui/gl/gl_gl_api_implementation.h"
11 #include "ui/gl/gl_implementation_osmesa.h" 10 #include "ui/gl/gl_implementation_osmesa.h"
12 #include "ui/gl/gl_osmesa_api_implementation.h" 11 #include "ui/gl/gl_osmesa_api_implementation.h"
13 #include "ui/gl/gl_surface_egl.h" 12 #include "ui/gl/gl_surface.h"
14 #include "ui/gl/init/ozone_util.h" 13 #include "ui/gl/init/ozone_util.h"
15 #include "ui/ozone/public/ozone_platform.h"
16 #include "ui/ozone/public/surface_factory_ozone.h"
17 14
18 namespace gl { 15 namespace gl {
19 namespace init { 16 namespace init {
20 17
21 namespace {
22
23 bool InitializeStaticEGLInternal() {
24 if (!GetSurfaceFactoryOzone()->LoadEGLGLES2Bindings())
25 return false;
26
27 SetGLImplementation(kGLImplementationEGLGLES2);
28 InitializeStaticGLBindingsGL();
29 InitializeStaticGLBindingsEGL();
30
31 return true;
32 }
33
34 } // namespace
35
36 bool InitializeGLOneOffPlatform() { 18 bool InitializeGLOneOffPlatform() {
37 if (HasGLOzone()) 19 if (HasGLOzone())
38 return GetGLOzone()->InitializeGLOneOffPlatform(); 20 return GetGLOzone()->InitializeGLOneOffPlatform();
39 21
40 switch (GetGLImplementation()) { 22 switch (GetGLImplementation()) {
41 case kGLImplementationEGLGLES2:
42 if (!GLSurfaceEGL::InitializeOneOff(
43 GetSurfaceFactoryOzone()->GetNativeDisplay())) {
44 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed.";
45 return false;
46 }
47 return true;
48 case kGLImplementationOSMesaGL: 23 case kGLImplementationOSMesaGL:
49 case kGLImplementationMockGL: 24 case kGLImplementationMockGL:
50 case kGLImplementationStubGL: 25 case kGLImplementationStubGL:
51 return true; 26 return true;
52 default: 27 default:
53 return false; 28 return false;
54 } 29 }
55 } 30 }
56 31
57 bool InitializeStaticGLBindings(GLImplementation implementation) { 32 bool InitializeStaticGLBindings(GLImplementation implementation) {
58 // Prevent reinitialization with a different implementation. Once the gpu 33 // Prevent reinitialization with a different implementation. Once the gpu
59 // unit tests have initialized with kGLImplementationMock, we don't want to 34 // unit tests have initialized with kGLImplementationMock, we don't want to
60 // later switch to another GL implementation. 35 // later switch to another GL implementation.
61 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); 36 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
62 37
63 if (HasGLOzone(implementation)) { 38 if (HasGLOzone(implementation)) {
64 return GetGLOzone(implementation) 39 return GetGLOzone(implementation)
65 ->InitializeStaticGLBindings(implementation); 40 ->InitializeStaticGLBindings(implementation);
66 } 41 }
67 42
68 switch (implementation) { 43 switch (implementation) {
69 case kGLImplementationOSMesaGL: 44 case kGLImplementationOSMesaGL:
70 return InitializeStaticGLBindingsOSMesaGL(); 45 return InitializeStaticGLBindingsOSMesaGL();
71 case kGLImplementationEGLGLES2:
72 return InitializeStaticEGLInternal();
73 case kGLImplementationMockGL: 46 case kGLImplementationMockGL:
74 case kGLImplementationStubGL: 47 case kGLImplementationStubGL:
75 SetGLImplementation(implementation); 48 SetGLImplementation(implementation);
76 InitializeStaticGLBindingsGL(); 49 InitializeStaticGLBindingsGL();
77 return true; 50 return true;
78 default: 51 default:
79 NOTREACHED(); 52 NOTREACHED();
80 } 53 }
81 54
82 return false; 55 return false;
83 } 56 }
84 57
85 void InitializeDebugGLBindings() { 58 void InitializeDebugGLBindings() {
86 if (HasGLOzone()) { 59 if (HasGLOzone()) {
87 GetGLOzone()->InitializeDebugGLBindings(); 60 GetGLOzone()->InitializeDebugGLBindings();
88 return; 61 return;
89 } 62 }
90 63
91 InitializeDebugGLBindingsEGL();
92 InitializeDebugGLBindingsGL(); 64 InitializeDebugGLBindingsGL();
93 InitializeDebugGLBindingsOSMESA(); 65 InitializeDebugGLBindingsOSMESA();
94 } 66 }
95 67
96 void ShutdownGLPlatform() { 68 void ShutdownGLPlatform() {
97 GLSurfaceEGL::ShutdownOneOff();
98 if (HasGLOzone()) { 69 if (HasGLOzone()) {
99 GetGLOzone()->ShutdownGL(); 70 GetGLOzone()->ShutdownGL();
100 return; 71 return;
101 } 72 }
102 73
103 ClearBindingsEGL();
104 ClearBindingsGL(); 74 ClearBindingsGL();
105 ClearBindingsOSMESA(); 75 ClearBindingsOSMESA();
106 } 76 }
107 77
108 } // namespace init 78 } // namespace init
109 } // namespace gl 79 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory_ozone.cc ('k') | ui/ozone/public/surface_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698