summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorpavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-21 22:17:13 +0000
committerpavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-21 22:17:13 +0000
commitad3995ca5fe927c846f08e17044e14603d1a8b19 (patch)
tree28d89cd4ecbe42d00fbfe1f545634934479bb41e /sync
parent2c9ba710edbc2cc3cd771524ef072a52fdb0d82b (diff)
downloadchromium_src-ad3995ca5fe927c846f08e17044e14603d1a8b19.zip
chromium_src-ad3995ca5fe927c846f08e17044e14603d1a8b19.tar.gz
chromium_src-ad3995ca5fe927c846f08e17044e14603d1a8b19.tar.bz2
Control invalidations network channel from syncer experiment
- Created new experiment protobuf. - ProfileSyncService writes value to prefs - TiclInvalidationService registers for changes to both gcm enabled and invalidations over GCM pref settings. When prefs change it decides which channel to use and restarts invalidator if needed. BUG=325020 R=zea@chromium.org Review URL: https://codereview.chromium.org/205333003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258689 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/internal_api/public/util/experiments.h10
-rw-r--r--sync/internal_api/sync_manager_impl.cc12
-rw-r--r--sync/protocol/experiments_specifics.proto6
-rw-r--r--sync/protocol/proto_value_conversions.cc1
4 files changed, 27 insertions, 2 deletions
diff --git a/sync/internal_api/public/util/experiments.h b/sync/internal_api/public/util/experiments.h
index 18a0887..9063cbb 100644
--- a/sync/internal_api/public/util/experiments.h
+++ b/sync/internal_api/public/util/experiments.h
@@ -15,6 +15,7 @@ const char kFaviconSyncTag[] = "favicon_sync";
const char kPreCommitUpdateAvoidanceTag[] = "pre_commit_update_avoidance";
const char kGCMChannelTag[] = "gcm_channel";
const char kEnhancedBookmarksTag[] = "enhanced_bookmarks";
+const char kGCMInvalidationsTag[] = "gcm_invalidations";
// A structure to hold the enable status of experimental sync features.
struct Experiments {
@@ -27,13 +28,15 @@ struct Experiments {
Experiments()
: favicon_sync_limit(200),
gcm_channel_state(UNSET),
- enhanced_bookmarks_enabled(false) {}
+ enhanced_bookmarks_enabled(false),
+ gcm_invalidations_enabled(false) {}
bool Matches(const Experiments& rhs) {
return (favicon_sync_limit == rhs.favicon_sync_limit &&
gcm_channel_state == rhs.gcm_channel_state &&
enhanced_bookmarks_enabled == rhs.enhanced_bookmarks_enabled &&
- enhanced_bookmarks_ext_id == rhs.enhanced_bookmarks_ext_id);
+ enhanced_bookmarks_ext_id == rhs.enhanced_bookmarks_ext_id &&
+ gcm_invalidations_enabled == rhs.gcm_invalidations_enabled);
}
// The number of favicons that a client is permitted to sync.
@@ -45,6 +48,9 @@ struct Experiments {
// Enable the enhanced bookmarks sync datatype.
bool enhanced_bookmarks_enabled;
+ // Enable invalidations over GCM channel.
+ bool gcm_invalidations_enabled;
+
// Enhanced bookmarks extension id.
std::string enhanced_bookmarks_ext_id;
};
diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc
index 8ecb29f..3b4a1fd 100644
--- a/sync/internal_api/sync_manager_impl.cc
+++ b/sync/internal_api/sync_manager_impl.cc
@@ -1129,6 +1129,18 @@ bool SyncManagerImpl::ReceivedExperiment(Experiments* experiments) {
found_experiment = true;
}
+ ReadNode gcm_invalidations_node(&trans);
+ if (gcm_invalidations_node.InitByClientTagLookup(
+ syncer::EXPERIMENTS, syncer::kGCMInvalidationsTag) ==
+ BaseNode::INIT_OK) {
+ const sync_pb::GcmInvalidationsFlags& gcm_invalidations =
+ gcm_invalidations_node.GetExperimentsSpecifics().gcm_invalidations();
+ if (gcm_invalidations.has_enabled()) {
+ experiments->gcm_invalidations_enabled = gcm_invalidations.enabled();
+ found_experiment = true;
+ }
+ }
+
return found_experiment;
}
diff --git a/sync/protocol/experiments_specifics.proto b/sync/protocol/experiments_specifics.proto
index 790cf02..723fe55 100644
--- a/sync/protocol/experiments_specifics.proto
+++ b/sync/protocol/experiments_specifics.proto
@@ -50,6 +50,11 @@ message EnhancedBookmarksFlags {
optional string extension_id = 2;
}
+// Flags for enabling GCM channel for invalidations.
+message GcmInvalidationsFlags {
+ optional bool enabled = 1;
+}
+
// Contains one flag or set of related flags. Each node of the experiments type
// will have a unique_client_tag identifying which flags it contains. By
// convention, the tag name should match the sub-message name.
@@ -61,4 +66,5 @@ message ExperimentsSpecifics {
optional PreCommitUpdateAvoidanceFlags pre_commit_update_avoidance = 5;
optional GcmChannelFlags gcm_channel = 6;
optional EnhancedBookmarksFlags enhanced_bookmarks = 7;
+ optional GcmInvalidationsFlags gcm_invalidations = 8;
}
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index 83748faa..496a35d 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -503,6 +503,7 @@ base::DictionaryValue* ExperimentsSpecificsToValue(
SET(favicon_sync, FaviconSyncFlagsToValue);
SET_EXPERIMENT_ENABLED_FIELD(gcm_channel);
SET_EXPERIMENT_ENABLED_FIELD(enhanced_bookmarks);
+ SET_EXPERIMENT_ENABLED_FIELD(gcm_invalidations);
return value;
}