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

Unified Diff: chrome/browser/chromeos/drive/drive_integration_service.cc

Issue 118043003: Fix app_shell shutdown crash due to BrowserContextKeyedServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix FileSystem tests (shutdown_crash) Created 6 years, 11 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/chromeos/drive/drive_integration_service.cc
diff --git a/chrome/browser/chromeos/drive/drive_integration_service.cc b/chrome/browser/chromeos/drive/drive_integration_service.cc
index 08c9fc5f1dbb0ce7094fb1e13f5413ff7544cc06..d0e9c05cdc615147db140991ec6032db1105fa08 100644
--- a/chrome/browser/chromeos/drive/drive_integration_service.cc
+++ b/chrome/browser/chromeos/drive/drive_integration_service.cc
@@ -540,6 +540,10 @@ void DriveIntegrationService::AvoidDriveAsDownloadDirecotryPreference() {
//===================== DriveIntegrationServiceFactory =======================
+DriveIntegrationServiceFactory::FactoryFunction*
+ DriveIntegrationServiceFactory::factory_function_for_test_ = NULL;
+void* DriveIntegrationServiceFactory::factory_data_for_test_ = NULL;
+
// static
DriveIntegrationService* DriveIntegrationServiceFactory::GetForProfile(
Profile* profile) {
@@ -575,8 +579,9 @@ DriveIntegrationServiceFactory* DriveIntegrationServiceFactory::GetInstance() {
// static
void DriveIntegrationServiceFactory::SetFactoryForTest(
- const FactoryCallback& factory_for_test) {
- GetInstance()->factory_for_test_ = factory_for_test;
+ FactoryFunction* factory_for_test, void* data) {
+ factory_function_for_test_ = factory_for_test;
+ factory_data_for_test_ = data;
}
DriveIntegrationServiceFactory::DriveIntegrationServiceFactory()
@@ -597,7 +602,7 @@ DriveIntegrationServiceFactory::BuildServiceInstanceFor(
Profile* profile = Profile::FromBrowserContext(context);
DriveIntegrationService* service = NULL;
- if (factory_for_test_.is_null()) {
+ if (!factory_function_for_test_) {
DriveIntegrationService::PreferenceWatcher* preference_watcher = NULL;
if (chromeos::IsProfileAssociatedWithGaiaAccount(profile)) {
// Drive File System can be enabled.
@@ -608,7 +613,7 @@ DriveIntegrationServiceFactory::BuildServiceInstanceFor(
service = new DriveIntegrationService(profile, preference_watcher,
NULL, base::FilePath(), NULL);
} else {
- service = factory_for_test_.Run(profile);
+ service = factory_function_for_test_(profile, factory_data_for_test_);
}
return service;

Powered by Google App Engine
This is Rietveld 408576698