| 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> |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; | 92 virtual void UpdateTextInputState(const ui::TextInputState& state) = 0; |
| 93 virtual void SetImeVisibility(bool visible) = 0; | 93 virtual void SetImeVisibility(bool visible) = 0; |
| 94 | 94 |
| 95 // Returns true if a compositor frame has been submitted but not drawn yet. | 95 // Returns true if a compositor frame has been submitted but not drawn yet. |
| 96 virtual bool IsFramePending() const = 0; | 96 virtual bool IsFramePending() const = 0; |
| 97 | 97 |
| 98 virtual void RequestCopyOfOutput( | 98 virtual void RequestCopyOfOutput( |
| 99 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0; | 99 std::unique_ptr<cc::CopyOutputRequest> output_request) = 0; |
| 100 | 100 |
| 101 virtual int64_t GetDisplayId() const = 0; |
| 102 |
| 101 // Overrides factory for testing. Default (NULL) value indicates regular | 103 // Overrides factory for testing. Default (NULL) value indicates regular |
| 102 // (non-test) environment. | 104 // (non-test) environment. |
| 103 static void set_factory_for_testing(PlatformDisplayFactory* factory) { | 105 static void set_factory_for_testing(PlatformDisplayFactory* factory) { |
| 104 PlatformDisplay::factory_ = factory; | 106 PlatformDisplay::factory_ = factory; |
| 105 } | 107 } |
| 106 | 108 |
| 107 private: | 109 private: |
| 108 // Static factory instance (always NULL for non-test). | 110 // Static factory instance (always NULL for non-test). |
| 109 static PlatformDisplayFactory* factory_; | 111 static PlatformDisplayFactory* factory_; |
| 110 }; | 112 }; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 126 void SetCapture() override; | 128 void SetCapture() override; |
| 127 void ReleaseCapture() override; | 129 void ReleaseCapture() override; |
| 128 void SetCursorById(int32_t cursor) override; | 130 void SetCursorById(int32_t cursor) override; |
| 129 float GetDeviceScaleFactor() override; | 131 float GetDeviceScaleFactor() override; |
| 130 mojom::Rotation GetRotation() override; | 132 mojom::Rotation GetRotation() override; |
| 131 void UpdateTextInputState(const ui::TextInputState& state) override; | 133 void UpdateTextInputState(const ui::TextInputState& state) override; |
| 132 void SetImeVisibility(bool visible) override; | 134 void SetImeVisibility(bool visible) override; |
| 133 bool IsFramePending() const override; | 135 bool IsFramePending() const override; |
| 134 void RequestCopyOfOutput( | 136 void RequestCopyOfOutput( |
| 135 std::unique_ptr<cc::CopyOutputRequest> output_request) override; | 137 std::unique_ptr<cc::CopyOutputRequest> output_request) override; |
| 138 int64_t GetDisplayId() const override; |
| 136 | 139 |
| 137 private: | 140 private: |
| 138 void WantToDraw(); | 141 void WantToDraw(); |
| 139 | 142 |
| 140 // This method initiates a top level redraw of the display. | 143 // This method initiates a top level redraw of the display. |
| 141 // TODO(fsamuel): This should use vblank as a signal rather than a timer | 144 // TODO(fsamuel): This should use vblank as a signal rather than a timer |
| 142 // http://crbug.com/533042 | 145 // http://crbug.com/533042 |
| 143 void Draw(); | 146 void Draw(); |
| 144 | 147 |
| 145 // This is called after cc::Display has completed generating a new frame | 148 // This is called after cc::Display has completed generating a new frame |
| 146 // for the display. TODO(fsamuel): Idle time processing should happen here | 149 // for the display. TODO(fsamuel): Idle time processing should happen here |
| 147 // if there is budget for it. | 150 // if there is budget for it. |
| 148 void DidDraw(cc::SurfaceDrawStatus status); | 151 void DidDraw(cc::SurfaceDrawStatus status); |
| 149 void UpdateMetrics(const gfx::Size& size, float device_scale_factor); | 152 void UpdateMetrics(const gfx::Size& size, float device_scale_factor); |
| 150 std::unique_ptr<cc::CompositorFrame> GenerateCompositorFrame(); | 153 std::unique_ptr<cc::CompositorFrame> GenerateCompositorFrame(); |
| 151 | 154 |
| 152 // ui::PlatformWindowDelegate: | 155 // ui::PlatformWindowDelegate: |
| 153 void OnBoundsChanged(const gfx::Rect& new_bounds) override; | 156 void OnBoundsChanged(const gfx::Rect& new_bounds) override; |
| 154 void OnDamageRect(const gfx::Rect& damaged_region) override; | 157 void OnDamageRect(const gfx::Rect& damaged_region) override; |
| 155 void DispatchEvent(ui::Event* event) override; | 158 void DispatchEvent(ui::Event* event) override; |
| 156 void OnCloseRequest() override; | 159 void OnCloseRequest() override; |
| 157 void OnClosed() override; | 160 void OnClosed() override; |
| 158 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; | 161 void OnWindowStateChanged(ui::PlatformWindowState new_state) override; |
| 159 void OnLostCapture() override; | 162 void OnLostCapture() override; |
| 160 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, | 163 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget, |
| 161 float device_scale_factor) override; | 164 float device_scale_factor) override; |
| 162 void OnAcceleratedWidgetDestroyed() override; | 165 void OnAcceleratedWidgetDestroyed() override; |
| 163 void OnActivationChanged(bool active) override; | 166 void OnActivationChanged(bool active) override; |
| 164 | 167 |
| 168 int64_t display_id_; |
| 169 |
| 165 scoped_refptr<GpuState> gpu_state_; | 170 scoped_refptr<GpuState> gpu_state_; |
| 166 scoped_refptr<SurfacesState> surfaces_state_; | 171 scoped_refptr<SurfacesState> surfaces_state_; |
| 167 PlatformDisplayDelegate* delegate_; | 172 PlatformDisplayDelegate* delegate_; |
| 168 | 173 |
| 169 ViewportMetrics metrics_; | 174 ViewportMetrics metrics_; |
| 170 gfx::Rect dirty_rect_; | 175 gfx::Rect dirty_rect_; |
| 171 base::Timer draw_timer_; | 176 base::Timer draw_timer_; |
| 172 bool frame_pending_; | 177 bool frame_pending_; |
| 173 | 178 |
| 174 std::unique_ptr<DisplayCompositor> display_compositor_; | 179 std::unique_ptr<DisplayCompositor> display_compositor_; |
| 175 std::unique_ptr<ui::PlatformWindow> platform_window_; | 180 std::unique_ptr<ui::PlatformWindow> platform_window_; |
| 176 | 181 |
| 177 #if !defined(OS_ANDROID) | 182 #if !defined(OS_ANDROID) |
| 178 std::unique_ptr<ui::CursorLoader> cursor_loader_; | 183 std::unique_ptr<ui::CursorLoader> cursor_loader_; |
| 179 #endif | 184 #endif |
| 180 | 185 |
| 181 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_; | 186 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_; |
| 182 | 187 |
| 183 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); | 188 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); |
| 184 }; | 189 }; |
| 185 | 190 |
| 186 } // namespace ws | 191 } // namespace ws |
| 187 | 192 |
| 188 } // namespace mus | 193 } // namespace mus |
| 189 | 194 |
| 190 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ | 195 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ |
| OLD | NEW |