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 COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ | 5 #ifndef COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ |
6 #define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ | 6 #define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "cc/surfaces/surface.h" |
18 #include "components/mus/public/interfaces/window_manager.mojom.h" | 19 #include "components/mus/public/interfaces/window_manager.mojom.h" |
19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" | 20 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" |
20 #include "components/mus/public/interfaces/window_tree.mojom.h" | 21 #include "components/mus/public/interfaces/window_tree.mojom.h" |
21 #include "components/mus/ws/platform_display_delegate.h" | 22 #include "components/mus/ws/platform_display_delegate.h" |
22 #include "components/mus/ws/platform_display_init_params.h" | 23 #include "components/mus/ws/platform_display_init_params.h" |
23 #include "mojo/public/cpp/bindings/callback.h" | 24 #include "mojo/public/cpp/bindings/callback.h" |
24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
25 #include "ui/platform_window/platform_window_delegate.h" | 26 #include "ui/platform_window/platform_window_delegate.h" |
26 | 27 |
27 namespace cc { | 28 namespace cc { |
(...skipping 14 matching lines...) Expand all Loading... |
42 namespace ui { | 43 namespace ui { |
43 class CursorLoader; | 44 class CursorLoader; |
44 class PlatformWindow; | 45 class PlatformWindow; |
45 struct TextInputState; | 46 struct TextInputState; |
46 } // namespace ui | 47 } // namespace ui |
47 | 48 |
48 namespace mus { | 49 namespace mus { |
49 | 50 |
50 class GpuState; | 51 class GpuState; |
51 class SurfacesState; | 52 class SurfacesState; |
52 class TopLevelDisplayClient; | 53 class DisplayCompositor; |
53 | 54 |
54 namespace ws { | 55 namespace ws { |
55 | 56 |
56 class EventDispatcher; | 57 class EventDispatcher; |
57 class PlatformDisplayFactory; | 58 class PlatformDisplayFactory; |
58 class ServerWindow; | 59 class ServerWindow; |
59 | 60 |
60 // PlatformDisplay is used to connect the root ServerWindow to a display. | 61 // PlatformDisplay is used to connect the root ServerWindow to a display. |
61 class PlatformDisplay { | 62 class PlatformDisplay { |
62 public: | 63 public: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void WantToDraw(); | 134 void WantToDraw(); |
134 | 135 |
135 // This method initiates a top level redraw of the display. | 136 // This method initiates a top level redraw of the display. |
136 // TODO(fsamuel): This should use vblank as a signal rather than a timer | 137 // TODO(fsamuel): This should use vblank as a signal rather than a timer |
137 // http://crbug.com/533042 | 138 // http://crbug.com/533042 |
138 void Draw(); | 139 void Draw(); |
139 | 140 |
140 // This is called after cc::Display has completed generating a new frame | 141 // This is called after cc::Display has completed generating a new frame |
141 // for the display. TODO(fsamuel): Idle time processing should happen here | 142 // for the display. TODO(fsamuel): Idle time processing should happen here |
142 // if there is budget for it. | 143 // if there is budget for it. |
143 void DidDraw(); | 144 void DidDraw(cc::SurfaceDrawStatus status); |
144 void UpdateMetrics(const gfx::Size& size, float device_pixel_ratio); | 145 void UpdateMetrics(const gfx::Size& size, float device_pixel_ratio); |
145 std::unique_ptr<cc::CompositorFrame> GenerateCompositorFrame(); | 146 std::unique_ptr<cc::CompositorFrame> GenerateCompositorFrame(); |
146 | 147 |
147 // ui::PlatformWindowDelegate: | 148 // ui::PlatformWindowDelegate: |
148 void OnBoundsChanged(const gfx::Rect& new_bounds) override; | 149 void OnBoundsChanged(const gfx::Rect& new_bounds) override; |
149 void OnDamageRect(const gfx::Rect& damaged_region) override; | 150 void OnDamageRect(const gfx::Rect& damaged_region) override; |
150 void DispatchEvent(ui::Event* event) override; | 151 void DispatchEvent(ui::Event* event) override; |
151 void OnCloseRequest() override; | 152 void OnCloseRequest() override; |
152 void OnClosed() override; | 153 void OnClosed() override; |
153 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 154 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
154 void OnLostCapture() override; | 155 void OnLostCapture() override; |
155 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 156 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
156 float device_pixel_ratio) override; | 157 float device_pixel_ratio) override; |
157 void OnAcceleratedWidgetDestroyed() override; | 158 void OnAcceleratedWidgetDestroyed() override; |
158 void OnActivationChanged(bool active) override; | 159 void OnActivationChanged(bool active) override; |
159 | 160 |
160 shell::Connector* connector_; | 161 shell::Connector* connector_; |
161 scoped_refptr<GpuState> gpu_state_; | 162 scoped_refptr<GpuState> gpu_state_; |
162 scoped_refptr<SurfacesState> surfaces_state_; | 163 scoped_refptr<SurfacesState> surfaces_state_; |
163 PlatformDisplayDelegate* delegate_; | 164 PlatformDisplayDelegate* delegate_; |
164 | 165 |
165 mojom::ViewportMetrics metrics_; | 166 mojom::ViewportMetrics metrics_; |
166 gfx::Rect dirty_rect_; | 167 gfx::Rect dirty_rect_; |
167 base::Timer draw_timer_; | 168 base::Timer draw_timer_; |
168 bool frame_pending_; | 169 bool frame_pending_; |
169 | 170 |
170 std::unique_ptr<TopLevelDisplayClient> top_level_display_client_; | 171 std::unique_ptr<DisplayCompositor> display_compositor_; |
171 std::unique_ptr<ui::PlatformWindow> platform_window_; | 172 std::unique_ptr<ui::PlatformWindow> platform_window_; |
172 | 173 |
173 #if !defined(OS_ANDROID) | 174 #if !defined(OS_ANDROID) |
174 std::unique_ptr<ui::CursorLoader> cursor_loader_; | 175 std::unique_ptr<ui::CursorLoader> cursor_loader_; |
175 #endif | 176 #endif |
176 | 177 |
177 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_; | 178 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_; |
178 | 179 |
179 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); | 180 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); |
180 }; | 181 }; |
181 | 182 |
182 } // namespace ws | 183 } // namespace ws |
183 | 184 |
184 } // namespace mus | 185 } // namespace mus |
185 | 186 |
186 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ | 187 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ |
OLD | NEW |