Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 // A class representing an attempt to synchronize the local syncable data | 5 // A class representing an attempt to synchronize the local syncable data |
| 6 // store with a sync server. A SyncSession instance is passed as a stateful | 6 // store with a sync server. A SyncSession instance is passed as a stateful |
| 7 // bundle to and from various SyncerCommands with the goal of converging the | 7 // bundle to and from various SyncerCommands with the goal of converging the |
| 8 // client view of data with that of the server. The commands twiddle with | 8 // client view of data with that of the server. The commands twiddle with |
| 9 // session status in response to events and hiccups along the way, set and | 9 // session status in response to events and hiccups along the way, set and |
| 10 // query session progress with regards to conflict resolution and applying | 10 // query session progress with regards to conflict resolution and applying |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 // will buffer locally. | 97 // will buffer locally. |
| 98 virtual void OnReceivedClientInvalidationHintBufferSize(int size) = 0; | 98 virtual void OnReceivedClientInvalidationHintBufferSize(int size) = 0; |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 virtual ~Delegate() {} | 101 virtual ~Delegate() {} |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 // Build a session without a nudge tracker. Used for poll or configure type | 104 // Build a session without a nudge tracker. Used for poll or configure type |
| 105 // sync cycles. | 105 // sync cycles. |
| 106 static SyncSession* Build(SyncSessionContext* context, | 106 static SyncSession* Build(SyncSessionContext* context, |
| 107 Delegate* delegate, | 107 Delegate* delegate); |
| 108 const SyncSourceInfo& source); | |
| 109 ~SyncSession(); | 108 ~SyncSession(); |
| 110 | 109 |
| 111 // Builds a thread-safe and read-only copy of the current session state. | 110 // Builds a thread-safe and read-only copy of the current session state. |
| 112 SyncSessionSnapshot TakeSnapshot() const; | 111 SyncSessionSnapshot TakeSnapshot() const; |
| 112 SyncSessionSnapshot TakeSnapshot( | |
|
tim (not reviewing)
2013/08/01 17:16:38
Style guide forbids overloading functions. You'll
rlarocque
2013/08/01 21:01:41
I renamed the second to TakeSnapshotWithSource.
| |
| 113 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource legacy_updates_source) | |
| 114 const; | |
| 113 | 115 |
| 114 // Builds and sends a snapshot to the session context's listeners. | 116 // Builds and sends a snapshot to the session context's listeners. |
| 117 void SendSyncCycleEndEventNotification( | |
| 118 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | |
|
tim (not reviewing)
2013/08/01 17:16:38
nit- indent.
rlarocque
2013/08/01 21:01:41
Done.
| |
| 115 void SendEventNotification(SyncEngineEvent::EventCause cause); | 119 void SendEventNotification(SyncEngineEvent::EventCause cause); |
| 116 | 120 |
| 117 // TODO(akalin): Split this into context() and mutable_context(). | 121 // TODO(akalin): Split this into context() and mutable_context(). |
| 118 SyncSessionContext* context() const { return context_; } | 122 SyncSessionContext* context() const { return context_; } |
| 119 Delegate* delegate() const { return delegate_; } | 123 Delegate* delegate() const { return delegate_; } |
| 120 const StatusController& status_controller() const { | 124 const StatusController& status_controller() const { |
| 121 return *status_controller_.get(); | 125 return *status_controller_.get(); |
| 122 } | 126 } |
| 123 StatusController* mutable_status_controller() { | 127 StatusController* mutable_status_controller() { |
| 124 return status_controller_.get(); | 128 return status_controller_.get(); |
| 125 } | 129 } |
| 126 | 130 |
| 127 const SyncSourceInfo& source() const { return source_; } | |
| 128 | |
| 129 private: | 131 private: |
| 130 SyncSession(SyncSessionContext* context, | 132 SyncSession(SyncSessionContext* context, |
| 131 Delegate* delegate, | 133 Delegate* delegate); |
|
tim (not reviewing)
2013/08/01 17:16:38
does this fit on line above?
rlarocque
2013/08/01 21:01:41
Done.
| |
| 132 const SyncSourceInfo& source); | |
| 133 | 134 |
| 134 // The context for this session, guaranteed to outlive |this|. | 135 // The context for this session, guaranteed to outlive |this|. |
| 135 SyncSessionContext* const context_; | 136 SyncSessionContext* const context_; |
| 136 | 137 |
| 137 // The source for initiating this sync session. | |
| 138 SyncSourceInfo source_; | |
| 139 | |
| 140 // The delegate for this session, must never be NULL. | 138 // The delegate for this session, must never be NULL. |
| 141 Delegate* const delegate_; | 139 Delegate* const delegate_; |
| 142 | 140 |
| 143 // Our controller for various status and error counters. | 141 // Our controller for various status and error counters. |
| 144 scoped_ptr<StatusController> status_controller_; | 142 scoped_ptr<StatusController> status_controller_; |
| 145 | 143 |
| 146 DISALLOW_COPY_AND_ASSIGN(SyncSession); | 144 DISALLOW_COPY_AND_ASSIGN(SyncSession); |
| 147 }; | 145 }; |
| 148 | 146 |
| 149 } // namespace sessions | 147 } // namespace sessions |
| 150 } // namespace syncer | 148 } // namespace syncer |
| 151 | 149 |
| 152 #endif // SYNC_SESSIONS_SYNC_SESSION_H_ | 150 #endif // SYNC_SESSIONS_SYNC_SESSION_H_ |
| OLD | NEW |