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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 9317095: Fix crash on startup because function returned before creating required (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync and merge, no new changes Created 8 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 chrome_extra_parts_[i]->PreMainMessageLoopStart(); 1104 chrome_extra_parts_[i]->PreMainMessageLoopStart();
1105 } 1105 }
1106 1106
1107 void ChromeBrowserMainParts::PostMainMessageLoopStart() { 1107 void ChromeBrowserMainParts::PostMainMessageLoopStart() {
1108 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 1108 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1109 chrome_extra_parts_[i]->PostMainMessageLoopStart(); 1109 chrome_extra_parts_[i]->PostMainMessageLoopStart();
1110 } 1110 }
1111 1111
1112 int ChromeBrowserMainParts::PreCreateThreads() { 1112 int ChromeBrowserMainParts::PreCreateThreads() {
1113 result_code_ = PreCreateThreadsImpl(); 1113 result_code_ = PreCreateThreadsImpl();
1114 // These members must be initialized before returning from this function.
1115 DCHECK(master_prefs_.get());
1116 DCHECK(browser_init_.get());
1114 return result_code_; 1117 return result_code_;
1115 } 1118 }
1116 1119
1117 int ChromeBrowserMainParts::PreCreateThreadsImpl() { 1120 int ChromeBrowserMainParts::PreCreateThreadsImpl() {
1118 run_message_loop_ = false; 1121 run_message_loop_ = false;
1119 #if defined(OS_WIN) 1122 #if defined(OS_WIN)
1120 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_); 1123 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_);
1121 #else 1124 #else
1122 // Getting the user data dir can fail if the directory isn't 1125 // Getting the user data dir can fail if the directory isn't
1123 // creatable, for example; on Windows in code below we bring up a 1126 // creatable, for example; on Windows in code below we bring up a
(...skipping 29 matching lines...) Expand all
1153 } 1156 }
1154 1157
1155 // This forces the TabCloseableStateWatcher to be created and, on chromeos, 1158 // This forces the TabCloseableStateWatcher to be created and, on chromeos,
1156 // register for the notifications it needs to track the closeable state of 1159 // register for the notifications it needs to track the closeable state of
1157 // tabs. 1160 // tabs.
1158 browser_process_->tab_closeable_state_watcher(); 1161 browser_process_->tab_closeable_state_watcher();
1159 1162
1160 local_state_ = InitializeLocalState(parsed_command_line(), 1163 local_state_ = InitializeLocalState(parsed_command_line(),
1161 is_first_run_); 1164 is_first_run_);
1162 1165
1166 // These members must be initialized before returning from this function.
1167 master_prefs_.reset(new first_run::MasterPrefs);
1168 browser_init_.reset(new BrowserInit);
1169
1163 // If we're running tests (ui_task is non-null), then the ResourceBundle 1170 // If we're running tests (ui_task is non-null), then the ResourceBundle
1164 // has already been initialized. 1171 // has already been initialized.
1165 if (parameters().ui_task) { 1172 if (parameters().ui_task) {
1166 browser_process_->SetApplicationLocale("en-US"); 1173 browser_process_->SetApplicationLocale("en-US");
1167 } else { 1174 } else {
1168 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is 1175 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is
1169 // needed when loading the MainMenu.nib and the language doesn't depend on 1176 // needed when loading the MainMenu.nib and the language doesn't depend on
1170 // anything since it comes from Cocoa. 1177 // anything since it comes from Cocoa.
1171 #if defined(OS_MACOSX) 1178 #if defined(OS_MACOSX)
1172 browser_process_->SetApplicationLocale(l10n_util::GetLocaleOverride()); 1179 browser_process_->SetApplicationLocale(l10n_util::GetLocaleOverride());
(...skipping 15 matching lines...) Expand all
1188 FilePath resources_pack_path; 1195 FilePath resources_pack_path;
1189 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); 1196 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path);
1190 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path); 1197 ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
1191 #endif // defined(OS_MACOSX) 1198 #endif // defined(OS_MACOSX)
1192 } 1199 }
1193 1200
1194 #if defined(TOOLKIT_GTK) 1201 #if defined(TOOLKIT_GTK)
1195 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); 1202 g_set_application_name(l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str());
1196 #endif 1203 #endif
1197 1204
1198 // These members must be initialized before returning from this function.
1199 master_prefs_.reset(new first_run::MasterPrefs);
1200 browser_init_.reset(new BrowserInit);
1201
1202 std::string try_chrome = 1205 std::string try_chrome =
1203 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain); 1206 parsed_command_line().GetSwitchValueASCII(switches::kTryChromeAgain);
1204 if (!try_chrome.empty()) { 1207 if (!try_chrome.empty()) {
1205 #if defined(OS_WIN) && !defined(USE_AURA) 1208 #if defined(OS_WIN) && !defined(USE_AURA)
1206 // Setup.exe has determined that we need to run a retention experiment 1209 // Setup.exe has determined that we need to run a retention experiment
1207 // and has lauched chrome to show the experiment UI. 1210 // and has lauched chrome to show the experiment UI.
1208 if (process_singleton_->FoundOtherProcessWindow()) { 1211 if (process_singleton_->FoundOtherProcessWindow()) {
1209 // It seems that we don't need to run the experiment since chrome 1212 // It seems that we don't need to run the experiment since chrome
1210 // in the same profile is already running. 1213 // in the same profile is already running.
1211 VLOG(1) << "Retention experiment not required"; 1214 VLOG(1) << "Retention experiment not required";
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 if (base::win::GetVersion() <= base::win::VERSION_XP) 1936 if (base::win::GetVersion() <= base::win::VERSION_XP)
1934 uma_name += "_XP"; 1937 uma_name += "_XP";
1935 1938
1936 uma_name += "_PreRead"; 1939 uma_name += "_PreRead";
1937 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; 1940 uma_name += pre_read == "1" ? "Enabled" : "Disabled";
1938 AddPreReadHistogramTime(uma_name.c_str(), time); 1941 AddPreReadHistogramTime(uma_name.c_str(), time);
1939 } 1942 }
1940 #endif 1943 #endif
1941 #endif 1944 #endif
1942 } 1945 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698