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

Unified Diff: ui/gl/init/gl_factory_ozone.cc

Issue 2270463002: Add OzoneGLImpl interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/init/gl_factory.h ('k') | ui/gl/init/gl_initializer_ozone.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/init/gl_factory_ozone.cc
diff --git a/ui/gl/init/gl_factory_ozone.cc b/ui/gl/init/gl_factory_ozone.cc
index ca5334707356cade0ecd5d16c21c65cfe6388f12..af7a40dce35935456b021ccee6868939cad459ad 100644
--- a/ui/gl/init/gl_factory_ozone.cc
+++ b/ui/gl/init/gl_factory_ozone.cc
@@ -17,6 +17,7 @@
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/gl_surface_osmesa.h"
#include "ui/gl/gl_surface_stub.h"
+#include "ui/gl/init/ozone_util.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
@@ -25,10 +26,6 @@ namespace init {
namespace {
-ui::SurfaceFactoryOzone* GetSurfaceFactory() {
- return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone();
-}
-
bool HasDefaultImplementation(GLImplementation impl) {
return impl == kGLImplementationOSMesaGL || impl == kGLImplementationMockGL;
}
@@ -63,13 +60,16 @@ scoped_refptr<GLSurface> CreateDefaultOffscreenGLSurface(
} // namespace
std::vector<GLImplementation> GetAllowedGLImplementations() {
- std::vector<GLImplementation> impls;
- impls.push_back(kGLImplementationEGLGLES2);
- impls.push_back(kGLImplementationOSMesaGL);
- return impls;
+ ui::OzonePlatform::InitializeForGPU();
+ return GetSurfaceFactoryOzone()->GetAllowedGLImplementations();
}
bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
+ if (HasGLOzone())
+ return GetGLOzone()->GetGLWindowSystemBindingInfo(info);
+
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
switch (GetGLImplementation()) {
case kGLImplementationEGLGLES2:
return GetGLWindowSystemBindingInfoEGL(info);
@@ -82,6 +82,12 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
GLSurface* compatible_surface,
GpuPreference gpu_preference) {
TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
+
+ if (HasGLOzone()) {
+ return GetGLOzone()->CreateGLContext(share_group, compatible_surface,
+ gpu_preference);
+ }
+
switch (GetGLImplementation()) {
case kGLImplementationMockGL:
return scoped_refptr<GLContext>(new GLContextStub(share_group));
@@ -100,29 +106,44 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
+ if (HasGLOzone())
+ return GetGLOzone()->CreateViewGLSurface(window);
+
if (HasDefaultImplementation(GetGLImplementation()))
return CreateDefaultViewGLSurface(window);
- return GetSurfaceFactory()->CreateViewGLSurface(GetGLImplementation(),
- window);
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
+ return GetSurfaceFactoryOzone()->CreateViewGLSurface(GetGLImplementation(),
+ window);
}
scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
gfx::AcceleratedWidget window) {
TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface");
- return GetSurfaceFactory()->CreateSurfacelessViewGLSurface(
+ if (HasGLOzone())
+ return GetGLOzone()->CreateSurfacelessViewGLSurface(window);
+
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
+ return GetSurfaceFactoryOzone()->CreateSurfacelessViewGLSurface(
GetGLImplementation(), window);
}
scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) {
TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
+ if (HasGLOzone())
+ return GetGLOzone()->CreateOffscreenGLSurface(size);
+
if (HasDefaultImplementation(GetGLImplementation()))
return CreateDefaultOffscreenGLSurface(size);
- return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(),
- size);
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
+ return GetSurfaceFactoryOzone()->CreateOffscreenGLSurface(
+ GetGLImplementation(), size);
}
} // namespace init
« no previous file with comments | « ui/gl/init/gl_factory.h ('k') | ui/gl/init/gl_initializer_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698