Index: chrome/browser/profiles/profile_manager.cc |
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
index ec088d2d43008e0422e27d3454ade176688904b9..74a0df4608addf4017246a11001e82867ed1c44c 100644 |
--- a/chrome/browser/profiles/profile_manager.cc |
+++ b/chrome/browser/profiles/profile_manager.cc |
@@ -13,6 +13,7 @@ |
#include "base/file_util.h" |
#include "base/files/file_enumerator.h" |
#include "base/files/file_path.h" |
+#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram.h" |
#include "base/prefs/pref_service.h" |
#include "base/strings/string_number_conversions.h" |
@@ -733,8 +734,37 @@ void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) { |
void ProfileManager::DoFinalInitForServices(Profile* profile, |
bool go_off_the_record) { |
#if defined(ENABLE_EXTENSIONS) |
+ // Set up a field trial to determine the effectiveness of deferring |
+ // creation of background extension RenderViews. |
+ CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, ()); |
+ static bool defer_creation = false; |
+ |
+ if (!trial.get()) { |
+ const base::FieldTrial::Probability kDivisor = 100; |
+ |
+ // Enable the deferred creation for 50% of the users. |
+ base::FieldTrial::Probability probability_per_group = 50; |
+ |
+ // After August 31, 2014 builds, it will always be in default group |
+ // (defer_creation == false). |
+ trial = base::FieldTrialList::FactoryGetFieldTrial( |
+ "DeferBackgroundExtensionCreation", |
+ kDivisor, |
+ "RateLimited", |
+ 2014, |
+ 8, |
+ 31, |
+ base::FieldTrial::ONE_TIME_RANDOMIZED, |
+ NULL); |
+ |
+ // Add group for deferred creation of background extension RenderViews. |
+ int defer_creation_group = |
+ trial->AppendGroup("Deferred", probability_per_group); |
+ defer_creation = trial->group() == defer_creation_group; |
+ } |
+ |
extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( |
- !go_off_the_record); |
+ !go_off_the_record, defer_creation); |
// During tests, when |profile| is an instance of TestingProfile, |
// ExtensionSystem might not create an ExtensionService. |
if (extensions::ExtensionSystem::Get(profile)->extension_service()) { |