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

Side by Side Diff: components/mus/ws/platform_display.h

Issue 1899923002: Basic display management for mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.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 "components/mus/public/interfaces/window_manager.mojom.h" 18 #include "components/mus/public/interfaces/window_manager.mojom.h"
19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" 19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h"
20 #include "components/mus/public/interfaces/window_tree.mojom.h" 20 #include "components/mus/public/interfaces/window_tree.mojom.h"
21 #include "components/mus/ws/platform_display_delegate.h" 21 #include "components/mus/ws/platform_display_delegate.h"
22 #include "components/mus/ws/platform_display_init_params.h" 22 #include "components/mus/ws/platform_display_init_params.h"
23 #include "mojo/public/cpp/bindings/callback.h" 23 #include "mojo/public/cpp/bindings/callback.h"
24 #include "ui/display/types/display_snapshot.h"
25 #include "ui/display/types/native_display_delegate.h"
26 #include "ui/display/types/native_display_observer.h"
24 #include "ui/gfx/geometry/rect.h" 27 #include "ui/gfx/geometry/rect.h"
25 #include "ui/platform_window/platform_window_delegate.h" 28 #include "ui/platform_window/platform_window_delegate.h"
26 29
27 namespace cc { 30 namespace cc {
28 class CompositorFrame; 31 class CompositorFrame;
29 class CopyOutputRequest; 32 class CopyOutputRequest;
30 class SurfaceIdAllocator; 33 class SurfaceIdAllocator;
31 class SurfaceManager; 34 class SurfaceManager;
32 } // namespace cc 35 } // namespace cc
33 36
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 103 }
101 104
102 private: 105 private:
103 // Static factory instance (always NULL for non-test). 106 // Static factory instance (always NULL for non-test).
104 static PlatformDisplayFactory* factory_; 107 static PlatformDisplayFactory* factory_;
105 }; 108 };
106 109
107 // PlatformDisplay implementation that connects to the services necessary to 110 // PlatformDisplay implementation that connects to the services necessary to
108 // actually display. 111 // actually display.
109 class DefaultPlatformDisplay : public PlatformDisplay, 112 class DefaultPlatformDisplay : public PlatformDisplay,
110 public ui::PlatformWindowDelegate { 113 public ui::PlatformWindowDelegate,
114 public ui::NativeDisplayObserver {
111 public: 115 public:
112 explicit DefaultPlatformDisplay(const PlatformDisplayInitParams& init_params); 116 explicit DefaultPlatformDisplay(const PlatformDisplayInitParams& init_params);
113 ~DefaultPlatformDisplay() override; 117 ~DefaultPlatformDisplay() override;
114 118
115 // PlatformDisplay: 119 // PlatformDisplay:
116 void Init(PlatformDisplayDelegate* delegate) override; 120 void Init(PlatformDisplayDelegate* delegate) override;
117 void SchedulePaint(const ServerWindow* window, 121 void SchedulePaint(const ServerWindow* window,
118 const gfx::Rect& bounds) override; 122 const gfx::Rect& bounds) override;
119 void SetViewportSize(const gfx::Size& size) override; 123 void SetViewportSize(const gfx::Size& size) override;
120 void SetTitle(const base::string16& title) override; 124 void SetTitle(const base::string16& title) override;
121 void SetCapture() override; 125 void SetCapture() override;
122 void ReleaseCapture() override; 126 void ReleaseCapture() override;
123 void SetCursorById(int32_t cursor) override; 127 void SetCursorById(int32_t cursor) override;
124 const mojom::ViewportMetrics& GetViewportMetrics() override; 128 const mojom::ViewportMetrics& GetViewportMetrics() override;
125 mojom::Rotation GetRotation() override; 129 mojom::Rotation GetRotation() override;
126 void UpdateTextInputState(const ui::TextInputState& state) override; 130 void UpdateTextInputState(const ui::TextInputState& state) override;
127 void SetImeVisibility(bool visible) override; 131 void SetImeVisibility(bool visible) override;
128 bool IsFramePending() const override; 132 bool IsFramePending() const override;
129 void RequestCopyOfOutput( 133 void RequestCopyOfOutput(
130 scoped_ptr<cc::CopyOutputRequest> output_request) override; 134 scoped_ptr<cc::CopyOutputRequest> output_request) override;
131 135
136 // ui::NativeDisplayObserver:
137 void OnConfigurationChanged() override;
138
139 // Additional display management callbacks.
sky 2016/04/18 21:25:00 Make these private?
rjkroege 2016/04/21 20:19:53 Done.
140 void OnDisplaysAquired(const std::vector<ui::DisplaySnapshot*>& displays);
141 void OnDisplayConfigured(const gfx::Rect& bounds, bool success);
142
132 private: 143 private:
133 void WantToDraw(); 144 void WantToDraw();
134 145
135 // This method initiates a top level redraw of the display. 146 // This method initiates a top level redraw of the display.
136 // TODO(fsamuel): This should use vblank as a signal rather than a timer 147 // TODO(fsamuel): This should use vblank as a signal rather than a timer
137 // http://crbug.com/533042 148 // http://crbug.com/533042
138 void Draw(); 149 void Draw();
139 150
140 // This is called after cc::Display has completed generating a new frame 151 // This is called after cc::Display has completed generating a new frame
141 // for the display. TODO(fsamuel): Idle time processing should happen here 152 // for the display. TODO(fsamuel): Idle time processing should happen here
(...skipping 21 matching lines...) Expand all
163 PlatformDisplayDelegate* delegate_; 174 PlatformDisplayDelegate* delegate_;
164 175
165 mojom::ViewportMetrics metrics_; 176 mojom::ViewportMetrics metrics_;
166 gfx::Rect dirty_rect_; 177 gfx::Rect dirty_rect_;
167 base::Timer draw_timer_; 178 base::Timer draw_timer_;
168 bool frame_pending_; 179 bool frame_pending_;
169 180
170 scoped_ptr<TopLevelDisplayClient> top_level_display_client_; 181 scoped_ptr<TopLevelDisplayClient> top_level_display_client_;
171 scoped_ptr<ui::PlatformWindow> platform_window_; 182 scoped_ptr<ui::PlatformWindow> platform_window_;
172 183
184 // Flags used to keep track of the current state of display configuration.
185 // |is_configuring| is true if configuring the displays and starts false.
186 bool is_configuring_;
187 // If |is_configuring_| is true and another display configuration event
188 // happens, the event is deferred. |should_configure_| is set to true and a
189 // display configuration will be scheduled after the current one finishes.
190 // NB: events are handled once per vblank.
191 bool should_configure_;
192 scoped_ptr<ui::NativeDisplayDelegate> native_display_delegate_;
193
173 #if !defined(OS_ANDROID) 194 #if !defined(OS_ANDROID)
174 scoped_ptr<ui::CursorLoader> cursor_loader_; 195 scoped_ptr<ui::CursorLoader> cursor_loader_;
175 #endif 196 #endif
176 197
177 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_; 198 base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_;
178 199
179 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay); 200 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay);
180 }; 201 };
181 202
182 } // namespace ws 203 } // namespace ws
183 204
184 } // namespace mus 205 } // namespace mus
185 206
186 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_ 207 #endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
OLDNEW
« no previous file with comments | « no previous file | components/mus/ws/platform_display.cc » ('j') | components/mus/ws/platform_display.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698