| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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. A context is accessible via | 6 // components specific to a SyncSession. A context is accessible via |
| 7 // a SyncSession so that session SyncerCommands and parts of the engine have | 7 // a SyncSession so that session SyncerCommands and parts of the engine have |
| 8 // a convenient way to access other parts. In this way it can be thought of as | 8 // a convenient way to access other parts. In this way it can be thought of as |
| 9 // the surrounding environment for the SyncSession. The components of this | 9 // the surrounding environment for the SyncSession. The components of this |
| 10 // environment are either valid or not valid for the entire context lifetime, | 10 // environment are either valid or not valid for the entire context lifetime, |
| 11 // or they are valid for explicitly scoped periods of time by using Scoped | 11 // or they are valid for explicitly scoped periods of time by using Scoped |
| 12 // installation utilities found below. This means that the context assumes no | 12 // installation utilities found below. This means that the context assumes no |
| 13 // ownership whatsoever of any object that was not created by the context | 13 // ownership whatsoever of any object that was not created by the context |
| 14 // itself. | 14 // itself. |
| 15 // | 15 // |
| 16 // It can only be used from the SyncerThread. | 16 // It can only be used from the SyncerThread. |
| 17 | 17 |
| 18 #ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 18 #ifndef SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| 19 #define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 19 #define SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| 20 #pragma once | 20 #pragma once |
| 21 | 21 |
| 22 #include <map> | 22 #include <map> |
| 23 #include <string> | 23 #include <string> |
| 24 | 24 |
| 25 #include "base/gtest_prod_util.h" | 25 #include "base/gtest_prod_util.h" |
| 26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
| 27 #include "base/time.h" | 27 #include "base/time.h" |
| 28 #include "sync/engine/model_safe_worker.h" | 28 #include "sync/engine/model_safe_worker.h" |
| 29 #include "sync/engine/syncer_types.h" | 29 #include "sync/engine/syncer_types.h" |
| 30 #include "sync/engine/sync_engine_event.h" |
| 30 #include "sync/engine/traffic_recorder.h" | 31 #include "sync/engine/traffic_recorder.h" |
| 31 #include "sync/sessions/debug_info_getter.h" | 32 #include "sync/sessions/debug_info_getter.h" |
| 32 | 33 |
| 33 namespace syncable { | 34 namespace syncable { |
| 34 class Directory; | 35 class Directory; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace browser_sync { | 38 namespace browser_sync { |
| 38 | 39 |
| 39 class ConflictResolver; | 40 class ConflictResolver; |
| 40 class ExtensionsActivityMonitor; | 41 class ExtensionsActivityMonitor; |
| 41 class ModelSafeWorkerRegistrar; | 42 class ModelSafeWorkerRegistrar; |
| 42 class ServerConnectionManager; | 43 class ServerConnectionManager; |
| 43 | 44 |
| 44 // Default number of items a client can commit in a single message. | 45 // Default number of items a client can commit in a single message. |
| 45 static const int kDefaultMaxCommitBatchSize = 25; | 46 static const int kDefaultMaxCommitBatchSize = 25; |
| 46 | 47 |
| 47 namespace sessions { | 48 namespace sessions { |
| 48 class ScopedSessionContextConflictResolver; | 49 class ScopedSessionContextConflictResolver; |
| 49 struct SyncSessionSnapshot; | |
| 50 class TestScopedSessionEventListener; | 50 class TestScopedSessionEventListener; |
| 51 | 51 |
| 52 class SyncSessionContext { | 52 class SyncSessionContext { |
| 53 public: | 53 public: |
| 54 SyncSessionContext(ServerConnectionManager* connection_manager, | 54 SyncSessionContext(ServerConnectionManager* connection_manager, |
| 55 syncable::Directory* directory, | 55 syncable::Directory* directory, |
| 56 ModelSafeWorkerRegistrar* model_safe_worker_registrar, | 56 ModelSafeWorkerRegistrar* model_safe_worker_registrar, |
| 57 ExtensionsActivityMonitor* extensions_activity_monitor, | 57 ExtensionsActivityMonitor* extensions_activity_monitor, |
| 58 const std::vector<SyncEngineEventListener*>& listeners, | 58 const std::vector<SyncEngineEventListener*>& listeners, |
| 59 DebugInfoGetter* debug_info_getter, | 59 DebugInfoGetter* debug_info_getter, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // The name of the account being synced. | 165 // The name of the account being synced. |
| 166 std::string account_name_; | 166 std::string account_name_; |
| 167 | 167 |
| 168 // The server limits the number of items a client can commit in one batch. | 168 // The server limits the number of items a client can commit in one batch. |
| 169 int max_commit_batch_size_; | 169 int max_commit_batch_size_; |
| 170 | 170 |
| 171 // Some routing info history to help us clean up types that get disabled | 171 // Some routing info history to help us clean up types that get disabled |
| 172 // by the user. | 172 // by the user. |
| 173 ModelSafeRoutingInfo previous_session_routing_info_; | 173 ModelSafeRoutingInfo previous_session_routing_info_; |
| 174 | 174 |
| 175 // Cache of last session snapshot information. | |
| 176 scoped_ptr<sessions::SyncSessionSnapshot> previous_session_snapshot_; | |
| 177 | |
| 178 // We use this to get debug info to send to the server for debugging | 175 // We use this to get debug info to send to the server for debugging |
| 179 // client behavior on server side. | 176 // client behavior on server side. |
| 180 DebugInfoGetter* const debug_info_getter_; | 177 DebugInfoGetter* const debug_info_getter_; |
| 181 | 178 |
| 182 // This is a map from throttled data types to the time at which they can be | 179 // This is a map from throttled data types to the time at which they can be |
| 183 // unthrottled. | 180 // unthrottled. |
| 184 UnthrottleTimes unthrottle_times_; | 181 UnthrottleTimes unthrottle_times_; |
| 185 | 182 |
| 186 browser_sync::TrafficRecorder* traffic_recorder_; | 183 browser_sync::TrafficRecorder* traffic_recorder_; |
| 187 | 184 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 207 private: | 204 private: |
| 208 SyncSessionContext* context_; | 205 SyncSessionContext* context_; |
| 209 ConflictResolver* resolver_; | 206 ConflictResolver* resolver_; |
| 210 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); | 207 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); |
| 211 }; | 208 }; |
| 212 | 209 |
| 213 } // namespace sessions | 210 } // namespace sessions |
| 214 } // namespace browser_sync | 211 } // namespace browser_sync |
| 215 | 212 |
| 216 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 213 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| OLD | NEW |