| 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 // SyncSessionContext encapsulates the contextual information and engine | 5 // SyncSessionContext encapsulates the contextual information and engine |
| 6 // components specific to a SyncSession. Unlike the SyncSession, the context | 6 // components specific to a SyncSession. Unlike the SyncSession, the context |
| 7 // can be reused across several sync cycles. | 7 // can be reused across several sync cycles. |
| 8 // | 8 // |
| 9 // The context does not take ownership of its pointer members. It's up to | 9 // The context does not take ownership of its pointer members. It's up to |
| 10 // the surrounding classes to ensure those members remain valid while the | 10 // the surrounding classes to ensure those members remain valid while the |
| 11 // context is in use. | 11 // context is in use. |
| 12 // | 12 // |
| 13 // It can only be used from the SyncerThread. | 13 // It can only be used from the SyncerThread. |
| 14 | 14 |
| 15 #ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 15 #ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| 16 #define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 16 #define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| 17 | 17 |
| 18 #include <string> | 18 #include <string> |
| 19 | 19 |
| 20 #include "sync/base/sync_export.h" | 20 #include "sync/base/sync_export.h" |
| 21 #include "sync/engine/sync_engine_event_listener.h" | 21 #include "sync/engine/sync_engine_event_listener.h" |
| 22 #include "sync/engine/traffic_recorder.h" | |
| 23 #include "sync/sessions/debug_info_getter.h" | 22 #include "sync/sessions/debug_info_getter.h" |
| 24 #include "sync/sessions/model_type_registry.h" | 23 #include "sync/sessions/model_type_registry.h" |
| 25 | 24 |
| 26 namespace syncer { | 25 namespace syncer { |
| 27 | 26 |
| 28 class ExtensionsActivity; | 27 class ExtensionsActivity; |
| 29 class ModelTypeRegistry; | 28 class ModelTypeRegistry; |
| 30 class ServerConnectionManager; | 29 class ServerConnectionManager; |
| 31 | 30 |
| 32 namespace syncable { | 31 namespace syncable { |
| 33 class Directory; | 32 class Directory; |
| 34 } | 33 } |
| 35 | 34 |
| 36 // Default number of items a client can commit in a single message. | 35 // Default number of items a client can commit in a single message. |
| 37 static const int kDefaultMaxCommitBatchSize = 25; | 36 static const int kDefaultMaxCommitBatchSize = 25; |
| 38 | 37 |
| 39 namespace sessions { | 38 namespace sessions { |
| 40 class TestScopedSessionEventListener; | 39 class TestScopedSessionEventListener; |
| 41 | 40 |
| 42 class SYNC_EXPORT_PRIVATE SyncSessionContext { | 41 class SYNC_EXPORT_PRIVATE SyncSessionContext { |
| 43 public: | 42 public: |
| 44 SyncSessionContext( | 43 SyncSessionContext( |
| 45 ServerConnectionManager* connection_manager, | 44 ServerConnectionManager* connection_manager, |
| 46 syncable::Directory* directory, | 45 syncable::Directory* directory, |
| 47 ExtensionsActivity* extensions_activity, | 46 ExtensionsActivity* extensions_activity, |
| 48 const std::vector<SyncEngineEventListener*>& listeners, | 47 const std::vector<SyncEngineEventListener*>& listeners, |
| 49 DebugInfoGetter* debug_info_getter, | 48 DebugInfoGetter* debug_info_getter, |
| 50 TrafficRecorder* traffic_recorder, | |
| 51 ModelTypeRegistry* model_type_registry, | 49 ModelTypeRegistry* model_type_registry, |
| 52 bool keystore_encryption_enabled, | 50 bool keystore_encryption_enabled, |
| 53 bool client_enabled_pre_commit_update_avoidance, | 51 bool client_enabled_pre_commit_update_avoidance, |
| 54 const std::string& invalidator_client_id); | 52 const std::string& invalidator_client_id); |
| 55 | 53 |
| 56 ~SyncSessionContext(); | 54 ~SyncSessionContext(); |
| 57 | 55 |
| 58 ServerConnectionManager* connection_manager() { | 56 ServerConnectionManager* connection_manager() { |
| 59 return connection_manager_; | 57 return connection_manager_; |
| 60 } | 58 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 89 | 87 |
| 90 void set_max_commit_batch_size(int batch_size) { | 88 void set_max_commit_batch_size(int batch_size) { |
| 91 max_commit_batch_size_ = batch_size; | 89 max_commit_batch_size_ = batch_size; |
| 92 } | 90 } |
| 93 int32 max_commit_batch_size() const { return max_commit_batch_size_; } | 91 int32 max_commit_batch_size() const { return max_commit_batch_size_; } |
| 94 | 92 |
| 95 ObserverList<SyncEngineEventListener>* listeners() { | 93 ObserverList<SyncEngineEventListener>* listeners() { |
| 96 return &listeners_; | 94 return &listeners_; |
| 97 } | 95 } |
| 98 | 96 |
| 99 TrafficRecorder* traffic_recorder() { | |
| 100 return traffic_recorder_; | |
| 101 } | |
| 102 | |
| 103 bool keystore_encryption_enabled() const { | 97 bool keystore_encryption_enabled() const { |
| 104 return keystore_encryption_enabled_; | 98 return keystore_encryption_enabled_; |
| 105 } | 99 } |
| 106 | 100 |
| 107 void set_hierarchy_conflict_detected(bool value) { | 101 void set_hierarchy_conflict_detected(bool value) { |
| 108 client_status_.set_hierarchy_conflict_detected(value); | 102 client_status_.set_hierarchy_conflict_detected(value); |
| 109 } | 103 } |
| 110 | 104 |
| 111 const sync_pb::ClientStatus& client_status() const { | 105 const sync_pb::ClientStatus& client_status() const { |
| 112 return client_status_; | 106 return client_status_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // The name of the account being synced. | 145 // The name of the account being synced. |
| 152 std::string account_name_; | 146 std::string account_name_; |
| 153 | 147 |
| 154 // The server limits the number of items a client can commit in one batch. | 148 // The server limits the number of items a client can commit in one batch. |
| 155 int max_commit_batch_size_; | 149 int max_commit_batch_size_; |
| 156 | 150 |
| 157 // We use this to get debug info to send to the server for debugging | 151 // We use this to get debug info to send to the server for debugging |
| 158 // client behavior on server side. | 152 // client behavior on server side. |
| 159 DebugInfoGetter* const debug_info_getter_; | 153 DebugInfoGetter* const debug_info_getter_; |
| 160 | 154 |
| 161 TrafficRecorder* traffic_recorder_; | |
| 162 | |
| 163 ModelTypeRegistry* model_type_registry_; | 155 ModelTypeRegistry* model_type_registry_; |
| 164 | 156 |
| 165 // Satus information to be sent up to the server. | 157 // Satus information to be sent up to the server. |
| 166 sync_pb::ClientStatus client_status_; | 158 sync_pb::ClientStatus client_status_; |
| 167 | 159 |
| 168 // Temporary variable while keystore encryption is behind a flag. True if | 160 // Temporary variable while keystore encryption is behind a flag. True if |
| 169 // we should attempt performing keystore encryption related work, false if | 161 // we should attempt performing keystore encryption related work, false if |
| 170 // the experiment is not enabled. | 162 // the experiment is not enabled. |
| 171 bool keystore_encryption_enabled_; | 163 bool keystore_encryption_enabled_; |
| 172 | 164 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 185 // enable the pre-commit update avoidance experiment described above. | 177 // enable the pre-commit update avoidance experiment described above. |
| 186 const bool client_enabled_pre_commit_update_avoidance_; | 178 const bool client_enabled_pre_commit_update_avoidance_; |
| 187 | 179 |
| 188 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); | 180 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); |
| 189 }; | 181 }; |
| 190 | 182 |
| 191 } // namespace sessions | 183 } // namespace sessions |
| 192 } // namespace syncer | 184 } // namespace syncer |
| 193 | 185 |
| 194 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 186 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| OLD | NEW |