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

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

Issue 284113008: Cleanup of ViewManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge to trunk Created 6 years, 7 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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 View* GetView(const ViewId& id); 75 View* GetView(const ViewId& id);
76 76
77 Node* root() { return &root_; } 77 Node* root() { return &root_; }
78 78
79 bool IsProcessingChange() const { return change_source_ != 0; } 79 bool IsProcessingChange() const { return change_source_ != 0; }
80 80
81 bool is_processing_delete_node() const { return is_processing_delete_node_; } 81 bool is_processing_delete_node() const { return is_processing_delete_node_; }
82 82
83 // These functions trivially delegate to all ViewManagerConnections, which in 83 // These functions trivially delegate to all ViewManagerConnections, which in
84 // term notify their clients. 84 // term notify their clients.
85 void ProcessNodeHierarchyChanged(const NodeId& node, 85 void ProcessNodeHierarchyChanged(const Node* node,
86 const NodeId& new_parent, 86 const Node* new_parent,
87 const NodeId& old_parent); 87 const Node* old_parent);
88 void ProcessNodeViewReplaced(const NodeId& node, 88 void ProcessNodeViewReplaced(const Node* node,
89 const ViewId& new_view_id, 89 const View* new_view_id,
90 const ViewId& old_view_id); 90 const View* old_view_id);
91 void ProcessNodeDeleted(const NodeId& node); 91 void ProcessNodeDeleted(const NodeId& node);
92 void ProcessViewDeleted(const ViewId& view); 92 void ProcessViewDeleted(const ViewId& view);
93 93
94 private: 94 private:
95 // Used to setup any static state needed by RootNodeManager. 95 // Used to setup any static state needed by RootNodeManager.
96 struct Context { 96 struct Context {
97 Context(); 97 Context();
98 ~Context(); 98 ~Context();
99 }; 99 };
100 100
101 typedef std::map<TransportConnectionId, ViewManagerConnection*> ConnectionMap; 101 typedef std::map<TransportConnectionId, ViewManagerConnection*> ConnectionMap;
102 102
103 // Invoked when a particular connection is about to make a change. 103 // Invoked when a particular connection is about to make a change.
104 // Subsequently followed by FinishChange() once the change is done. 104 // Subsequently followed by FinishChange() once the change is done.
105 // 105 //
106 // Changes should never nest, meaning each PrepareForChange() must be 106 // Changes should never nest, meaning each PrepareForChange() must be
107 // balanced with a call to FinishChange() with no PrepareForChange() 107 // balanced with a call to FinishChange() with no PrepareForChange()
108 // in between. 108 // in between.
109 void PrepareForChange(ViewManagerConnection* connection, bool is_delete_node); 109 void PrepareForChange(ViewManagerConnection* connection, bool is_delete_node);
110 110
111 // Balances a call to PrepareForChange(). 111 // Balances a call to PrepareForChange().
112 void FinishChange(ChangeType change_type); 112 void FinishChange(ChangeType change_type);
113 113
114 // Returns true if the specified connection originated the current change. 114 // Returns true if the specified connection originated the current change.
115 bool IsChangeSource(TransportConnectionId connection_id) const { 115 bool IsChangeSource(TransportConnectionId connection_id) const {
116 return connection_id == change_source_; 116 return connection_id == change_source_;
117 } 117 }
118 118
119 // Overriden from NodeDelegate: 119 // Overriden from NodeDelegate:
120 virtual void OnNodeHierarchyChanged(const NodeId& node, 120 virtual void OnNodeHierarchyChanged(const Node* node,
121 const NodeId& new_parent, 121 const Node* new_parent,
122 const NodeId& old_parent) OVERRIDE; 122 const Node* old_parent) OVERRIDE;
123 virtual void OnNodeViewReplaced(const NodeId& node, 123 virtual void OnNodeViewReplaced(const Node* node,
124 const ViewId& new_view_id, 124 const View* new_view,
125 const ViewId& old_view_id) OVERRIDE; 125 const View* old_view) OVERRIDE;
126 126
127 Context context_; 127 Context context_;
128 128
129 // ID to use for next ViewManagerConnection. 129 // ID to use for next ViewManagerConnection.
130 TransportConnectionId next_connection_id_; 130 TransportConnectionId next_connection_id_;
131 131
132 TransportChangeId next_server_change_id_; 132 TransportChangeId next_server_change_id_;
133 133
134 // Set of ViewManagerConnections. 134 // Set of ViewManagerConnections.
135 ConnectionMap connection_map_; 135 ConnectionMap connection_map_;
(...skipping 10 matching lines...) Expand all
146 Node root_; 146 Node root_;
147 147
148 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); 148 DISALLOW_COPY_AND_ASSIGN(RootNodeManager);
149 }; 149 };
150 150
151 } // namespace service 151 } // namespace service
152 } // namespace view_manager 152 } // namespace view_manager
153 } // namespace mojo 153 } // namespace mojo
154 154
155 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 155 #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