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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h

Issue 272833002: View synchronization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_ 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_ 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 12 matching lines...) Expand all
23 class ViewManagerTransaction; 23 class ViewManagerTransaction;
24 24
25 // Manages the connection with the View Manager service. 25 // Manages the connection with the View Manager service.
26 class ViewManagerSynchronizer : public IViewManagerClient { 26 class ViewManagerSynchronizer : public IViewManagerClient {
27 public: 27 public:
28 explicit ViewManagerSynchronizer(ViewManager* view_manager); 28 explicit ViewManagerSynchronizer(ViewManager* view_manager);
29 virtual ~ViewManagerSynchronizer(); 29 virtual ~ViewManagerSynchronizer();
30 30
31 bool connected() const { return connected_; } 31 bool connected() const { return connected_; }
32 32
33 // API exposed to the node implementation that pushes local changes to the 33 // API exposed to the node/view implementations that pushes local changes to
34 // service. 34 // the service.
35 TransportNodeId CreateViewTreeNode(); 35 TransportNodeId CreateViewTreeNode();
36 void DestroyViewTreeNode(TransportNodeId node_id); 36 void DestroyViewTreeNode(TransportNodeId node_id);
37 37
38 TransportViewId CreateView();
39 void DestroyView(TransportViewId view_id);
40
38 // These methods take TransportIds. For views owned by the current connection, 41 // These methods take TransportIds. For views owned by the current connection,
39 // the connection id high word can be zero. In all cases, the TransportId 0x1 42 // the connection id high word can be zero. In all cases, the TransportId 0x1
40 // refers to the root node. 43 // refers to the root node.
41 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); 44 void AddChild(TransportNodeId child_id, TransportNodeId parent_id);
42 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); 45 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id);
43 46
44 bool OwnsNode(TransportNodeId id) const; 47 bool OwnsNode(TransportNodeId id) const;
48 bool OwnsView(TransportViewId id) const;
49
50 void SetActiveView(TransportNodeId node_id, TransportViewId view_id);
45 51
46 private: 52 private:
47 friend class ViewManagerTransaction; 53 friend class ViewManagerTransaction;
48 typedef ScopedVector<ViewManagerTransaction> Transactions; 54 typedef ScopedVector<ViewManagerTransaction> Transactions;
49 55
50 // Overridden from IViewManagerClient: 56 // Overridden from IViewManagerClient:
51 virtual void OnConnectionEstablished( 57 virtual void OnConnectionEstablished(
52 TransportConnectionId connection_id, 58 TransportConnectionId connection_id,
53 TransportChangeId next_server_change_id) OVERRIDE; 59 TransportChangeId next_server_change_id) OVERRIDE;
54 virtual void OnNodeHierarchyChanged( 60 virtual void OnNodeHierarchyChanged(
55 uint32 node_id, 61 uint32 node_id,
56 uint32 new_parent_id, 62 uint32 new_parent_id,
57 uint32 old_parent_id, 63 uint32 old_parent_id,
58 TransportChangeId server_change_id, 64 TransportChangeId server_change_id,
59 TransportChangeId client_change_id) OVERRIDE; 65 TransportChangeId client_change_id) OVERRIDE;
60 virtual void OnNodeDeleted(TransportNodeId node_id, 66 virtual void OnNodeDeleted(TransportNodeId node_id,
61 TransportChangeId server_change_id, 67 TransportChangeId server_change_id,
62 TransportChangeId client_change_id) OVERRIDE; 68 TransportChangeId client_change_id) OVERRIDE;
63 virtual void OnNodeViewReplaced(uint32_t node, 69 virtual void OnNodeViewReplaced(uint32_t node,
64 uint32_t new_view_id, 70 uint32_t new_view_id,
65 uint32_t old_view_id, 71 uint32_t old_view_id,
66 TransportChangeId client_change_id) OVERRIDE; 72 TransportChangeId client_change_id) OVERRIDE;
73 virtual void OnViewDeleted(uint32_t node_id,
74 uint32_t server_change_id,
75 uint32_t client_change_id) OVERRIDE;
67 76
68 // Sync the client model with the service by enumerating the pending 77 // Sync the client model with the service by enumerating the pending
69 // transaction queue and applying them in order. 78 // transaction queue and applying them in order.
70 void Sync(); 79 void Sync();
71 80
72 // Used by individual transactions to generate a connection-specific change 81 // Used by individual transactions to generate a connection-specific change
73 // id. 82 // id.
74 // TODO(beng): What happens when there are more than sizeof(int) changes in 83 // TODO(beng): What happens when there are more than sizeof(int) changes in
75 // the queue? 84 // the queue?
76 TransportChangeId GetNextClientChangeId(); 85 TransportChangeId GetNextClientChangeId();
(...skipping 22 matching lines...) Expand all
99 IViewManagerPtr service_; 108 IViewManagerPtr service_;
100 109
101 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); 110 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer);
102 }; 111 };
103 112
104 } // namespace view_manager 113 } // namespace view_manager
105 } // namespace services 114 } // namespace services
106 } // namespace mojo 115 } // namespace mojo
107 116
108 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H _ 117 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698