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

Unified Diff: ui/ozone/platform/dri/gbm_surface_factory.cc

Issue 469343003: [Ozone-GBM] Pumb DriWindowDelegate throughout the platform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 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/ozone/platform/dri/gbm_surface_factory.cc
diff --git a/ui/ozone/platform/dri/gbm_surface_factory.cc b/ui/ozone/platform/dri/gbm_surface_factory.cc
index 6e354b8b8a21c25e4808dc4e9a38ea13d4ab24bb..ab2997ad60581836ab67adf298315a2fdaf87073 100644
--- a/ui/ozone/platform/dri/gbm_surface_factory.cc
+++ b/ui/ozone/platform/dri/gbm_surface_factory.cc
@@ -8,6 +8,8 @@
#include "base/files/file_path.h"
#include "third_party/khronos/EGL/egl.h"
+#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
+#include "ui/ozone/platform/dri/dri_window_manager.h"
#include "ui/ozone/platform/dri/gbm_buffer.h"
#include "ui/ozone/platform/dri/gbm_surface.h"
#include "ui/ozone/platform/dri/gbm_surfaceless.h"
@@ -18,18 +20,21 @@
namespace ui {
GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless)
- : DriSurfaceFactory(NULL, NULL),
+ : DriSurfaceFactory(NULL, NULL, NULL),
device_(NULL),
allow_surfaceless_(allow_surfaceless) {
}
GbmSurfaceFactory::~GbmSurfaceFactory() {}
-void GbmSurfaceFactory::InitializeGpu(
- DriWrapper* dri, gbm_device* device, ScreenManager* screen_manager) {
+void GbmSurfaceFactory::InitializeGpu(DriWrapper* dri,
+ gbm_device* device,
+ ScreenManager* screen_manager,
+ DriWindowManager* window_manager) {
drm_ = dri;
device_ = device;
screen_manager_ = screen_manager;
+ window_manager_ = window_manager;
}
intptr_t GbmSurfaceFactory::GetNativeDisplay() {
@@ -95,10 +100,12 @@ bool GbmSurfaceFactory::LoadEGLGLES2Bindings(
scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
DCHECK(state_ == INITIALIZED);
+
+ DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget);
+
ResetCursor(widget);
- scoped_ptr<GbmSurface> surface(new GbmSurface(
- screen_manager_->GetDisplayController(widget), device_, drm_));
+ scoped_ptr<GbmSurface> surface(new GbmSurface(delegate, device_, drm_));
if (!surface->Initialize())
return scoped_ptr<SurfaceOzoneEGL>();
@@ -110,8 +117,9 @@ GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
if (!allow_surfaceless_)
return scoped_ptr<SurfaceOzoneEGL>();
- return scoped_ptr<SurfaceOzoneEGL>(
- new GbmSurfaceless(screen_manager_->GetDisplayController(widget)));
+
+ DriWindowDelegate* delegate = GetOrCreateWindowDelegate(widget);
alexst (slow to review) 2014/08/20 21:51:09 I think this leaks. As far as I can tell looking t
dnicoara 2014/08/21 20:54:17 Arr, yes, I forgot about this through all the refa
+ return scoped_ptr<SurfaceOzoneEGL>(new GbmSurfaceless(delegate));
}
scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
@@ -137,10 +145,11 @@ bool GbmSurfaceFactory::ScheduleOverlayPlane(
LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer.";
return false;
}
- base::WeakPtr<HardwareDisplayController> hdc =
- screen_manager_->GetDisplayController(widget);
+ HardwareDisplayController* hdc =
+ window_manager_->GetWindowDelegate(widget)->GetController();
if (!hdc)
return true;
+
hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(),
plane_z_order,
plane_transform,
@@ -153,4 +162,17 @@ bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
return allow_surfaceless_;
}
+DriWindowDelegate* GbmSurfaceFactory::GetOrCreateWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ if (!window_manager_->HasWindowDelegate(widget)) {
+ DriWindowDelegateImpl* delegate =
+ new DriWindowDelegateImpl(widget, screen_manager_);
+ window_manager_->AddWindowDelegate(widget, delegate);
+ delegate->Initialize();
+ return delegate;
+ }
+
+ return window_manager_->GetWindowDelegate(widget);
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698