Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/sync/sessions/sync_session_context.cc

Issue 9699057: [Sync] Move 'sync' target to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Tim's comments Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/sessions/sync_session_context.h"
6
7 #include "chrome/browser/sync/sessions/debug_info_getter.h"
8 #include "chrome/browser/sync/sessions/session_state.h"
9 #include "chrome/browser/sync/util/extensions_activity_monitor.h"
10
11 namespace browser_sync {
12 namespace sessions {
13
14 SyncSessionContext::SyncSessionContext(
15 ServerConnectionManager* connection_manager,
16 syncable::Directory* directory,
17 ModelSafeWorkerRegistrar* model_safe_worker_registrar,
18 ExtensionsActivityMonitor* extensions_activity_monitor,
19 const std::vector<SyncEngineEventListener*>& listeners,
20 DebugInfoGetter* debug_info_getter)
21 : resolver_(NULL),
22 connection_manager_(connection_manager),
23 directory_(directory),
24 registrar_(model_safe_worker_registrar),
25 extensions_activity_monitor_(extensions_activity_monitor),
26 notifications_enabled_(false),
27 max_commit_batch_size_(kDefaultMaxCommitBatchSize),
28 debug_info_getter_(debug_info_getter) {
29 std::vector<SyncEngineEventListener*>::const_iterator it;
30 for (it = listeners.begin(); it != listeners.end(); ++it)
31 listeners_.AddObserver(*it);
32 }
33
34 SyncSessionContext::SyncSessionContext()
35 : connection_manager_(NULL),
36 directory_(NULL),
37 registrar_(NULL),
38 extensions_activity_monitor_(NULL),
39 debug_info_getter_(NULL) {
40 }
41
42 SyncSessionContext::~SyncSessionContext() {
43 }
44
45 void SyncSessionContext::SetUnthrottleTime(syncable::ModelTypeSet types,
46 const base::TimeTicks& time) {
47 for (syncable::ModelTypeSet::Iterator it = types.First();
48 it.Good(); it.Inc()) {
49 unthrottle_times_[it.Get()] = time;
50 }
51 }
52
53 void SyncSessionContext::PruneUnthrottledTypes(const base::TimeTicks& time) {
54 UnthrottleTimes::iterator it = unthrottle_times_.begin();
55 while (it != unthrottle_times_.end()) {
56 if (it->second <= time) {
57 // Delete and increment the iterator.
58 UnthrottleTimes::iterator iterator_to_delete = it;
59 ++it;
60 unthrottle_times_.erase(iterator_to_delete);
61 } else {
62 // Just increment the iterator.
63 ++it;
64 }
65 }
66 }
67
68 // TODO(lipalani): Call this function and fill the return values in snapshot
69 // so it could be shown in the about:sync page.
70 syncable::ModelTypeSet SyncSessionContext::GetThrottledTypes() const {
71 syncable::ModelTypeSet types;
72 for (UnthrottleTimes::const_iterator it = unthrottle_times_.begin();
73 it != unthrottle_times_.end();
74 ++it) {
75 types.Put(it->first);
76 }
77 return types;
78 }
79
80 } // namespace sessions
81 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/sync_session_context.h ('k') | chrome/browser/sync/sessions/sync_session_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698