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

Side by Side Diff: services/ui/ws/display.h

Issue 2497303002: Fix ws::Display initialization order. (Closed)
Patch Set: Fix method name. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | services/ui/ws/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 SERVICES_UI_WS_DISPLAY_H_ 5 #ifndef SERVICES_UI_WS_DISPLAY_H_
6 #define SERVICES_UI_WS_DISPLAY_H_ 6 #define SERVICES_UI_WS_DISPLAY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Display. 51 // Display.
52 // . without a DisplayBinding. In this mode a WindowManager is automatically 52 // . without a DisplayBinding. In this mode a WindowManager is automatically
53 // created per user. 53 // created per user.
54 class Display : public PlatformDisplayDelegate, 54 class Display : public PlatformDisplayDelegate,
55 public mojom::WindowTreeHost, 55 public mojom::WindowTreeHost,
56 public FocusControllerObserver, 56 public FocusControllerObserver,
57 public FocusControllerDelegate, 57 public FocusControllerDelegate,
58 public UserIdTrackerObserver, 58 public UserIdTrackerObserver,
59 public WindowManagerWindowTreeFactorySetObserver { 59 public WindowManagerWindowTreeFactorySetObserver {
60 public: 60 public:
61 Display(WindowServer* window_server, 61 explicit Display(WindowServer* window_server);
62 const PlatformDisplayInitParams& platform_display_init_params);
63 ~Display() override; 62 ~Display() override;
64 63
65 // Initializes state that depends on the existence of a Display. 64 // Initializes the display root ServerWindow and PlatformDisplay. Adds this to
66 void Init(std::unique_ptr<DisplayBinding> binding); 65 // DisplayManager as a pending display, until accelerated widget is available.
66 void Init(const PlatformDisplayInitParams& init_params,
67 std::unique_ptr<DisplayBinding> binding);
67 68
68 int64_t GetId() const; 69 int64_t GetId() const;
69 70
70 DisplayManager* display_manager(); 71 DisplayManager* display_manager();
71 const DisplayManager* display_manager() const; 72 const DisplayManager* display_manager() const;
72 73
73 PlatformDisplay* platform_display() { return platform_display_.get(); } 74 PlatformDisplay* platform_display() { return platform_display_.get(); }
74 75
75 // Returns a display::Display corresponding to this ws::Display. 76 // Returns a display::Display corresponding to this ws::Display.
76 display::Display ToDisplay() const; 77 display::Display ToDisplay() const;
77 78
78 gfx::Size GetSize() const; 79 gfx::Size GetPixelSize() const;
sky 2016/11/14 21:36:19 Isn't mus going to be entirely pixels? If so, it d
kylechar 2016/11/16 14:29:52 Changed the name back and added a comment. Will wr
79 80
80 WindowServer* window_server() { return window_server_; } 81 WindowServer* window_server() { return window_server_; }
81 82
82 // Returns the root of the Display. The root's children are the roots 83 // Returns the root of the Display. The root's children are the roots
83 // of the corresponding WindowManagers. 84 // of the corresponding WindowManagers.
84 ServerWindow* root_window() { return root_.get(); } 85 ServerWindow* root_window() { return root_.get(); }
85 const ServerWindow* root_window() const { return root_.get(); } 86 const ServerWindow* root_window() const { return root_.get(); }
86 87
87 // Returns the ServerWindow whose id is |id|. This does not do a search over 88 // Returns the ServerWindow whose id is |id|. This does not do a search over
88 // all windows, rather just the display and window manager root windows. 89 // all windows, rather just the display and window manager root windows.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // Updates the size of display root ServerWindow and WM root ServerWindow(s). 141 // Updates the size of display root ServerWindow and WM root ServerWindow(s).
141 void OnViewportMetricsChanged(const display::ViewportMetrics& metrics); 142 void OnViewportMetricsChanged(const display::ViewportMetrics& metrics);
142 143
143 private: 144 private:
144 friend class test::DisplayTestApi; 145 friend class test::DisplayTestApi;
145 146
146 using WindowManagerDisplayRootMap = 147 using WindowManagerDisplayRootMap =
147 std::map<UserId, WindowManagerDisplayRoot*>; 148 std::map<UserId, WindowManagerDisplayRoot*>;
148 149
149 // Inits the necessary state once the display is ready. 150 // Inits the necessary state once the display is ready.
150 void InitWindowManagerDisplayRootsIfNecessary(); 151 void InitWindowManagerDisplayRoots();
151 152
152 // Creates the set of WindowManagerDisplayRoots from the 153 // Creates the set of WindowManagerDisplayRoots from the
153 // WindowManagerWindowTreeFactorySet. 154 // WindowManagerWindowTreeFactorySet.
154 void CreateWindowManagerDisplayRootsFromFactories(); 155 void CreateWindowManagerDisplayRootsFromFactories();
155 156
156 void CreateWindowManagerDisplayRootFromFactory( 157 void CreateWindowManagerDisplayRootFromFactory(
157 WindowManagerWindowTreeFactory* factory); 158 WindowManagerWindowTreeFactory* factory);
158 159
159 // Creates the root ServerWindow for this display, where |size| is in physical 160 // Creates the root ServerWindow for this display, where |size| is in physical
160 // pixels. 161 // pixels.
161 void CreateRootWindow(const gfx::Size& size); 162 void CreateRootWindow(const gfx::Size& size);
162 163
163 // PlatformDisplayDelegate: 164 // PlatformDisplayDelegate:
164 ServerWindow* GetRootWindow() override; 165 ServerWindow* GetRootWindow() override;
166 void OnAcceleratedWidgetAvailable() override;
165 bool IsInHighContrastMode() override; 167 bool IsInHighContrastMode() override;
166 void OnEvent(const ui::Event& event) override; 168 void OnEvent(const ui::Event& event) override;
167 void OnNativeCaptureLost() override; 169 void OnNativeCaptureLost() override;
168 170
169 // FocusControllerDelegate: 171 // FocusControllerDelegate:
170 bool CanHaveActiveChildren(ServerWindow* window) const override; 172 bool CanHaveActiveChildren(ServerWindow* window) const override;
171 173
172 // FocusControllerObserver: 174 // FocusControllerObserver:
173 void OnActivationChanged(ServerWindow* old_active_window, 175 void OnActivationChanged(ServerWindow* old_active_window,
174 ServerWindow* new_active_window) override; 176 ServerWindow* new_active_window) override;
175 void OnFocusChanged(FocusControllerChangeSource change_source, 177 void OnFocusChanged(FocusControllerChangeSource change_source,
176 ServerWindow* old_focused_window, 178 ServerWindow* old_focused_window,
177 ServerWindow* new_focused_window) override; 179 ServerWindow* new_focused_window) override;
178 180
179 // UserIdTrackerObserver: 181 // UserIdTrackerObserver:
180 void OnUserIdRemoved(const UserId& id) override; 182 void OnUserIdRemoved(const UserId& id) override;
181 183
182 // WindowManagerWindowTreeFactorySetObserver: 184 // WindowManagerWindowTreeFactorySetObserver:
183 void OnWindowManagerWindowTreeFactoryReady( 185 void OnWindowManagerWindowTreeFactoryReady(
184 WindowManagerWindowTreeFactory* factory) override; 186 WindowManagerWindowTreeFactory* factory) override;
185 187
186 std::unique_ptr<DisplayBinding> binding_; 188 std::unique_ptr<DisplayBinding> binding_;
187 // Set once Init() has been called.
188 bool init_called_ = false;
189 WindowServer* const window_server_; 189 WindowServer* const window_server_;
190 std::unique_ptr<ServerWindow> root_; 190 std::unique_ptr<ServerWindow> root_;
191 std::unique_ptr<PlatformDisplay> platform_display_; 191 std::unique_ptr<PlatformDisplay> platform_display_;
192 std::unique_ptr<FocusController> focus_controller_; 192 std::unique_ptr<FocusController> focus_controller_;
193 193
194 // The last cursor set. Used to track whether we need to change the cursor. 194 // The last cursor set. Used to track whether we need to change the cursor.
195 mojom::Cursor last_cursor_; 195 mojom::Cursor last_cursor_;
196 196
197 ServerWindowTracker activation_parents_; 197 ServerWindowTracker activation_parents_;
198 198
199 WindowManagerDisplayRootMap window_manager_display_root_map_; 199 WindowManagerDisplayRootMap window_manager_display_root_map_;
200 200
201 DISALLOW_COPY_AND_ASSIGN(Display); 201 DISALLOW_COPY_AND_ASSIGN(Display);
202 }; 202 };
203 203
204 } // namespace ws 204 } // namespace ws
205 } // namespace ui 205 } // namespace ui
206 206
207 #endif // SERVICES_UI_WS_DISPLAY_H_ 207 #endif // SERVICES_UI_WS_DISPLAY_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/ws/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698