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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/deferred_sequenced_task_runner.h" 12 #include "base/deferred_sequenced_task_runner.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_enumerator.h" 14 #include "base/files/file_enumerator.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/metrics/field_trial.h"
16 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
17 #include "base/prefs/pref_service.h" 18 #include "base/prefs/pref_service.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
21 #include "chrome/browser/bookmarks/bookmark_model.h" 22 #include "chrome/browser/bookmarks/bookmark_model.h"
22 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
23 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/chrome_notification_types.h" 25 #include "chrome/browser/chrome_notification_types.h"
25 #include "chrome/browser/content_settings/host_content_settings_map.h" 26 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 ProfileMetrics::LogNumberOfProfiles(this); 727 ProfileMetrics::LogNumberOfProfiles(this);
727 content::NotificationService::current()->Notify( 728 content::NotificationService::current()->Notify(
728 chrome::NOTIFICATION_PROFILE_ADDED, 729 chrome::NOTIFICATION_PROFILE_ADDED,
729 content::Source<Profile>(profile), 730 content::Source<Profile>(profile),
730 content::NotificationService::NoDetails()); 731 content::NotificationService::NoDetails());
731 } 732 }
732 733
733 void ProfileManager::DoFinalInitForServices(Profile* profile, 734 void ProfileManager::DoFinalInitForServices(Profile* profile,
734 bool go_off_the_record) { 735 bool go_off_the_record) {
735 #if defined(ENABLE_EXTENSIONS) 736 #if defined(ENABLE_EXTENSIONS)
737 // Set up a field trial to determine the effectiveness of deferring
738 // creation of background extension RenderViews.
739 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, ());
740 static bool defer_creation = false;
741
742 if (!trial.get()) {
743 const base::FieldTrial::Probability kDivisor = 100;
744
745 // Enable the deferred creation for 50% of the users.
746 base::FieldTrial::Probability probability_per_group = 50;
747
748 // After August 31, 2014 builds, it will always be in default group
749 // (defer_creation == false).
750 trial = base::FieldTrialList::FactoryGetFieldTrial(
751 "DeferBackgoundExtensionCreation",
Miranda Callahan 2013/09/05 12:02:03 nit: s/ackgo/ackgro
Greg Spencer (Chromium) 2013/09/05 18:33:25 Done.
752 kDivisor,
753 "RateLimited",
754 2014,
755 8,
756 31,
757 base::FieldTrial::ONE_TIME_RANDOMIZED,
758 NULL);
759
760 // Add group for deferred creation of background extension RenderViews.
761 int defer_creation_group =
762 trial->AppendGroup("Deferred", probability_per_group);
763 defer_creation = trial->group() == defer_creation_group;
764 }
765
736 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile( 766 extensions::ExtensionSystem::Get(profile)->InitForRegularProfile(
737 !go_off_the_record); 767 !go_off_the_record, defer_creation);
738 // During tests, when |profile| is an instance of TestingProfile, 768 // During tests, when |profile| is an instance of TestingProfile,
739 // ExtensionSystem might not create an ExtensionService. 769 // ExtensionSystem might not create an ExtensionService.
740 if (extensions::ExtensionSystem::Get(profile)->extension_service()) { 770 if (extensions::ExtensionSystem::Get(profile)->extension_service()) {
741 profile->GetHostContentSettingsMap()->RegisterExtensionService( 771 profile->GetHostContentSettingsMap()->RegisterExtensionService(
742 extensions::ExtensionSystem::Get(profile)->extension_service()); 772 extensions::ExtensionSystem::Get(profile)->extension_service());
743 } 773 }
744 #endif 774 #endif
745 #if defined(ENABLE_MANAGED_USERS) 775 #if defined(ENABLE_MANAGED_USERS)
746 // Initialization needs to happen after extension system initialization (for 776 // Initialization needs to happen after extension system initialization (for
747 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the 777 // extension::ManagementPolicy) and InitProfileUserPrefs (for setting the
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 ProfileManager::ProfileInfo::ProfileInfo( 1172 ProfileManager::ProfileInfo::ProfileInfo(
1143 Profile* profile, 1173 Profile* profile,
1144 bool created) 1174 bool created)
1145 : profile(profile), 1175 : profile(profile),
1146 created(created) { 1176 created(created) {
1147 } 1177 }
1148 1178
1149 ProfileManager::ProfileInfo::~ProfileInfo() { 1179 ProfileManager::ProfileInfo::~ProfileInfo() {
1150 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1180 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1151 } 1181 }
OLDNEW
« 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