| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/sync/util/extensions_activity_monitor.h" | 28 #include "chrome/browser/sync/util/extensions_activity_monitor.h" |
| 29 | 29 |
| 30 namespace syncable { | 30 namespace syncable { |
| 31 class WriteTransaction; | 31 class WriteTransaction; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace browser_sync { | 34 namespace browser_sync { |
| 35 class ModelSafeWorker; | 35 class ModelSafeWorker; |
| 36 | 36 |
| 37 namespace sessions { | 37 namespace sessions { |
| 38 typedef std::pair<sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, | |
| 39 syncable::ModelTypeBitSet> SyncSourceInfo; | |
| 40 | 38 |
| 41 class SyncSession { | 39 class SyncSession { |
| 42 public: | 40 public: |
| 43 // The Delegate services events that occur during the session requiring an | 41 // The Delegate services events that occur during the session requiring an |
| 44 // explicit (and session-global) action, as opposed to events that are simply | 42 // explicit (and session-global) action, as opposed to events that are simply |
| 45 // recorded in per-session state. | 43 // recorded in per-session state. |
| 46 class Delegate { | 44 class Delegate { |
| 47 public: | 45 public: |
| 48 // The client was throttled and should cease-and-desist syncing activity | 46 // The client was throttled and should cease-and-desist syncing activity |
| 49 // until the specified time. | 47 // until the specified time. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const std::vector<ModelSafeWorker*>& workers); | 83 const std::vector<ModelSafeWorker*>& workers); |
| 86 ~SyncSession(); | 84 ~SyncSession(); |
| 87 | 85 |
| 88 // Builds a thread-safe and read-only copy of the current session state. | 86 // Builds a thread-safe and read-only copy of the current session state. |
| 89 SyncSessionSnapshot TakeSnapshot() const; | 87 SyncSessionSnapshot TakeSnapshot() const; |
| 90 | 88 |
| 91 // Returns true if this session contains data that should go through the sync | 89 // Returns true if this session contains data that should go through the sync |
| 92 // engine again. | 90 // engine again. |
| 93 bool HasMoreToSync() const; | 91 bool HasMoreToSync() const; |
| 94 | 92 |
| 95 SyncSessionContext* context() { return context_; } | 93 // Collects all state pertaining to how and why |s| originated and unions it |
| 96 Delegate* delegate() { return delegate_; } | 94 // with corresponding state in |this|, leaving |s| unchanged. Allows |this| |
| 95 // to take on the responsibilities |s| had (e.g. certain data types) in the |
| 96 // next SyncShare operation using |this|, rather than needed two separate |
| 97 // sessions. |
| 98 void Coalesce(const SyncSession* s); |
| 99 |
| 100 // Should be called any time |this| is being re-used in a new call to |
| 101 // SyncShare (e.g., HasMoreToSync returned true). |
| 102 void ResetTransientState(); |
| 103 |
| 104 SyncSessionContext* context() const { return context_; } |
| 105 Delegate* delegate() const { return delegate_; } |
| 97 syncable::WriteTransaction* write_transaction() { return write_transaction_; } | 106 syncable::WriteTransaction* write_transaction() { return write_transaction_; } |
| 98 StatusController* status_controller() { return status_controller_.get(); } | 107 StatusController* status_controller() { return status_controller_.get(); } |
| 99 | 108 |
| 100 const ExtensionsActivityMonitor::Records& extensions_activity() const { | 109 const ExtensionsActivityMonitor::Records& extensions_activity() const { |
| 101 return extensions_activity_; | 110 return extensions_activity_; |
| 102 } | 111 } |
| 103 ExtensionsActivityMonitor::Records* mutable_extensions_activity() { | 112 ExtensionsActivityMonitor::Records* mutable_extensions_activity() { |
| 104 return &extensions_activity_; | 113 return &extensions_activity_; |
| 105 } | 114 } |
| 106 | 115 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 172 |
| 164 private: | 173 private: |
| 165 SyncSession* session_; | 174 SyncSession* session_; |
| 166 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); | 175 DISALLOW_COPY_AND_ASSIGN(ScopedSetSessionWriteTransaction); |
| 167 }; | 176 }; |
| 168 | 177 |
| 169 } // namespace sessions | 178 } // namespace sessions |
| 170 } // namespace browser_sync | 179 } // namespace browser_sync |
| 171 | 180 |
| 172 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ | 181 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ |
| OLD | NEW |