diff options
author | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 03:39:18 +0000 |
---|---|---|
committer | zea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 03:39:18 +0000 |
commit | 69cdc4e9c6f58514a6088dbf307be9f66341a5bf (patch) | |
tree | e546be300cedd0cdc0f1b34aeabc3eb0f0112637 /sync | |
parent | 33c8f35c25914e936822f3156546cd96cd4685da (diff) | |
download | chromium_src-69cdc4e9c6f58514a6088dbf307be9f66341a5bf.zip chromium_src-69cdc4e9c6f58514a6088dbf307be9f66341a5bf.tar.gz chromium_src-69cdc4e9c6f58514a6088dbf307be9f66341a5bf.tar.bz2 |
[Sync] Add support for server-controlled favicon sync limit
This allows us to adjust the number of favicons clients will maintain
as we determine how well we handle them.
BUG=154886
Review URL: https://chromiumcodereview.appspot.com/14117004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r-- | sync/internal_api/public/util/experiments.h | 9 | ||||
-rw-r--r-- | sync/internal_api/sync_manager_impl.cc | 9 | ||||
-rw-r--r-- | sync/protocol/experiments_specifics.proto | 4 | ||||
-rw-r--r-- | sync/protocol/proto_value_conversions.cc | 15 |
4 files changed, 30 insertions, 7 deletions
diff --git a/sync/internal_api/public/util/experiments.h b/sync/internal_api/public/util/experiments.h index 7194ab3..a3b874b 100644 --- a/sync/internal_api/public/util/experiments.h +++ b/sync/internal_api/public/util/experiments.h @@ -22,13 +22,15 @@ struct Experiments { Experiments() : keystore_encryption(false), autofill_culling(false), full_history_sync(false), - favicon_sync(false) {} + favicon_sync(false), + favicon_sync_limit(200) {} bool Matches(const Experiments& rhs) { return (keystore_encryption == rhs.keystore_encryption && autofill_culling == rhs.autofill_culling && full_history_sync == rhs.full_history_sync && - favicon_sync == rhs.favicon_sync); + favicon_sync == rhs.favicon_sync && + favicon_sync_limit == rhs.favicon_sync_limit); } // Enable keystore encryption logic and the new encryption UI. @@ -42,6 +44,9 @@ struct Experiments { // Enable the favicons sync datatypes (favicon images and favicon tracking). bool favicon_sync; + + // The number of favicons that a client is permitted to sync. + int favicon_sync_limit; }; } // namespace syncer diff --git a/sync/internal_api/sync_manager_impl.cc b/sync/internal_api/sync_manager_impl.cc index 79f0bb5..0f807bc 100644 --- a/sync/internal_api/sync_manager_impl.cc +++ b/sync/internal_api/sync_manager_impl.cc @@ -1379,9 +1379,12 @@ bool SyncManagerImpl::ReceivedExperiment(Experiments* experiments) { ReadNode favicon_sync_node(&trans); if (favicon_sync_node.InitByClientTagLookup( syncer::EXPERIMENTS, - syncer::kFaviconSyncTag) == BaseNode::INIT_OK && - favicon_sync_node.GetExperimentsSpecifics().favicon_sync().enabled()) { - experiments->favicon_sync = true; + syncer::kFaviconSyncTag) == BaseNode::INIT_OK) { + experiments->favicon_sync = favicon_sync_node.GetExperimentsSpecifics(). + favicon_sync().enabled(); + experiments->favicon_sync_limit = + favicon_sync_node.GetExperimentsSpecifics().favicon_sync(). + favicon_sync_limit(); found_experiment = true; } diff --git a/sync/protocol/experiments_specifics.proto b/sync/protocol/experiments_specifics.proto index 2779837..f834cb9 100644 --- a/sync/protocol/experiments_specifics.proto +++ b/sync/protocol/experiments_specifics.proto @@ -27,9 +27,11 @@ message AutofillCullingFlags { optional bool enabled = 1; } -// Whether the favicon sync datatypes are enabled. +// Whether the favicon sync datatypes are enabled, and what parameters +// they should operate under. message FaviconSyncFlags { optional bool enabled = 1; + optional int32 favicon_sync_limit = 2 [default = 200]; } // Contains one flag or set of related flags. Each node of the experiments type diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc index c830395..cb48346 100644 --- a/sync/protocol/proto_value_conversions.cc +++ b/sync/protocol/proto_value_conversions.cc @@ -332,13 +332,26 @@ base::DictionaryValue* DictionarySpecificsToValue( return value; } +namespace { + +DictionaryValue* FaviconSyncFlagsToValue( + const sync_pb::FaviconSyncFlags& proto) { + base::DictionaryValue* value = new base::DictionaryValue(); + SET_BOOL(enabled); + SET_INT32(favicon_sync_limit); + return value; +} + +} + base::DictionaryValue* ExperimentsSpecificsToValue( const sync_pb::ExperimentsSpecifics& proto) { base::DictionaryValue* value = new base::DictionaryValue(); SET_EXPERIMENT_ENABLED_FIELD(keystore_encryption); SET_EXPERIMENT_ENABLED_FIELD(history_delete_directives); SET_EXPERIMENT_ENABLED_FIELD(autofill_culling); - SET_EXPERIMENT_ENABLED_FIELD(favicon_sync); + if (proto.has_favicon_sync()) + SET(favicon_sync, FaviconSyncFlagsToValue); return value; } |