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

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: Undo initialization changes. Created 4 years, 4 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
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..acb8e235fd7ee6b00b37f3fc2f6bf1b3f59538f5 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 GetSurfaceFactory()->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,9 +106,14 @@ 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);
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
return GetSurfaceFactory()->CreateViewGLSurface(GetGLImplementation(),
window);
}
@@ -111,6 +122,11 @@ scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
gfx::AcceleratedWidget window) {
TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface");
+ if (HasGLOzone())
+ return GetGLOzone()->CreateSurfacelessViewGLSurface(window);
+
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
return GetSurfaceFactory()->CreateSurfacelessViewGLSurface(
GetGLImplementation(), window);
}
@@ -118,9 +134,14 @@ scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
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);
+ // TODO(kylechar): This is deprecated and can be removed once all Ozone
+ // platforms use GLOzone instead.
return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(),
size);
}

Powered by Google App Engine
This is Rietveld 408576698