Index: content/browser/background_sync/background_sync_manager.cc |
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc |
index d56d349051d499eb892dc5462ce1864051b1378b..3589bcc820a68f5fd4bf58d3500bcf3270a114de 100644 |
--- a/content/browser/background_sync/background_sync_manager.cc |
+++ b/content/browser/background_sync/background_sync_manager.cc |
@@ -7,6 +7,7 @@ |
#include "base/barrier_closure.h" |
#include "base/bind.h" |
#include "base/location.h" |
+#include "base/metrics/field_trial.h" |
#include "base/single_thread_task_runner.h" |
#include "base/thread_task_runner_handle.h" |
#include "content/browser/background_sync/background_sync_metrics.h" |
@@ -51,6 +52,12 @@ void PostErrorResponse( |
base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>().Pass()))); |
} |
+bool ShouldDisableForFieldTrial() { |
+ std::string experiment = base::FieldTrialList::FindFullName("BackgroundSync"); |
+ return base::StartsWith(experiment, "ExperimentDisable", |
+ base::CompareCase::INSENSITIVE_ASCII); |
+} |
+ |
} // namespace |
BackgroundSyncManager::BackgroundSyncRegistrations:: |
@@ -239,6 +246,11 @@ void BackgroundSyncManager::InitImpl(const base::Closure& callback) { |
return; |
} |
+ if (ShouldDisableForFieldTrial()) { |
+ DisableAndClearManager(callback); |
+ return; |
+ } |
+ |
GetDataFromBackend( |
kBackgroundSyncUserDataKey, |
base::Bind(&BackgroundSyncManager::InitDidGetDataFromBackend, |
@@ -333,6 +345,13 @@ void BackgroundSyncManager::RegisterImpl( |
return; |
} |
+ if (ShouldDisableForFieldTrial()) { |
+ DisableAndClearManager(base::Bind( |
+ callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, |
+ base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>().Pass()))); |
+ return; |
+ } |
+ |
if (options.tag.length() > kMaxTagLength) { |
BackgroundSyncMetrics::CountRegister( |
options.periodicity, registration_could_fire, |