Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: chrome/browser/profiles/profile_manager.cc

Issue 23618014: This defers starting background extension page RenderViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added ENABLE_EXTENSIONS ifdef Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..48f3c0962b734112e58117fab46b650b5a7409a9 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(
+ "DeferBackgoundExtensionCreation",
Miranda Callahan 2013/09/05 12:02:03 nit: s/ackgo/ackgro
Greg Spencer (Chromium) 2013/09/05 18:33:25 Done.
+ 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()) {
« no previous file with comments | « chrome/browser/extensions/test_extension_system.h ('k') | chrome/browser/sync/glue/extension_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698