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
-rw-r--r--chrome/common/temp_scaffolding_stubs.cpp3
-rw-r--r--chrome/common/temp_scaffolding_stubs.h2
5 files changed, 9 insertions, 6 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.
diff --git a/chrome/common/temp_scaffolding_stubs.cpp b/chrome/common/temp_scaffolding_stubs.cpp
index 301d935..1228938 100644
--- a/chrome/common/temp_scaffolding_stubs.cpp
+++ b/chrome/common/temp_scaffolding_stubs.cpp
@@ -109,11 +109,12 @@ bool BrowserInit::LaunchBrowserImpl(const CommandLine& parsed_command_line,
UserDataManager* UserDataManager::instance_ = NULL;
-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_;
}
UserDataManager* UserDataManager::Get() {
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 8870522..97de3fb0 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -155,7 +155,7 @@ class FirstRunBrowserProcess : public BrowserProcessImpl {
class UserDataManager {
public:
- static void Create();
+ static UserDataManager* Create();
static UserDataManager* Get();
explicit UserDataManager(const std::wstring& user_data_root) { }