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

Unified Diff: ui/gl/gl_surface_ozone.cc

Issue 1171513002: Reland of Revert of ozone: Remove singleton pattern for SurfaceFactoryOzone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/gl_surface_ozone.cc
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
index 3b2e76a05765dfacc60ce1c6e893c9ec119bb27d..c7783588ddf87159ea7824c081ee0672d8623293 100644
--- a/ui/gl/gl_surface_ozone.cc
+++ b/ui/gl/gl_surface_ozone.cc
@@ -23,6 +23,7 @@
#include "ui/gl/scoped_binders.h"
#include "ui/gl/scoped_make_current.h"
#include "ui/ozone/public/native_pixmap.h"
+#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
#include "ui/ozone/public/surface_ozone_egl.h"
@@ -118,7 +119,8 @@ bool GLSurfaceOzoneEGL::ReinitializeNativeSurface() {
}
Destroy();
- ozone_surface_ = ui::SurfaceFactoryOzone::GetInstance()
+ ozone_surface_ = ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
->CreateEGLSurfaceForWidget(widget_)
.Pass();
if (!ozone_surface_) {
@@ -478,8 +480,10 @@ bool GLSurfaceOzoneSurfacelessSurfaceImpl::SurfaceImage::ScheduleOverlayPlane(
gfx::OverlayTransform transform,
const gfx::Rect& bounds_rect,
const gfx::RectF& crop_rect) {
- return ui::SurfaceFactoryOzone::GetInstance()->ScheduleOverlayPlane(
- widget, z_order, transform, pixmap_, bounds_rect, crop_rect);
+ return ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->ScheduleOverlayPlane(widget, z_order, transform, pixmap_, bounds_rect,
+ crop_rect);
}
GLSurfaceOzoneSurfacelessSurfaceImpl::SurfaceImage::~SurfaceImage() {
@@ -584,9 +588,11 @@ bool GLSurfaceOzoneSurfacelessSurfaceImpl::CreatePixmaps() {
return true;
for (size_t i = 0; i < arraysize(textures_); i++) {
scoped_refptr<ui::NativePixmap> pixmap =
- ui::SurfaceFactoryOzone::GetInstance()->CreateNativePixmap(
- widget_, GetSize(), ui::SurfaceFactoryOzone::BGRA_8888,
- ui::SurfaceFactoryOzone::SCANOUT);
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->CreateNativePixmap(widget_, GetSize(),
+ ui::SurfaceFactoryOzone::BGRA_8888,
+ ui::SurfaceFactoryOzone::SCANOUT);
if (!pixmap)
return false;
scoped_refptr<SurfaceImage> image =
@@ -628,9 +634,12 @@ scoped_refptr<GLSurface> GLSurface::CreateSurfacelessViewGLSurface(
if (GetGLImplementation() == kGLImplementationEGLGLES2 &&
window != kNullAcceleratedWidget &&
GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
- ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) {
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->CanShowPrimaryPlaneAsOverlay()) {
scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone =
- ui::SurfaceFactoryOzone::GetInstance()
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
->CreateSurfacelessEGLSurfaceForWidget(window);
if (!surface_ozone)
return nullptr;
@@ -656,10 +665,12 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
if (window != kNullAcceleratedWidget) {
scoped_refptr<GLSurface> surface;
if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
- ui::SurfaceFactoryOzone::GetInstance()
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
->CanShowPrimaryPlaneAsOverlay()) {
scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone =
- ui::SurfaceFactoryOzone::GetInstance()
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
->CreateSurfacelessEGLSurfaceForWidget(window);
if (!surface_ozone)
return NULL;
@@ -667,8 +678,9 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
window);
} else {
scoped_ptr<ui::SurfaceOzoneEGL> surface_ozone =
- ui::SurfaceFactoryOzone::GetInstance()->CreateEGLSurfaceForWidget(
- window);
+ ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->CreateEGLSurfaceForWidget(window);
if (!surface_ozone)
return NULL;
@@ -718,7 +730,9 @@ scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
}
EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
- return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay();
+ return ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->GetNativeDisplay();
}
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698