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

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

Issue 6182004: [SYNC] Refactor SyncSourceInfo and add support in chrome invalidation client ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Feedback 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.h
===================================================================
--- chrome/browser/sync/sessions/sync_session.h (revision 71618)
+++ chrome/browser/sync/sessions/sync_session.h (working copy)
@@ -15,16 +15,20 @@
#define CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_
#pragma once
+#include <map>
+#include <string>
#include <utility>
#include <vector>
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
+#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/sessions/ordered_commit_set.h"
#include "chrome/browser/sync/sessions/session_state.h"
#include "chrome/browser/sync/sessions/status_controller.h"
#include "chrome/browser/sync/sessions/sync_session_context.h"
+#include "chrome/browser/sync/syncable/model_type.h"
#include "chrome/browser/sync/util/extensions_activity_monitor.h"
namespace syncable {
@@ -35,9 +39,36 @@
class ModelSafeWorker;
namespace sessions {
-typedef std::pair<sync_pb::GetUpdatesCallerInfo::GetUpdatesSource,
- syncable::ModelTypeBitSet> SyncSourceInfo;
+// A container that contains a set of datatypes with possible string payloads.
+typedef std::map<syncable::ModelType, std::string> TypePayloadMap;
+
+// Helper utils for building TypePayloadMaps.
+// Convert a ModelTypeBitset into a TypePayloadMap using a default payload.
+TypePayloadMap ModelTypeBitSetToTypePayloadMap(
+ const syncable::ModelTypeBitSet& types,
+ const std::string& payload);
+// Convert a ModelSafeRoutingInfo into a TypePayloadMap using a default payload.
+TypePayloadMap RoutingInfoToTypePayloadMap(
+ const ModelSafeRoutingInfo& routes,
+ const std::string& payload);
+// Coalesce |update| into |original|, overwriting only when |update| has
+// a non-empty payload.
+void CoalescePayloads(TypePayloadMap* original, const TypePayloadMap& update);
+
+// A container for the source of a sync session. This includes the update
+// source, the datatypes triggering the sync session, and possible session
+// specific payloads which should be sent to the server.
+struct SyncSourceInfo {
+ SyncSourceInfo();
+ SyncSourceInfo(
+ const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u,
+ const TypePayloadMap& t);
+
+ sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source;
+ TypePayloadMap types;
+};
+
class SyncSession {
public:
// The Delegate services events that occur during the session requiring an

Powered by Google App Engine
This is Rietveld 408576698