| 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 #include "sync/sessions/sync_session_context.h" | 5 #include "sync/sessions/sync_session_context.h" |
| 6 | 6 |
| 7 #include "sync/sessions/debug_info_getter.h" | 7 #include "sync/sessions/debug_info_getter.h" |
| 8 #include "sync/sessions/session_state.h" | 8 #include "sync/sessions/session_state.h" |
| 9 #include "sync/util/extensions_activity_monitor.h" | 9 #include "sync/util/extensions_activity_monitor.h" |
| 10 | 10 |
| 11 namespace browser_sync { | 11 namespace browser_sync { |
| 12 namespace sessions { | 12 namespace sessions { |
| 13 | 13 |
| 14 const unsigned int kMaxMessagesToRecord = 10; | |
| 15 const unsigned int kMaxMessageSizeToRecord = 5 * 1024; | |
| 16 | |
| 17 SyncSessionContext::SyncSessionContext( | 14 SyncSessionContext::SyncSessionContext( |
| 18 ServerConnectionManager* connection_manager, | 15 ServerConnectionManager* connection_manager, |
| 19 syncable::Directory* directory, | 16 syncable::Directory* directory, |
| 20 ModelSafeWorkerRegistrar* model_safe_worker_registrar, | 17 ModelSafeWorkerRegistrar* model_safe_worker_registrar, |
| 21 ExtensionsActivityMonitor* extensions_activity_monitor, | 18 ExtensionsActivityMonitor* extensions_activity_monitor, |
| 22 const std::vector<SyncEngineEventListener*>& listeners, | 19 const std::vector<SyncEngineEventListener*>& listeners, |
| 23 DebugInfoGetter* debug_info_getter) | 20 DebugInfoGetter* debug_info_getter, |
| 21 browser_sync::TrafficRecorder* traffic_recorder) |
| 24 : resolver_(NULL), | 22 : resolver_(NULL), |
| 25 connection_manager_(connection_manager), | 23 connection_manager_(connection_manager), |
| 26 directory_(directory), | 24 directory_(directory), |
| 27 registrar_(model_safe_worker_registrar), | 25 registrar_(model_safe_worker_registrar), |
| 28 extensions_activity_monitor_(extensions_activity_monitor), | 26 extensions_activity_monitor_(extensions_activity_monitor), |
| 29 notifications_enabled_(false), | 27 notifications_enabled_(false), |
| 30 max_commit_batch_size_(kDefaultMaxCommitBatchSize), | 28 max_commit_batch_size_(kDefaultMaxCommitBatchSize), |
| 31 debug_info_getter_(debug_info_getter), | 29 debug_info_getter_(debug_info_getter), |
| 32 traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord) { | 30 traffic_recorder_(traffic_recorder) { |
| 33 std::vector<SyncEngineEventListener*>::const_iterator it; | 31 std::vector<SyncEngineEventListener*>::const_iterator it; |
| 34 for (it = listeners.begin(); it != listeners.end(); ++it) | 32 for (it = listeners.begin(); it != listeners.end(); ++it) |
| 35 listeners_.AddObserver(*it); | 33 listeners_.AddObserver(*it); |
| 36 } | 34 } |
| 37 | 35 |
| 38 SyncSessionContext::SyncSessionContext() | 36 SyncSessionContext::SyncSessionContext() |
| 39 : connection_manager_(NULL), | 37 : connection_manager_(NULL), |
| 40 directory_(NULL), | 38 directory_(NULL), |
| 41 registrar_(NULL), | 39 registrar_(NULL), |
| 42 extensions_activity_monitor_(NULL), | 40 extensions_activity_monitor_(NULL), |
| 43 debug_info_getter_(NULL), | 41 debug_info_getter_(NULL), |
| 44 traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord) { | 42 traffic_recorder_(NULL) { |
| 45 } | 43 } |
| 46 | 44 |
| 47 SyncSessionContext::~SyncSessionContext() { | 45 SyncSessionContext::~SyncSessionContext() { |
| 48 } | 46 } |
| 49 | 47 |
| 50 void SyncSessionContext::SetUnthrottleTime(syncable::ModelTypeSet types, | 48 void SyncSessionContext::SetUnthrottleTime(syncable::ModelTypeSet types, |
| 51 const base::TimeTicks& time) { | 49 const base::TimeTicks& time) { |
| 52 for (syncable::ModelTypeSet::Iterator it = types.First(); | 50 for (syncable::ModelTypeSet::Iterator it = types.First(); |
| 53 it.Good(); it.Inc()) { | 51 it.Good(); it.Inc()) { |
| 54 unthrottle_times_[it.Get()] = time; | 52 unthrottle_times_[it.Get()] = time; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 77 for (UnthrottleTimes::const_iterator it = unthrottle_times_.begin(); | 75 for (UnthrottleTimes::const_iterator it = unthrottle_times_.begin(); |
| 78 it != unthrottle_times_.end(); | 76 it != unthrottle_times_.end(); |
| 79 ++it) { | 77 ++it) { |
| 80 types.Put(it->first); | 78 types.Put(it->first); |
| 81 } | 79 } |
| 82 return types; | 80 return types; |
| 83 } | 81 } |
| 84 | 82 |
| 85 } // namespace sessions | 83 } // namespace sessions |
| 86 } // namespace browser_sync | 84 } // namespace browser_sync |
| OLD | NEW |