| 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/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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); | 49 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 friend class ViewManagerTransaction; | 52 friend class ViewManagerTransaction; |
| 53 typedef ScopedVector<ViewManagerTransaction> Transactions; | 53 typedef ScopedVector<ViewManagerTransaction> Transactions; |
| 54 | 54 |
| 55 // Overridden from IViewManagerClient: | 55 // Overridden from IViewManagerClient: |
| 56 virtual void OnConnectionEstablished( | 56 virtual void OnConnectionEstablished( |
| 57 TransportConnectionId connection_id, | 57 TransportConnectionId connection_id, |
| 58 TransportChangeId next_server_change_id) OVERRIDE; | 58 TransportChangeId next_server_change_id, |
| 59 const mojo::Array<INode>& nodes) OVERRIDE; |
| 60 virtual void OnServerChangeIdAdvanced( |
| 61 uint32_t next_server_change_id) OVERRIDE; |
| 59 virtual void OnNodeHierarchyChanged( | 62 virtual void OnNodeHierarchyChanged( |
| 60 uint32 node_id, | 63 uint32 node_id, |
| 61 uint32 new_parent_id, | 64 uint32 new_parent_id, |
| 62 uint32 old_parent_id, | 65 uint32 old_parent_id, |
| 63 TransportChangeId server_change_id) OVERRIDE; | 66 TransportChangeId server_change_id, |
| 67 const mojo::Array<INode>& nodes) OVERRIDE; |
| 64 virtual void OnNodeDeleted(TransportNodeId node_id, | 68 virtual void OnNodeDeleted(TransportNodeId node_id, |
| 65 TransportChangeId server_change_id) OVERRIDE; | 69 TransportChangeId server_change_id) OVERRIDE; |
| 66 virtual void OnNodeViewReplaced(uint32_t node, | 70 virtual void OnNodeViewReplaced(uint32_t node, |
| 67 uint32_t new_view_id, | 71 uint32_t new_view_id, |
| 68 uint32_t old_view_id) OVERRIDE; | 72 uint32_t old_view_id) OVERRIDE; |
| 69 virtual void OnViewDeleted(uint32_t view_id) OVERRIDE; | 73 virtual void OnViewDeleted(uint32_t view_id) OVERRIDE; |
| 70 | 74 |
| 71 // Sync the client model with the service by enumerating the pending | 75 // Sync the client model with the service by enumerating the pending |
| 72 // transaction queue and applying them in order. | 76 // transaction queue and applying them in order. |
| 73 void Sync(); | 77 void Sync(); |
| 74 | 78 |
| 75 // Removes |transaction| from the pending queue. |transaction| must be at the | 79 // Removes |transaction| from the pending queue. |transaction| must be at the |
| 76 // front of the queue. | 80 // front of the queue. |
| 77 void RemoveFromPendingQueue(ViewManagerTransaction* transaction); | 81 void RemoveFromPendingQueue(ViewManagerTransaction* transaction); |
| 78 | 82 |
| 79 void OnRootTreeReceived(const Array<INode>& data); | |
| 80 | |
| 81 ViewManager* view_manager_; | 83 ViewManager* view_manager_; |
| 82 bool connected_; | 84 bool connected_; |
| 83 TransportConnectionId connection_id_; | 85 TransportConnectionId connection_id_; |
| 84 uint16_t next_id_; | 86 uint16_t next_id_; |
| 85 TransportChangeId next_server_change_id_; | 87 TransportChangeId next_server_change_id_; |
| 86 | 88 |
| 87 Transactions pending_transactions_; | 89 Transactions pending_transactions_; |
| 88 | 90 |
| 89 base::WeakPtrFactory<ViewManagerSynchronizer> sync_factory_; | 91 base::WeakPtrFactory<ViewManagerSynchronizer> sync_factory_; |
| 90 | 92 |
| 91 // Non-NULL while blocking on the connection to |service_| during | 93 // Non-NULL while blocking on the connection to |service_| during |
| 92 // construction. | 94 // construction. |
| 93 base::RunLoop* init_loop_; | 95 base::RunLoop* init_loop_; |
| 94 | 96 |
| 95 IViewManagerPtr service_; | 97 IViewManagerPtr service_; |
| 96 | 98 |
| 97 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); | 99 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 } // namespace view_manager | 102 } // namespace view_manager |
| 101 } // namespace mojo | 103 } // namespace mojo |
| 102 | 104 |
| 103 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ | 105 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ |
| OLD | NEW |