summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc3
-rw-r--r--chrome/browser/user_data_manager.cc5
-rw-r--r--chrome/browser/user_data_manager.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 29d984e..b492380 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -309,7 +309,7 @@ int BrowserMain(const MainFunctionParams& parameters) {
StatisticsRecorder statistics;
// Initialize the shared instance of user data manager.
- UserDataManager::Create();
+ scoped_ptr<UserDataManager> user_data_manager(UserDataManager::Create());
// Try to create/load the profile.
ProfileManager* profile_manager = browser_process->profile_manager();
@@ -546,4 +546,3 @@ int BrowserMain(const MainFunctionParams& parameters) {
return result_code;
}
-
diff --git a/chrome/browser/user_data_manager.cc b/chrome/browser/user_data_manager.cc
index 554c53f..bc078db 100644
--- a/chrome/browser/user_data_manager.cc
+++ b/chrome/browser/user_data_manager.cc
@@ -91,11 +91,12 @@ static const wchar_t kProfileFolderSeparator[] = L"-";
UserDataManager* UserDataManager::instance_ = NULL;
// static
-void UserDataManager::Create() {
+UserDataManager* UserDataManager::Create() {
DCHECK(!instance_);
std::wstring user_data;
PathService::Get(chrome::DIR_USER_DATA, &user_data);
instance_ = new UserDataManager(user_data);
+ return instance_;
}
// static
@@ -123,6 +124,8 @@ UserDataManager::UserDataManager(const std::wstring& user_data_root)
}
UserDataManager::~UserDataManager() {
+ if (instance_ == this)
+ instance_ = NULL;
}
// static
diff --git a/chrome/browser/user_data_manager.h b/chrome/browser/user_data_manager.h
index f5e4522..f688448 100644
--- a/chrome/browser/user_data_manager.h
+++ b/chrome/browser/user_data_manager.h
@@ -27,7 +27,7 @@ class UserDataManager {
public:
// Creates the shared instance of this class. This method is not thread-safe,
// so the shared instance should be created on the main thread.
- static void Create();
+ static UserDataManager* Create();
// Returns the shared instance. CreateInstance must be called before callling
// this method.