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

Unified Diff: mojo/services/view_manager/view_manager_connection.h

Issue 288313002: Tweaks to ViewManager: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 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 side-by-side diff with in-line comments
Download patch
Index: mojo/services/view_manager/view_manager_connection.h
diff --git a/mojo/services/view_manager/view_manager_connection.h b/mojo/services/view_manager/view_manager_connection.h
index 853012b529fd605a7137200cc15b35fefda0e177..1115372f41c194cde52c2ddbfb4bde8f50d241a5 100644
--- a/mojo/services/view_manager/view_manager_connection.h
+++ b/mojo/services/view_manager/view_manager_connection.h
@@ -6,9 +6,11 @@
#define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_CONNECTION_H_
#include <set>
+#include <vector>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/containers/hash_tables.h"
#include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
#include "mojo/services/view_manager/ids.h"
#include "mojo/services/view_manager/node_delegate.h"
@@ -48,21 +50,28 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection
// Returns the View with the specified id.
View* GetView(const ViewId& id);
- // Notifies the client of a hierarchy change.
- void NotifyNodeHierarchyChanged(const NodeId& node,
- const NodeId& new_parent,
- const NodeId& old_parent,
- TransportChangeId server_change_id);
- void NotifyNodeViewReplaced(const NodeId& node,
- const ViewId& new_view_id,
- const ViewId& old_view_id);
- void NotifyNodeDeleted(const NodeId& node,
- TransportChangeId server_change_id);
- void NotifyViewDeleted(const ViewId& view);
+ // The following methods are invoked after the corresponding change has been
+ // processed. They do the appropriate bookkeeping and update the client as
+ // necessary.
+ // TODO(sky): convert these to take Node*s.
+ void ProcessNodeHierarchyChanged(const NodeId& node_id,
+ const NodeId& new_parent_id,
+ const NodeId& old_parent_id,
+ TransportChangeId server_change_id,
+ bool originated_change);
+ void ProcessNodeViewReplaced(const NodeId& node,
+ const ViewId& new_view_id,
+ const ViewId& old_view_id,
+ bool originated_change);
+ void ProcessNodeDeleted(const NodeId& node,
+ TransportChangeId server_change_id,
+ bool originated_change);
+ void ProcessViewDeleted(const ViewId& view, bool originated_change);
private:
typedef std::map<TransportConnectionSpecificNodeId, Node*> NodeMap;
typedef std::map<TransportConnectionSpecificViewId, View*> ViewMap;
+ typedef base::hash_set<TransportNodeId> NodeIdSet;
// Deletes a node owned by this connection. Returns true on success. |source|
// is the connection that originated the change.
@@ -75,6 +84,18 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection
// Sets the view associated with a node.
bool SetViewImpl(const NodeId& node_id, const ViewId& view_id);
+ // If |node| is known (in |known_nodes_|) does nothing. Otherwise adds |node|
+ // to |nodes|, marks |node| as known and recurses.
+ void GetUnknownNodesFrom(Node* node, std::vector<Node*>* nodes);
+
+ // Returns true if notification should be sent of a hierarchy change. If true
+ // is returned, any nodes that need to be sent to the client are added to
+ // |to_send|.
+ bool ShouldNotifyOnHierarchyChange(const NodeId& node_id,
+ const NodeId& new_parent_id,
+ const NodeId& old_parent_id,
+ std::vector<Node*>* to_send);
+
// Overridden from IViewManager:
virtual void CreateNode(TransportNodeId transport_node_id,
const Callback<void(bool)>& callback) OVERRIDE;
@@ -109,6 +130,7 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection
virtual void OnNodeViewReplaced(const NodeId& node,
const ViewId& new_view_id,
const ViewId& old_view_id) OVERRIDE;
+
RootNodeManager* root_node_manager_;
// Id of this connection as assigned by RootNodeManager. Assigned in
@@ -119,6 +141,9 @@ class MOJO_VIEW_MANAGER_EXPORT ViewManagerConnection
ViewMap view_map_;
+ // The set of nodes that has been communicated to the client.
+ NodeIdSet known_nodes_;
+
DISALLOW_COPY_AND_ASSIGN(ViewManagerConnection);
};
« no previous file with comments | « mojo/services/view_manager/type_converters.cc ('k') | mojo/services/view_manager/view_manager_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698