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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/display/types/display_snapshot.h" | 9 #include "ui/display/types/display_snapshot.h" |
10 #include "ui/events/platform/platform_event_dispatcher.h" | 10 #include "ui/events/platform/platform_event_dispatcher.h" |
11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
12 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
13 #include "ui/ozone/platform/drm/host/channel_observer.h" | 13 #include "ui/ozone/platform/drm/host/channel_observer.h" |
| 14 #include "ui/ozone/public/gpu_platform_support_host.h" |
14 #include "ui/platform_window/platform_window.h" | 15 #include "ui/platform_window/platform_window.h" |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 | 18 |
18 class DisplayManager; | 19 class DisplayManager; |
19 class DrmCursor; | 20 class DrmCursor; |
20 class DrmGpuPlatformSupportHost; | 21 class DrmGpuPlatformSupportHost; |
21 class DrmGpuWindow; | 22 class DrmGpuWindow; |
22 class DrmWindowHostManager; | 23 class DrmWindowHostManager; |
23 class EventFactoryEvdev; | 24 class EventFactoryEvdev; |
24 | 25 |
25 // Implementation of the platform window. This object and its handle |widget_| | 26 // Implementation of the platform window. This object and its handle |widget_| |
26 // uniquely identify a window. Since the DRI/GBM platform is split into 2 | 27 // uniquely identify a window. Since the DRI/GBM platform is split into 2 |
27 // pieces (Browser process and GPU process), internally we need to make sure the | 28 // pieces (Browser process and GPU process), internally we need to make sure the |
28 // state is synchronized between the 2 processes. | 29 // state is synchronized between the 2 processes. |
29 // | 30 // |
30 // |widget_| is used in both processes to uniquely identify the window. This | 31 // |widget_| is used in both processes to uniquely identify the window. This |
31 // means that any state on the browser side needs to be propagated to the GPU. | 32 // means that any state on the browser side needs to be propagated to the GPU. |
32 // State propagation needs to happen before the state change is acknowledged to | 33 // State propagation needs to happen before the state change is acknowledged to |
33 // |delegate_| as |delegate_| is responsible for initializing the surface | 34 // |delegate_| as |delegate_| is responsible for initializing the surface |
34 // associated with the window (the surface is created on the GPU process). | 35 // associated with the window (the surface is created on the GPU process). |
35 class DrmWindowHost : public PlatformWindow, | 36 class DrmWindowHost : public PlatformWindow, |
36 public PlatformEventDispatcher, | 37 public PlatformEventDispatcher, |
37 public ChannelObserver { | 38 public ChannelObserver, |
| 39 public GpuPlatformSupportHost { |
38 public: | 40 public: |
39 DrmWindowHost(PlatformWindowDelegate* delegate, | 41 DrmWindowHost(PlatformWindowDelegate* delegate, |
40 const gfx::Rect& bounds, | 42 const gfx::Rect& bounds, |
41 DrmGpuPlatformSupportHost* sender, | 43 DrmGpuPlatformSupportHost* sender, |
42 EventFactoryEvdev* event_factory, | 44 EventFactoryEvdev* event_factory, |
43 DrmCursor* cursor, | 45 DrmCursor* cursor, |
44 DrmWindowHostManager* window_manager, | 46 DrmWindowHostManager* window_manager, |
45 DisplayManager* display_manager); | 47 DisplayManager* display_manager); |
46 ~DrmWindowHost() override; | 48 ~DrmWindowHost() override; |
47 | 49 |
(...skipping 20 matching lines...) Expand all Loading... |
68 void ConfineCursorToBounds(const gfx::Rect& bounds) override; | 70 void ConfineCursorToBounds(const gfx::Rect& bounds) override; |
69 | 71 |
70 // PlatformEventDispatcher: | 72 // PlatformEventDispatcher: |
71 bool CanDispatchEvent(const PlatformEvent& event) override; | 73 bool CanDispatchEvent(const PlatformEvent& event) override; |
72 uint32_t DispatchEvent(const PlatformEvent& event) override; | 74 uint32_t DispatchEvent(const PlatformEvent& event) override; |
73 | 75 |
74 // ChannelObserver: | 76 // ChannelObserver: |
75 void OnChannelEstablished() override; | 77 void OnChannelEstablished() override; |
76 void OnChannelDestroyed() override; | 78 void OnChannelDestroyed() override; |
77 | 79 |
| 80 // GpuPlatformSupportHost: |
| 81 void OnChannelEstablished( |
| 82 int host_id, |
| 83 scoped_refptr<base::SingleThreadTaskRunner> send_runner, |
| 84 const base::Callback<void(IPC::Message*)>& send_callback) override; |
| 85 void OnChannelDestroyed(int host_id) override; |
| 86 bool OnMessageReceived(const IPC::Message& message) override; |
| 87 |
| 88 void OnWindowMappingChanged(gfx::AcceleratedWidget widget); |
| 89 |
78 private: | 90 private: |
79 void SendBoundsChange(); | 91 void SendBoundsChange(); |
80 | 92 |
81 PlatformWindowDelegate* delegate_; // Not owned. | 93 PlatformWindowDelegate* delegate_; // Not owned. |
82 DrmGpuPlatformSupportHost* sender_; // Not owned. | 94 DrmGpuPlatformSupportHost* sender_; // Not owned. |
83 EventFactoryEvdev* event_factory_; // Not owned. | 95 EventFactoryEvdev* event_factory_; // Not owned. |
84 DrmCursor* cursor_; // Not owned. | 96 DrmCursor* cursor_; // Not owned. |
85 DrmWindowHostManager* window_manager_; // Not owned. | 97 DrmWindowHostManager* window_manager_; // Not owned. |
86 DisplayManager* display_manager_; // Not owned. | 98 DisplayManager* display_manager_; // Not owned. |
87 | 99 |
88 gfx::Rect bounds_; | 100 gfx::Rect bounds_; |
89 gfx::AcceleratedWidget widget_; | 101 gfx::AcceleratedWidget widget_; |
90 | 102 |
91 gfx::Rect cursor_confined_bounds_; | 103 gfx::Rect cursor_confined_bounds_; |
92 | 104 |
93 DISALLOW_COPY_AND_ASSIGN(DrmWindowHost); | 105 DISALLOW_COPY_AND_ASSIGN(DrmWindowHost); |
94 }; | 106 }; |
95 | 107 |
96 } // namespace ui | 108 } // namespace ui |
97 | 109 |
98 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ | 110 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_WINDOW_HOST_H_ |
OLD | NEW |