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

Side by Side Diff: ui/gl/init/gl_factory_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 | « no previous file | ui/gl/init/gl_initializer_ozone.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 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_factory.h" 5 #include "ui/gl/init/gl_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_context_egl.h"
11 #include "ui/gl/gl_context_osmesa.h" 10 #include "ui/gl/gl_context_osmesa.h"
12 #include "ui/gl/gl_context_stub.h" 11 #include "ui/gl/gl_context_stub.h"
13 #include "ui/gl/gl_egl_api_implementation.h"
14 #include "ui/gl/gl_implementation.h" 12 #include "ui/gl/gl_implementation.h"
15 #include "ui/gl/gl_share_group.h" 13 #include "ui/gl/gl_share_group.h"
16 #include "ui/gl/gl_surface.h" 14 #include "ui/gl/gl_surface.h"
17 #include "ui/gl/gl_surface_egl.h"
18 #include "ui/gl/gl_surface_osmesa.h" 15 #include "ui/gl/gl_surface_osmesa.h"
19 #include "ui/gl/gl_surface_stub.h" 16 #include "ui/gl/gl_surface_stub.h"
20 #include "ui/gl/init/ozone_util.h" 17 #include "ui/gl/init/ozone_util.h"
21 #include "ui/ozone/public/ozone_platform.h"
22 #include "ui/ozone/public/surface_factory_ozone.h"
23 18
24 namespace gl { 19 namespace gl {
25 namespace init { 20 namespace init {
26 21
27 namespace { 22 namespace {
28 23
29 bool HasDefaultImplementation(GLImplementation impl) { 24 bool HasDefaultImplementation(GLImplementation impl) {
30 return impl == kGLImplementationOSMesaGL || impl == kGLImplementationMockGL || 25 return impl == kGLImplementationOSMesaGL || impl == kGLImplementationMockGL ||
31 impl == kGLImplementationStubGL; 26 impl == kGLImplementationStubGL;
32 } 27 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 60
66 std::vector<GLImplementation> GetAllowedGLImplementations() { 61 std::vector<GLImplementation> GetAllowedGLImplementations() {
67 ui::OzonePlatform::InitializeForGPU(); 62 ui::OzonePlatform::InitializeForGPU();
68 return GetSurfaceFactoryOzone()->GetAllowedGLImplementations(); 63 return GetSurfaceFactoryOzone()->GetAllowedGLImplementations();
69 } 64 }
70 65
71 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { 66 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
72 if (HasGLOzone()) 67 if (HasGLOzone())
73 return GetGLOzone()->GetGLWindowSystemBindingInfo(info); 68 return GetGLOzone()->GetGLWindowSystemBindingInfo(info);
74 69
75 // TODO(kylechar): This is deprecated and can be removed once all Ozone 70 return false;
76 // platforms use GLOzone instead.
77 switch (GetGLImplementation()) {
78 case kGLImplementationEGLGLES2:
79 return GetGLWindowSystemBindingInfoEGL(info);
80 default:
81 return false;
82 }
83 } 71 }
84 72
85 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, 73 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
86 GLSurface* compatible_surface, 74 GLSurface* compatible_surface,
87 const GLContextAttribs& attribs) { 75 const GLContextAttribs& attribs) {
88 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); 76 TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
89 77
90 if (HasGLOzone()) { 78 if (HasGLOzone()) {
91 return GetGLOzone()->CreateGLContext(share_group, compatible_surface, 79 return GetGLOzone()->CreateGLContext(share_group, compatible_surface,
92 attribs); 80 attribs);
93 } 81 }
94 82
95 switch (GetGLImplementation()) { 83 switch (GetGLImplementation()) {
96 case kGLImplementationMockGL: 84 case kGLImplementationMockGL:
97 return scoped_refptr<GLContext>(new GLContextStub(share_group)); 85 return scoped_refptr<GLContext>(new GLContextStub(share_group));
98 case kGLImplementationStubGL: { 86 case kGLImplementationStubGL: {
99 scoped_refptr<GLContextStub> stub_context = 87 scoped_refptr<GLContextStub> stub_context =
100 new GLContextStub(share_group); 88 new GLContextStub(share_group);
101 stub_context->SetUseStubApi(true); 89 stub_context->SetUseStubApi(true);
102 return stub_context; 90 return stub_context;
103 } 91 }
104 case kGLImplementationOSMesaGL: 92 case kGLImplementationOSMesaGL:
105 return InitializeGLContext(new GLContextOSMesa(share_group), 93 return InitializeGLContext(new GLContextOSMesa(share_group),
106 compatible_surface, attribs); 94 compatible_surface, attribs);
107 case kGLImplementationEGLGLES2:
108 return InitializeGLContext(new GLContextEGL(share_group),
109 compatible_surface, attribs);
110 default: 95 default:
111 NOTREACHED(); 96 NOTREACHED();
112 } 97 }
113 return nullptr; 98 return nullptr;
114 } 99 }
115 100
116 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { 101 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
117 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); 102 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
118 103
119 if (HasGLOzone()) 104 if (HasGLOzone())
120 return GetGLOzone()->CreateViewGLSurface(window); 105 return GetGLOzone()->CreateViewGLSurface(window);
121 106
122 if (HasDefaultImplementation(GetGLImplementation())) 107 if (HasDefaultImplementation(GetGLImplementation()))
123 return CreateDefaultViewGLSurface(window); 108 return CreateDefaultViewGLSurface(window);
124 109
125 // TODO(kylechar): This is deprecated and can be removed once all Ozone 110 return nullptr;
126 // platforms use GLOzone instead.
127 return GetSurfaceFactoryOzone()->CreateViewGLSurface(GetGLImplementation(),
128 window);
129 } 111 }
130 112
131 scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( 113 scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
132 gfx::AcceleratedWidget window) { 114 gfx::AcceleratedWidget window) {
133 TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface"); 115 TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface");
134 116
135 if (HasGLOzone()) 117 if (HasGLOzone())
136 return GetGLOzone()->CreateSurfacelessViewGLSurface(window); 118 return GetGLOzone()->CreateSurfacelessViewGLSurface(window);
137 119
138 // TODO(kylechar): This is deprecated and can be removed once all Ozone 120 return nullptr;
139 // platforms use GLOzone instead.
140 return GetSurfaceFactoryOzone()->CreateSurfacelessViewGLSurface(
141 GetGLImplementation(), window);
142 } 121 }
143 122
144 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( 123 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
145 const gfx::Size& size, GLSurfaceFormat format) { 124 const gfx::Size& size, GLSurfaceFormat format) {
146 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); 125 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
147 126
148 if (!format.IsDefault()) { 127 if (!format.IsDefault()) {
149 NOTREACHED() << "FATAL: Ozone only supports default-format surfaces."; 128 NOTREACHED() << "FATAL: Ozone only supports default-format surfaces.";
150 return nullptr; 129 return nullptr;
151 } 130 }
152 131
153 if (HasGLOzone()) 132 if (HasGLOzone())
154 return GetGLOzone()->CreateOffscreenGLSurface(size); 133 return GetGLOzone()->CreateOffscreenGLSurface(size);
155 134
156 if (HasDefaultImplementation(GetGLImplementation())) 135 if (HasDefaultImplementation(GetGLImplementation()))
157 return CreateDefaultOffscreenGLSurface(size); 136 return CreateDefaultOffscreenGLSurface(size);
158 137
159 // TODO(kylechar): This is deprecated and can be removed once all Ozone 138 return nullptr;
160 // platforms use GLOzone instead.
161 return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface(
162 GetGLImplementation(), size);
163 } 139 }
164 140
165 } // namespace init 141 } // namespace init
166 } // namespace gl 142 } // namespace gl
OLDNEW
« no previous file with comments | « no previous file | ui/gl/init/gl_initializer_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698