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

Unified Diff: chrome/browser/sync/sessions/sync_session.cc

Issue 6182004: [SYNC] Refactor SyncSourceInfo and add support in chrome invalidation client ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Added util functions Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/sessions/sync_session.cc
===================================================================
--- chrome/browser/sync/sessions/sync_session.cc (revision 71618)
+++ chrome/browser/sync/sessions/sync_session.cc (working copy)
@@ -9,6 +9,40 @@
namespace browser_sync {
namespace sessions {
+void BuildModelTypeMapFromModelTypeBitSet(
+ const syncable::ModelTypeBitSet& types,
+ const std::string& payload,
+ ModelTypeMap* map) {
+ DCHECK(map);
+ for (size_t i = syncable::FIRST_REAL_MODEL_TYPE;
+ i < types.size();
+ ++i) {
+ if (types[i]) {
+ (*map)[syncable::ModelTypeFromInt(i)] = payload;
+ }
+ }
+}
+
+void BuildModelTypeMapFromModelSafeRoutingInfo(
+ const ModelSafeRoutingInfo& routes,
+ const std::string& payload,
+ ModelTypeMap* map) {
+ DCHECK(map);
+ for (ModelSafeRoutingInfo::const_iterator i = routes.begin();
+ i != routes.end();
+ ++i) {
+ (*map)[i->first] = payload;
+ }
+}
+
+SyncSourceInfo::SyncSourceInfo()
+ : updates_source(sync_pb::GetUpdatesCallerInfo::UNKNOWN) {}
+
+SyncSourceInfo::SyncSourceInfo(
+ const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u,
+ const ModelTypeMap& t)
+ : updates_source(u), types(t) {}
+
SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate,
SyncSourceInfo source,
const ModelSafeRoutingInfo& routing_info,
@@ -62,7 +96,7 @@
SyncSourceInfo old_source = source_;
source_ = SyncSourceInfo(
sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION,
- source_.second);
+ source_.types);
return old_source;
}

Powered by Google App Engine
This is Rietveld 408576698