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

Unified Diff: ui/ozone/platform/dri/dri_window_delegate.h

Issue 981583005: [Ozone-Dri] Merge the DriWindowDelegate with the implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/ozone/platform/dri/dri_surface_unittest.cc ('k') | ui/ozone/platform/dri/dri_window_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/dri_window_delegate.h
diff --git a/ui/ozone/platform/dri/dri_window_delegate.h b/ui/ozone/platform/dri/dri_window_delegate.h
index 75f9d95b93240e1c8cca697d867bbd559c255f92..9868068aa5fc3aa802e94923ae465aafad7126ff 100644
--- a/ui/ozone/platform/dri/dri_window_delegate.h
+++ b/ui/ozone/platform/dri/dri_window_delegate.h
@@ -7,7 +7,12 @@
#include <vector>
+#include "base/timer/timer.h"
+#include "ui/gfx/geometry/point.h"
+#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/native_widget_types.h"
+#include "ui/ozone/ozone_export.h"
+#include "ui/ozone/platform/dri/display_change_observer.h"
class SkBitmap;
@@ -18,52 +23,93 @@ class Rect;
namespace ui {
+class DriBuffer;
+class DrmDeviceManager;
class HardwareDisplayController;
-
-// Interface for the display-server half of a DriWindow.
-//
-// The main implementation of this lives in the process that owns the display
-// connection (usually the GPU process) and associates a platform window
-// (DriWindow) with a display. A window is associated with the display whose
-// bounds contains the window bounds. If there's no suitable display, the window
-// is disconnected and its contents will not be visible.
-//
-// In software mode, this is owned directly on DriWindow because the display
-// controller object is in the same process.
-//
-// In accelerated mode, there's a proxy implementation and calls are forwarded
-// to the real object in the GPU process via IPC.
-class DriWindowDelegate {
+class ScreenManager;
+
+// A delegate of the platform window (DriWindow) on the GPU process. This is
+// used to keep track of window state changes such that each platform window is
+// correctly associated with a display.
+// A window is associated with the display whose bounds contains the window
+// bounds. If there's no suitable display, the window is disconnected and its
+// contents will not be visible.
+class OZONE_EXPORT DriWindowDelegate : public DisplayChangeObserver {
public:
- virtual ~DriWindowDelegate() {}
+ DriWindowDelegate(gfx::AcceleratedWidget widget,
+ DrmDeviceManager* device_manager,
+ ScreenManager* screen_manager);
+
+ ~DriWindowDelegate() override;
- virtual void Initialize() = 0;
+ void Initialize();
- virtual void Shutdown() = 0;
+ void Shutdown();
// Returns the accelerated widget associated with the delegate.
- virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
+ gfx::AcceleratedWidget GetAcceleratedWidget();
// Returns the current controller the window is displaying on. Callers should
// not cache the result as the controller may change as the window is moved.
- virtual HardwareDisplayController* GetController() = 0;
+ HardwareDisplayController* GetController();
// Called when the window is resized/moved.
- virtual void OnBoundsChanged(const gfx::Rect& bounds) = 0;
+ void OnBoundsChanged(const gfx::Rect& bounds);
// Update the HW cursor bitmap & move to specified location. If
// the bitmap is empty, the cursor is hidden.
- virtual void SetCursor(const std::vector<SkBitmap>& bitmaps,
- const gfx::Point& location,
- int frame_delay_ms) = 0;
+ void SetCursor(const std::vector<SkBitmap>& bitmaps,
+ const gfx::Point& location,
+ int frame_delay_ms);
// Update the HW cursor bitmap & move to specified location. If
// the bitmap is empty, the cursor is hidden.
- virtual void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
- const gfx::Point& location) = 0;
+ void SetCursorWithoutAnimations(const std::vector<SkBitmap>& bitmaps,
+ const gfx::Point& location);
// Move the HW cursor to the specified location.
- virtual void MoveCursor(const gfx::Point& location) = 0;
+ void MoveCursor(const gfx::Point& location);
+
+ // DisplayChangeObserver:
+ void OnDisplayChanged(HardwareDisplayController* controller) override;
+ void OnDisplayRemoved(HardwareDisplayController* controller) override;
+
+ private:
+ // Draw the last set cursor & update the cursor plane.
+ void ResetCursor(bool bitmap_only);
+
+ // Draw next frame in an animated cursor.
+ void OnCursorAnimationTimeout();
+
+ void UpdateWidgetToDrmDeviceMapping();
+
+ // When |controller_| changes this is called to reallocate the cursor buffers
+ // since the allocation DRM device may have changed.
+ void UpdateCursorBuffers();
+
+ gfx::AcceleratedWidget widget_;
+
+ DrmDeviceManager* device_manager_; // Not owned.
+ ScreenManager* screen_manager_; // Not owned.
+
+ // The current bounds of the window.
+ gfx::Rect bounds_;
+
+ // The controller associated with the current window. This may be nullptr if
+ // the window isn't over an active display.
+ HardwareDisplayController* controller_;
+
+ base::RepeatingTimer<DriWindowDelegate> cursor_timer_;
+
+ scoped_refptr<DriBuffer> cursor_buffers_[2];
+ int cursor_frontbuffer_;
+
+ std::vector<SkBitmap> cursor_bitmaps_;
+ gfx::Point cursor_location_;
+ int cursor_frame_;
+ int cursor_frame_delay_ms_;
+
+ DISALLOW_COPY_AND_ASSIGN(DriWindowDelegate);
};
} // namespace ui
« no previous file with comments | « ui/ozone/platform/dri/dri_surface_unittest.cc ('k') | ui/ozone/platform/dri/dri_window_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698