| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "ui/display/types/display_snapshot.h" | 12 #include "ui/display/types/display_snapshot.h" |
| 13 #include "ui/events/platform/platform_event_dispatcher.h" | 13 #include "ui/events/platform/platform_event_dispatcher.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/ozone/platform/drm/host/gpu_thread_observer.h" | 16 #include "ui/ozone/platform/drm/host/gpu_thread_observer.h" |
| 17 #include "ui/platform_window/platform_window.h" | 17 #include "ui/platform_window/platform_window.h" |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 class DrmDisplayHostManager; | 21 class DrmDisplayHostManager; |
| 22 class DrmCursor; | 22 class DrmCursor; |
| 23 class DrmGpuPlatformSupportHost; | |
| 24 class DrmGpuWindow; | 23 class DrmGpuWindow; |
| 25 class DrmOverlayManager; | 24 class DrmOverlayManager; |
| 26 class DrmWindowHostManager; | 25 class DrmWindowHostManager; |
| 27 class EventFactoryEvdev; | 26 class EventFactoryEvdev; |
| 27 class GpuThreadAdapter; |
| 28 | 28 |
| 29 // Implementation of the platform window. This object and its handle |widget_| | 29 // Implementation of the platform window. This object and its handle |widget_| |
| 30 // uniquely identify a window. Since the DRI/GBM platform is split into 2 | 30 // uniquely identify a window. Since the DRI/GBM platform is split into 2 |
| 31 // pieces (Browser process and GPU process), internally we need to make sure the | 31 // pieces (Browser process and GPU process), internally we need to make sure the |
| 32 // state is synchronized between the 2 processes. | 32 // state is synchronized between the 2 processes. |
| 33 // | 33 // |
| 34 // |widget_| is used in both processes to uniquely identify the window. This | 34 // |widget_| is used in both processes to uniquely identify the window. This |
| 35 // means that any state on the browser side needs to be propagated to the GPU. | 35 // means that any state on the browser side needs to be propagated to the GPU. |
| 36 // State propagation needs to happen before the state change is acknowledged to | 36 // State propagation needs to happen before the state change is acknowledged to |
| 37 // |delegate_| as |delegate_| is responsible for initializing the surface | 37 // |delegate_| as |delegate_| is responsible for initializing the surface |
| 38 // associated with the window (the surface is created on the GPU process). | 38 // associated with the window (the surface is created on the GPU process). |
| 39 class DrmWindowHost : public PlatformWindow, | 39 class DrmWindowHost : public PlatformWindow, |
| 40 public PlatformEventDispatcher, | 40 public PlatformEventDispatcher, |
| 41 public GpuThreadObserver { | 41 public GpuThreadObserver { |
| 42 public: | 42 public: |
| 43 DrmWindowHost(PlatformWindowDelegate* delegate, | 43 DrmWindowHost(PlatformWindowDelegate* delegate, |
| 44 const gfx::Rect& bounds, | 44 const gfx::Rect& bounds, |
| 45 DrmGpuPlatformSupportHost* sender, | 45 GpuThreadAdapter* sender, |
| 46 EventFactoryEvdev* event_factory, | 46 EventFactoryEvdev* event_factory, |
| 47 DrmCursor* cursor, | 47 DrmCursor* cursor, |
| 48 DrmWindowHostManager* window_manager, | 48 DrmWindowHostManager* window_manager, |
| 49 DrmDisplayHostManager* display_manager, | 49 DrmDisplayHostManager* display_manager, |
| 50 DrmOverlayManager* overlay_manager); | 50 DrmOverlayManager* overlay_manager); |
| 51 ~DrmWindowHost() override; | 51 ~DrmWindowHost() override; |
| 52 | 52 |
| 53 void Initialize(); | 53 void Initialize(); |
| 54 | 54 |
| 55 gfx::AcceleratedWidget GetAcceleratedWidget(); | 55 gfx::AcceleratedWidget GetAcceleratedWidget(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 71 void Restore() override; | 71 void Restore() override; |
| 72 void SetCursor(PlatformCursor cursor) override; | 72 void SetCursor(PlatformCursor cursor) override; |
| 73 void MoveCursorTo(const gfx::Point& location) override; | 73 void MoveCursorTo(const gfx::Point& location) override; |
| 74 void ConfineCursorToBounds(const gfx::Rect& bounds) override; | 74 void ConfineCursorToBounds(const gfx::Rect& bounds) override; |
| 75 PlatformImeController* GetPlatformImeController() override; | 75 PlatformImeController* GetPlatformImeController() override; |
| 76 | 76 |
| 77 // PlatformEventDispatcher: | 77 // PlatformEventDispatcher: |
| 78 bool CanDispatchEvent(const PlatformEvent& event) override; | 78 bool CanDispatchEvent(const PlatformEvent& event) override; |
| 79 uint32_t DispatchEvent(const PlatformEvent& event) override; | 79 uint32_t DispatchEvent(const PlatformEvent& event) override; |
| 80 | 80 |
| 81 // ChannelObserver: | 81 // GpuThreadObserver: |
| 82 void OnGpuThreadReady() override; | 82 void OnGpuThreadReady() override; |
| 83 void OnGpuThreadRetired() override; | 83 void OnGpuThreadRetired() override; |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 void SendBoundsChange(); | 86 void SendBoundsChange(); |
| 87 | 87 |
| 88 PlatformWindowDelegate* delegate_; // Not owned. | 88 PlatformWindowDelegate* delegate_; // Not owned. |
| 89 DrmGpuPlatformSupportHost* sender_; // Not owned. | 89 GpuThreadAdapter* sender_; // Not owned. |
| 90 EventFactoryEvdev* event_factory_; // Not owned. | 90 EventFactoryEvdev* event_factory_; // Not owned. |
| 91 DrmCursor* cursor_; // Not owned. | 91 DrmCursor* cursor_; // Not owned. |
| 92 DrmWindowHostManager* window_manager_; // Not owned. | 92 DrmWindowHostManager* window_manager_; // Not owned. |
| 93 DrmDisplayHostManager* display_manager_; // Not owned. | 93 DrmDisplayHostManager* display_manager_; // Not owned. |
| 94 DrmOverlayManager* overlay_manager_; // Not owned. | 94 DrmOverlayManager* overlay_manager_; // Not owned. |
| 95 | 95 |
| 96 gfx::Rect bounds_; | 96 gfx::Rect bounds_; |
| 97 gfx::AcceleratedWidget widget_; | 97 gfx::AcceleratedWidget widget_; |
| 98 | 98 |
| 99 gfx::Rect cursor_confined_bounds_; | 99 gfx::Rect cursor_confined_bounds_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(DrmWindowHost); | 101 DISALLOW_COPY_AND_ASSIGN(DrmWindowHost); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace ui | 104 } // namespace ui |
| 105 | 105 |
| 106 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ | 106 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ |
| OLD | NEW |