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

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

Issue 1764483003: Changes ownership of ClientConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « components/mus/ws/client_connection.cc ('k') | components/mus/ws/connection_manager.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 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_CONNECTION_MANAGER_H_ 5 #ifndef COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
6 #define COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_ 6 #define COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 ServerWindow* CreateServerWindow( 81 ServerWindow* CreateServerWindow(
82 const WindowId& id, 82 const WindowId& id,
83 const std::map<std::string, std::vector<uint8_t>>& properties); 83 const std::map<std::string, std::vector<uint8_t>>& properties);
84 84
85 // Returns the id for the next WindowTreeImpl. 85 // Returns the id for the next WindowTreeImpl.
86 ConnectionSpecificId GetAndAdvanceNextConnectionId(); 86 ConnectionSpecificId GetAndAdvanceNextConnectionId();
87 87
88 // Returns the id for the next WindowTreeHostImpl. 88 // Returns the id for the next WindowTreeHostImpl.
89 uint16_t GetAndAdvanceNextHostId(); 89 uint16_t GetAndAdvanceNextHostId();
90 90
91 // Invoked when a WindowTreeImpl's connection encounters an error.
92 void OnConnectionError(ClientConnection* connection);
93
94 ClientConnection* GetClientConnection(WindowTreeImpl* window_tree);
95
96 // See description of WindowTree::Embed() for details. This assumes 91 // See description of WindowTree::Embed() for details. This assumes
97 // |transport_window_id| is valid. 92 // |transport_window_id| is valid.
98 WindowTreeImpl* EmbedAtWindow(ServerWindow* root, 93 WindowTreeImpl* EmbedAtWindow(ServerWindow* root,
99 uint32_t policy_bitmask, 94 uint32_t policy_bitmask,
100 mojom::WindowTreeClientPtr client); 95 mojom::WindowTreeClientPtr client);
101 96
102 // Adds |connection| to internal maps. 97 // Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to
103 void AddConnection(scoped_ptr<ClientConnection> owned_connection, 98 // destroy the tree.
104 mojom::WindowTreePtr tree_ptr); 99 WindowTreeImpl* AddTree(scoped_ptr<WindowTreeImpl> tree_impl_ptr,
100 scoped_ptr<ClientConnection> connection,
101 mojom::WindowTreePtr tree_ptr);
102 WindowTreeImpl* CreateTreeForWindowManager(
103 WindowTreeHostImpl* host,
104 mojom::WindowManagerFactory* factory,
105 ServerWindow* root);
106 // Invoked when a WindowTreeImpl's connection encounters an error.
107 void DestroyTree(WindowTreeImpl* tree);
105 108
106 // Returns the connection by id. 109 // Returns the connection by id.
107 WindowTreeImpl* GetConnection(ConnectionSpecificId connection_id); 110 WindowTreeImpl* GetConnection(ConnectionSpecificId connection_id);
108 111
109 // Returns the Window identified by |id|. 112 // Returns the Window identified by |id|.
110 ServerWindow* GetWindow(const WindowId& id); 113 ServerWindow* GetWindow(const WindowId& id);
111 114
112 // Schedules a paint for the specified region in the coordinates of |window|. 115 // Schedules a paint for the specified region in the coordinates of |window|.
113 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds); 116 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds);
114 117
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const ServerWindow* relative_window, 216 const ServerWindow* relative_window,
214 const mojom::OrderDirection direction); 217 const mojom::OrderDirection direction);
215 void ProcessWindowDeleted(const ServerWindow* window); 218 void ProcessWindowDeleted(const ServerWindow* window);
216 void ProcessWillChangeWindowPredefinedCursor(ServerWindow* window, 219 void ProcessWillChangeWindowPredefinedCursor(ServerWindow* window,
217 int32_t cursor_id); 220 int32_t cursor_id);
218 void ProcessFrameDecorationValuesChanged(WindowTreeHostImpl* host); 221 void ProcessFrameDecorationValuesChanged(WindowTreeHostImpl* host);
219 222
220 private: 223 private:
221 friend class Operation; 224 friend class Operation;
222 225
223 using ConnectionMap = std::map<ConnectionSpecificId, ClientConnection*>; 226 using WindowTreeMap =
227 std::map<ConnectionSpecificId, scoped_ptr<WindowTreeImpl>>;
224 using HostConnectionMap = 228 using HostConnectionMap =
225 std::map<WindowTreeHostImpl*, WindowTreeHostConnection*>; 229 std::map<WindowTreeHostImpl*, WindowTreeHostConnection*>;
226 230
227 struct InFlightWindowManagerChange { 231 struct InFlightWindowManagerChange {
228 // Identifies the client that initiated the change. 232 // Identifies the client that initiated the change.
229 ConnectionSpecificId connection_id; 233 ConnectionSpecificId connection_id;
230 234
231 // Change id supplied by the client. 235 // Change id supplied by the client.
232 uint32_t client_change_id; 236 uint32_t client_change_id;
233 }; 237 };
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // State for rendering into a Surface. 320 // State for rendering into a Surface.
317 scoped_refptr<mus::SurfacesState> surfaces_state_; 321 scoped_refptr<mus::SurfacesState> surfaces_state_;
318 322
319 // ID to use for next WindowTreeImpl. 323 // ID to use for next WindowTreeImpl.
320 ConnectionSpecificId next_connection_id_; 324 ConnectionSpecificId next_connection_id_;
321 325
322 // ID to use for next WindowTreeHostImpl. 326 // ID to use for next WindowTreeHostImpl.
323 uint16_t next_host_id_; 327 uint16_t next_host_id_;
324 328
325 // Set of WindowTreeImpls. 329 // Set of WindowTreeImpls.
326 ConnectionMap connection_map_; 330 WindowTreeMap tree_map_;
327 331
328 // WindowTreeHostImpls are initially added to |pending_hosts_|. When the 332 // WindowTreeHostImpls are initially added to |pending_hosts_|. When the
329 // display is initialized it is moved to |hosts_|. 333 // display is initialized it is moved to |hosts_|.
330 // ConnectionManager owns the WindowTreeHostImpls. 334 // ConnectionManager owns the WindowTreeHostImpls.
331 std::set<WindowTreeHostImpl*> pending_hosts_; 335 std::set<WindowTreeHostImpl*> pending_hosts_;
332 std::set<WindowTreeHostImpl*> hosts_; 336 std::set<WindowTreeHostImpl*> hosts_;
333 337
334 // If non-null then we're processing a client operation. The Operation is 338 // If non-null then we're processing a client operation. The Operation is
335 // not owned by us (it's created on the stack by WindowTreeImpl). 339 // not owned by us (it's created on the stack by WindowTreeImpl).
336 Operation* current_operation_; 340 Operation* current_operation_;
(...skipping 17 matching lines...) Expand all
354 358
355 WindowManagerFactoryRegistry window_manager_factory_registry_; 359 WindowManagerFactoryRegistry window_manager_factory_registry_;
356 360
357 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); 361 DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
358 }; 362 };
359 363
360 } // namespace ws 364 } // namespace ws
361 } // namespace mus 365 } // namespace mus
362 366
363 #endif // COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_ 367 #endif // COMPONENTS_MUS_WS_CONNECTION_MANAGER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/client_connection.cc ('k') | components/mus/ws/connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698