diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 22:22:45 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-18 22:22:45 +0000 |
commit | 19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804 (patch) | |
tree | 5c117162a391159273bce2cff213b4a6cb3cbbd6 /sync/engine | |
parent | 1ba12253ff4b32c75f9cebe2b69926f1cb815095 (diff) | |
download | chromium_src-19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804.zip chromium_src-19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804.tar.gz chromium_src-19edfbbd6fe6118d6c83fd1eda4a2dd153cf2804.tar.bz2 |
[Sync] Add support for denoting which sessions types are enabled
We do this by sending the set of enabled types (those in the routing info) at
commit time via a new ClientConfigParams message.
BUG=170162
R=tim@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11935002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/engine')
-rw-r--r-- | sync/engine/build_commit_command.cc | 12 | ||||
-rw-r--r-- | sync/engine/build_commit_command.h | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sync/engine/build_commit_command.cc b/sync/engine/build_commit_command.cc index 9d1a4b9..ba356e8 100644 --- a/sync/engine/build_commit_command.cc +++ b/sync/engine/build_commit_command.cc @@ -97,6 +97,17 @@ void BuildCommitCommand::AddExtensionsActivityToMessage( } } +void BuildCommitCommand::AddClientConfigParamsToMessage( + SyncSession* session, sync_pb::CommitMessage* message) { + const ModelSafeRoutingInfo& routing_info = session->routing_info(); + sync_pb::ClientConfigParams* config_params = message->mutable_config_params(); + for (std::map<ModelType, ModelSafeGroup>::const_iterator iter = + routing_info.begin(); iter != routing_info.end(); ++iter) { + int field_number = GetSpecificsFieldNumberFromModelType(iter->first); + config_params->mutable_enabled_type_ids()->Add(field_number); + } +} + namespace { void SetEntrySpecifics(MutableEntry* meta_entry, sync_pb::SyncEntity* sync_entry) { @@ -116,6 +127,7 @@ SyncerError BuildCommitCommand::ExecuteImpl(SyncSession* session) { commit_message->set_cache_guid( session->write_transaction()->directory()->cache_guid()); AddExtensionsActivityToMessage(session, commit_message); + AddClientConfigParamsToMessage(session, commit_message); // Cache previously computed position values. Because |commit_ids| // is already in sibling order, we should always hit this map after diff --git a/sync/engine/build_commit_command.h b/sync/engine/build_commit_command.h index b4190ca..253b6c0 100644 --- a/sync/engine/build_commit_command.h +++ b/sync/engine/build_commit_command.h @@ -53,6 +53,11 @@ class SYNC_EXPORT_PRIVATE BuildCommitCommand : public SyncerCommand { void AddExtensionsActivityToMessage(sessions::SyncSession* session, sync_pb::CommitMessage* message); + + // Fills the config_params field of |message|. + void AddClientConfigParamsToMessage(sessions::SyncSession* session, + sync_pb::CommitMessage* message); + // Helper for computing position. Find the numeric position value // of the closest already-synced entry. |direction| must be one of // NEXT_ID or PREV_ID; this parameter controls the search direction. |