OLD | NEW |
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/callback.h" |
9 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" | 12 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" |
12 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class RunLoop; | 16 class RunLoop; |
16 } | 17 } |
17 | 18 |
18 namespace mojo { | 19 namespace mojo { |
(...skipping 22 matching lines...) Expand all Loading... |
41 // 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 |
42 // refers to the root node. | 43 // refers to the root node. |
43 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); | 44 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); |
44 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); | 45 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); |
45 | 46 |
46 bool OwnsNode(TransportNodeId id) const; | 47 bool OwnsNode(TransportNodeId id) const; |
47 bool OwnsView(TransportViewId id) const; | 48 bool OwnsView(TransportViewId id) const; |
48 | 49 |
49 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); | 50 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); |
50 | 51 |
| 52 void set_changes_acked_callback(const base::Callback<void(void)>& callback) { |
| 53 changes_acked_callback_ = callback; |
| 54 } |
| 55 void ClearChangesAckedCallback() { |
| 56 changes_acked_callback_ = base::Callback<void(void)>(); |
| 57 } |
| 58 |
51 private: | 59 private: |
52 friend class ViewManagerTransaction; | 60 friend class ViewManagerTransaction; |
53 typedef ScopedVector<ViewManagerTransaction> Transactions; | 61 typedef ScopedVector<ViewManagerTransaction> Transactions; |
54 | 62 |
55 // Overridden from IViewManagerClient: | 63 // Overridden from IViewManagerClient: |
56 virtual void OnConnectionEstablished( | 64 virtual void OnConnectionEstablished( |
57 TransportConnectionId connection_id, | 65 TransportConnectionId connection_id, |
58 TransportChangeId next_server_change_id, | 66 TransportChangeId next_server_change_id, |
59 const mojo::Array<INode>& nodes) OVERRIDE; | 67 const mojo::Array<INode>& nodes) OVERRIDE; |
60 virtual void OnServerChangeIdAdvanced( | 68 virtual void OnServerChangeIdAdvanced( |
(...skipping 26 matching lines...) Expand all Loading... |
87 TransportChangeId next_server_change_id_; | 95 TransportChangeId next_server_change_id_; |
88 | 96 |
89 Transactions pending_transactions_; | 97 Transactions pending_transactions_; |
90 | 98 |
91 base::WeakPtrFactory<ViewManagerSynchronizer> sync_factory_; | 99 base::WeakPtrFactory<ViewManagerSynchronizer> sync_factory_; |
92 | 100 |
93 // Non-NULL while blocking on the connection to |service_| during | 101 // Non-NULL while blocking on the connection to |service_| during |
94 // construction. | 102 // construction. |
95 base::RunLoop* init_loop_; | 103 base::RunLoop* init_loop_; |
96 | 104 |
| 105 base::Callback<void(void)> changes_acked_callback_; |
| 106 |
97 IViewManagerPtr service_; | 107 IViewManagerPtr service_; |
98 | 108 |
99 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); | 109 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); |
100 }; | 110 }; |
101 | 111 |
102 } // namespace view_manager | 112 } // namespace view_manager |
103 } // namespace mojo | 113 } // namespace mojo |
104 | 114 |
105 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ | 115 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ |
OLD | NEW |