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