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

Side by Side Diff: mojo/services/view_manager/root_node_manager.h

Issue 383763003: Trigger Node destruction notifications from Node's dtor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 | Annotate | Revision Log
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 MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Returns the connection by id. 108 // Returns the connection by id.
109 ViewManagerServiceImpl* GetConnection(ConnectionSpecificId connection_id); 109 ViewManagerServiceImpl* GetConnection(ConnectionSpecificId connection_id);
110 110
111 // Returns the Node identified by |id|. 111 // Returns the Node identified by |id|.
112 Node* GetNode(const NodeId& id); 112 Node* GetNode(const NodeId& id);
113 113
114 // Returns the View identified by |id|. 114 // Returns the View identified by |id|.
115 View* GetView(const ViewId& id); 115 View* GetView(const ViewId& id);
116 116
117 Node* root() { return &root_; } 117 Node* root() { return root_.get(); }
118 118
119 bool IsProcessingChange() const { return current_change_ != NULL; } 119 bool IsProcessingChange() const { return current_change_ != NULL; }
120 120
121 bool is_processing_delete_node() const { 121 bool is_processing_delete_node() const {
122 return current_change_ && current_change_->is_delete_node(); } 122 return current_change_ && current_change_->is_delete_node(); }
123 123
124 // Invoked when a connection messages a client about the change. This is used 124 // Invoked when a connection messages a client about the change. This is used
125 // to avoid sending ServerChangeIdAdvanced() unnecessarily. 125 // to avoid sending ServerChangeIdAdvanced() unnecessarily.
126 void OnConnectionMessagedClient(ConnectionSpecificId id); 126 void OnConnectionMessagedClient(ConnectionSpecificId id);
127 127
128 // Returns true if OnConnectionMessagedClient() was invoked for id. 128 // Returns true if OnConnectionMessagedClient() was invoked for id.
129 bool DidConnectionMessageClient(ConnectionSpecificId id) const; 129 bool DidConnectionMessageClient(ConnectionSpecificId id) const;
130 130
131 ViewManagerServiceImpl* GetConnectionByCreator( 131 ViewManagerServiceImpl* GetConnectionByCreator(
132 ConnectionSpecificId creator_id, 132 ConnectionSpecificId creator_id,
133 const std::string& url) const; 133 const std::string& url) const;
134 134
135 void DispatchViewInputEventToWindowManager(const View* view, 135 void DispatchViewInputEventToWindowManager(const View* view,
136 const ui::Event* event); 136 const ui::Event* event);
137 137
138 // These functions trivially delegate to all ViewManagerServiceImpls, which in 138 // These functions trivially delegate to all ViewManagerServiceImpls, which in
139 // term notify their clients. 139 // term notify their clients.
140 void ProcessNodeDestroyed(Node* node);
140 void ProcessNodeBoundsChanged(const Node* node, 141 void ProcessNodeBoundsChanged(const Node* node,
141 const gfx::Rect& old_bounds, 142 const gfx::Rect& old_bounds,
142 const gfx::Rect& new_bounds); 143 const gfx::Rect& new_bounds);
143 void ProcessNodeHierarchyChanged(const Node* node, 144 void ProcessNodeHierarchyChanged(const Node* node,
144 const Node* new_parent, 145 const Node* new_parent,
145 const Node* old_parent); 146 const Node* old_parent);
146 void ProcessNodeReorder(const Node* node, 147 void ProcessNodeReorder(const Node* node,
147 const Node* relative_node, 148 const Node* relative_node,
148 const OrderDirection direction); 149 const OrderDirection direction);
149 void ProcessNodeViewReplaced(const Node* node, 150 void ProcessNodeViewReplaced(const Node* node,
(...skipping 30 matching lines...) Expand all
180 bool IsChangeSource(ConnectionSpecificId connection_id) const { 181 bool IsChangeSource(ConnectionSpecificId connection_id) const {
181 return current_change_ && current_change_->connection_id() == connection_id; 182 return current_change_ && current_change_->connection_id() == connection_id;
182 } 183 }
183 184
184 // Implementation of the two embed variants. 185 // Implementation of the two embed variants.
185 ViewManagerServiceImpl* EmbedImpl(ConnectionSpecificId creator_id, 186 ViewManagerServiceImpl* EmbedImpl(ConnectionSpecificId creator_id,
186 const String& url, 187 const String& url,
187 const Array<Id>& node_ids); 188 const Array<Id>& node_ids);
188 189
189 // Overridden from NodeDelegate: 190 // Overridden from NodeDelegate:
191 virtual void OnNodeDestroyed(const Node* node) OVERRIDE;
190 virtual void OnNodeHierarchyChanged(const Node* node, 192 virtual void OnNodeHierarchyChanged(const Node* node,
191 const Node* new_parent, 193 const Node* new_parent,
192 const Node* old_parent) OVERRIDE; 194 const Node* old_parent) OVERRIDE;
193 virtual void OnNodeBoundsChanged(const Node* node, 195 virtual void OnNodeBoundsChanged(const Node* node,
194 const gfx::Rect& old_bounds, 196 const gfx::Rect& old_bounds,
195 const gfx::Rect& new_bounds) OVERRIDE; 197 const gfx::Rect& new_bounds) OVERRIDE;
196 virtual void OnNodeViewReplaced(const Node* node, 198 virtual void OnNodeViewReplaced(const Node* node,
197 const View* new_view, 199 const View* new_view,
198 const View* old_view) OVERRIDE; 200 const View* old_view) OVERRIDE;
199 virtual void OnViewInputEvent(const View* view, 201 virtual void OnViewInputEvent(const View* view,
200 const ui::Event* event) OVERRIDE; 202 const ui::Event* event) OVERRIDE;
201 203
202 Context context_; 204 Context context_;
203 205
204 ApplicationConnection* app_connection_; 206 ApplicationConnection* app_connection_;
205 207
206 // ID to use for next ViewManagerServiceImpl. 208 // ID to use for next ViewManagerServiceImpl.
207 ConnectionSpecificId next_connection_id_; 209 ConnectionSpecificId next_connection_id_;
208 210
209 Id next_server_change_id_; 211 Id next_server_change_id_;
210 212
211 // Set of ViewManagerServiceImpls. 213 // Set of ViewManagerServiceImpls.
212 ConnectionMap connection_map_; 214 ConnectionMap connection_map_;
213 215
214 RootViewManager root_view_manager_; 216 RootViewManager root_view_manager_;
215 217
216 // Root node. 218 // Root node.
217 Node root_; 219 scoped_ptr<Node> root_;
218 220
219 // Set of ViewManagerServiceImpls created by way of Connect(). These have to 221 // Set of ViewManagerServiceImpls created by way of Connect(). These have to
220 // be explicitly destroyed. 222 // be explicitly destroyed.
221 std::set<ViewManagerServiceImpl*> connections_created_by_connect_; 223 std::set<ViewManagerServiceImpl*> connections_created_by_connect_;
222 224
223 // If non-null we're processing a change. The ScopedChange is not owned by us 225 // If non-null we're processing a change. The ScopedChange is not owned by us
224 // (it's created on the stack by ViewManagerServiceImpl). 226 // (it's created on the stack by ViewManagerServiceImpl).
225 ScopedChange* current_change_; 227 ScopedChange* current_change_;
226 228
227 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); 229 DISALLOW_COPY_AND_ASSIGN(RootNodeManager);
228 }; 230 };
229 231
230 } // namespace service 232 } // namespace service
231 } // namespace view_manager 233 } // namespace view_manager
232 } // namespace mojo 234 } // namespace mojo
233 235
234 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 236 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/node_delegate.h ('k') | mojo/services/view_manager/root_node_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698