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