| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "chrome/browser/profiles/profile.h" | 69 #include "chrome/browser/profiles/profile.h" |
| 70 #include "chrome/browser/profiles/profile_manager.h" | 70 #include "chrome/browser/profiles/profile_manager.h" |
| 71 #include "chrome/browser/search_engines/search_engine_type.h" | 71 #include "chrome/browser/search_engines/search_engine_type.h" |
| 72 #include "chrome/browser/search_engines/template_url.h" | 72 #include "chrome/browser/search_engines/template_url.h" |
| 73 #include "chrome/browser/search_engines/template_url_service.h" | 73 #include "chrome/browser/search_engines/template_url_service.h" |
| 74 #include "chrome/browser/search_engines/template_url_service_factory.h" | 74 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 75 #include "chrome/browser/service/service_process_control.h" | 75 #include "chrome/browser/service/service_process_control.h" |
| 76 #include "chrome/browser/shell_integration.h" | 76 #include "chrome/browser/shell_integration.h" |
| 77 #include "chrome/browser/translate/translate_manager.h" | 77 #include "chrome/browser/translate/translate_manager.h" |
| 78 #include "chrome/browser/ui/browser.h" | 78 #include "chrome/browser/ui/browser.h" |
| 79 #include "chrome/browser/ui/browser_init.h" |
| 79 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 80 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 80 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" | 81 #include "chrome/browser/web_resource/gpu_blacklist_updater.h" |
| 81 #include "chrome/common/child_process_logging.h" | 82 #include "chrome/common/child_process_logging.h" |
| 82 #include "chrome/common/chrome_constants.h" | 83 #include "chrome/common/chrome_constants.h" |
| 83 #include "chrome/common/chrome_paths.h" | 84 #include "chrome/common/chrome_paths.h" |
| 84 #include "chrome/common/chrome_result_codes.h" | 85 #include "chrome/common/chrome_result_codes.h" |
| 85 #include "chrome/common/chrome_switches.h" | 86 #include "chrome/common/chrome_switches.h" |
| 86 #include "chrome/common/chrome_version_info.h" | 87 #include "chrome/common/chrome_version_info.h" |
| 87 #include "chrome/common/env_vars.h" | 88 #include "chrome/common/env_vars.h" |
| 88 #include "chrome/common/json_pref_store.h" | 89 #include "chrome/common/json_pref_store.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks( | 304 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks( |
| 304 true); | 305 true); |
| 305 | 306 |
| 306 // TODO(joi): Passing the NetLog here is temporary; once I switch the | 307 // TODO(joi): Passing the NetLog here is temporary; once I switch the |
| 307 // URLRequestThrottlerManager to be part of the URLRequestContext it will | 308 // URLRequestThrottlerManager to be part of the URLRequestContext it will |
| 308 // come from there. Doing it this way for now (2011/5/12) to try to fail | 309 // come from there. Doing it this way for now (2011/5/12) to try to fail |
| 309 // fast in case A/B experiment gives unexpected results. | 310 // fast in case A/B experiment gives unexpected results. |
| 310 net::URLRequestThrottlerManager::GetInstance()->set_net_log(net_log); | 311 net::URLRequestThrottlerManager::GetInstance()->set_net_log(net_log); |
| 311 } | 312 } |
| 312 | 313 |
| 314 // Creates key child threads. We need to do this explicitly since |
| 315 // BrowserThread::PostTask silently deletes a posted task if the target message |
| 316 // loop isn't created. |
| 317 void CreateChildThreads(BrowserProcessImpl* process) { |
| 318 process->db_thread(); |
| 319 process->file_thread(); |
| 320 process->process_launcher_thread(); |
| 321 process->cache_thread(); |
| 322 process->io_thread(); |
| 323 #if defined(OS_CHROMEOS) |
| 324 process->web_socket_proxy_thread(); |
| 325 #endif |
| 326 // Create watchdog thread after creating all other threads because it will |
| 327 // watch the other threads and they must be running. |
| 328 process->watchdog_thread(); |
| 329 } |
| 330 |
| 313 // Returns the new local state object, guaranteed non-NULL. | 331 // Returns the new local state object, guaranteed non-NULL. |
| 314 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, | 332 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, |
| 315 bool is_first_run) { | 333 bool is_first_run) { |
| 316 FilePath local_state_path; | 334 FilePath local_state_path; |
| 317 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 335 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 318 bool local_state_file_exists = file_util::PathExists(local_state_path); | 336 bool local_state_file_exists = file_util::PathExists(local_state_path); |
| 319 | 337 |
| 320 // Load local state. This includes the application locale so we know which | 338 // Load local state. This includes the application locale so we know which |
| 321 // locale dll to load. | 339 // locale dll to load. |
| 322 PrefService* local_state = g_browser_process->local_state(); | 340 PrefService* local_state = g_browser_process->local_state(); |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 ChromeBrowserMainParts::ChromeBrowserMainParts( | 680 ChromeBrowserMainParts::ChromeBrowserMainParts( |
| 663 const content::MainFunctionParams& parameters) | 681 const content::MainFunctionParams& parameters) |
| 664 : parameters_(parameters), | 682 : parameters_(parameters), |
| 665 parsed_command_line_(parameters.command_line), | 683 parsed_command_line_(parameters.command_line), |
| 666 result_code_(content::RESULT_CODE_NORMAL_EXIT), | 684 result_code_(content::RESULT_CODE_NORMAL_EXIT), |
| 667 shutdown_watcher_(new ShutdownWatcherHelper()), | 685 shutdown_watcher_(new ShutdownWatcherHelper()), |
| 668 record_search_engine_(false), | 686 record_search_engine_(false), |
| 669 translate_manager_(NULL), | 687 translate_manager_(NULL), |
| 670 profile_(NULL), | 688 profile_(NULL), |
| 671 run_message_loop_(true), | 689 run_message_loop_(true), |
| 672 notify_result_(ProcessSingleton::PROCESS_NONE), | 690 notify_result_(ProcessSingleton::PROCESS_NONE) { |
| 673 is_first_run_(false), | |
| 674 first_run_ui_bypass_(false), | |
| 675 metrics_(NULL), | |
| 676 local_state_(NULL), | |
| 677 restart_last_session_(false) { | |
| 678 // If we're running tests (ui_task is non-null). | 691 // If we're running tests (ui_task is non-null). |
| 679 if (parameters.ui_task) | 692 if (parameters.ui_task) |
| 680 browser_defaults::enable_help_app = false; | 693 browser_defaults::enable_help_app = false; |
| 681 } | 694 } |
| 682 | 695 |
| 683 ChromeBrowserMainParts::~ChromeBrowserMainParts() { | 696 ChromeBrowserMainParts::~ChromeBrowserMainParts() { |
| 684 for (int i = static_cast<int>(chrome_extra_parts_.size())-1; i >= 0; --i) | 697 for (int i = static_cast<int>(chrome_extra_parts_.size())-1; i >= 0; --i) |
| 685 delete chrome_extra_parts_[i]; | 698 delete chrome_extra_parts_[i]; |
| 686 chrome_extra_parts_.clear(); | 699 chrome_extra_parts_.clear(); |
| 687 } | 700 } |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 void ChromeBrowserMainParts::PreMainMessageLoopStart() { | 1200 void ChromeBrowserMainParts::PreMainMessageLoopStart() { |
| 1188 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1201 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1189 chrome_extra_parts_[i]->PreMainMessageLoopStart(); | 1202 chrome_extra_parts_[i]->PreMainMessageLoopStart(); |
| 1190 } | 1203 } |
| 1191 | 1204 |
| 1192 void ChromeBrowserMainParts::PostMainMessageLoopStart() { | 1205 void ChromeBrowserMainParts::PostMainMessageLoopStart() { |
| 1193 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1206 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1194 chrome_extra_parts_[i]->PostMainMessageLoopStart(); | 1207 chrome_extra_parts_[i]->PostMainMessageLoopStart(); |
| 1195 } | 1208 } |
| 1196 | 1209 |
| 1197 void ChromeBrowserMainParts::PreCreateThreads() { | 1210 void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
| 1198 result_code_ = PreCreateThreadsImpl(); | 1211 result_code_ = PreMainMessageLoopRunImpl(); |
| 1199 | 1212 |
| 1200 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1213 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1201 chrome_extra_parts_[i]->PreMainMessageLoopRun(); | 1214 chrome_extra_parts_[i]->PreMainMessageLoopRun(); |
| 1202 } | 1215 } |
| 1203 | 1216 |
| 1204 void ChromeBrowserMainParts::PreStartThread( | 1217 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
| 1205 content::BrowserThread::ID thread_id) { | |
| 1206 browser_process_->PreStartThread(thread_id); | |
| 1207 } | |
| 1208 | |
| 1209 void ChromeBrowserMainParts::PostStartThread( | |
| 1210 content::BrowserThread::ID thread_id) { | |
| 1211 browser_process_->PostStartThread(thread_id); | |
| 1212 switch (thread_id) { | |
| 1213 case BrowserThread::FILE: | |
| 1214 // Now the command line has been mutated based on about:flags, | |
| 1215 // and the file thread has been started, we can set up metrics | |
| 1216 // and initialize field trials. | |
| 1217 metrics_ = SetupMetricsAndFieldTrials(local_state_); | |
| 1218 break; | |
| 1219 | |
| 1220 default: | |
| 1221 break; | |
| 1222 } | |
| 1223 } | |
| 1224 | |
| 1225 void ChromeBrowserMainParts::PreMainMessageLoopRun() { | |
| 1226 result_code_ = PreMainMessageLoopRunImpl(); | |
| 1227 } | |
| 1228 | |
| 1229 int ChromeBrowserMainParts::PreCreateThreadsImpl() { | |
| 1230 run_message_loop_ = false; | 1218 run_message_loop_ = false; |
| 1219 FilePath user_data_dir; |
| 1231 #if defined(OS_WIN) | 1220 #if defined(OS_WIN) |
| 1232 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_); | 1221 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 1233 #else | 1222 #else |
| 1234 // Getting the user data dir can fail if the directory isn't | 1223 // Getting the user data dir can fail if the directory isn't |
| 1235 // creatable, for example; on Windows in code below we bring up a | 1224 // creatable, for example; on Windows in code below we bring up a |
| 1236 // dialog prompting the user to pick a different directory. | 1225 // dialog prompting the user to pick a different directory. |
| 1237 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, | 1226 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, |
| 1238 // so it's better to fail here than fail mysteriously elsewhere. | 1227 // so it's better to fail here than fail mysteriously elsewhere. |
| 1239 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) | 1228 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) |
| 1240 << "Must be able to get user data directory!"; | 1229 << "Must be able to get user data directory!"; |
| 1241 #endif | 1230 #endif |
| 1242 | 1231 |
| 1243 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); | 1232 process_singleton_.reset(new ProcessSingleton(user_data_dir)); |
| 1244 | 1233 |
| 1245 is_first_run_ = FirstRun::IsChromeFirstRun() || | 1234 bool is_first_run = FirstRun::IsChromeFirstRun() || |
| 1246 parsed_command_line().HasSwitch(switches::kFirstRun); | 1235 parsed_command_line().HasSwitch(switches::kFirstRun); |
| 1247 | 1236 |
| 1248 if (parsed_command_line().HasSwitch(switches::kImport) || | 1237 if (parsed_command_line().HasSwitch(switches::kImport) || |
| 1249 parsed_command_line().HasSwitch(switches::kImportFromFile)) { | 1238 parsed_command_line().HasSwitch(switches::kImportFromFile)) { |
| 1250 // We use different BrowserProcess when importing so no GoogleURLTracker is | 1239 // We use different BrowserProcess when importing so no GoogleURLTracker is |
| 1251 // instantiated (as it makes a net::URLRequest and we don't have an IO | 1240 // instantiated (as it makes a net::URLRequest and we don't have an IO |
| 1252 // thread, see bug #1292702). | 1241 // thread, see bug #1292702). |
| 1253 browser_process_.reset(new FirstRunBrowserProcess(parsed_command_line())); | 1242 browser_process_.reset(new FirstRunBrowserProcess(parsed_command_line())); |
| 1254 is_first_run_ = false; | 1243 is_first_run = false; |
| 1255 } else { | 1244 } else { |
| 1256 browser_process_.reset(new BrowserProcessImpl(parsed_command_line())); | 1245 browser_process_.reset(new BrowserProcessImpl(parsed_command_line())); |
| 1257 } | 1246 } |
| 1258 | 1247 |
| 1259 if (parsed_command_line().HasSwitch(switches::kEnableProfiling)) { | 1248 if (parsed_command_line().HasSwitch(switches::kEnableProfiling)) { |
| 1260 // User wants to override default tracking status. | 1249 // User wants to override default tracking status. |
| 1261 std::string flag = | 1250 std::string flag = |
| 1262 parsed_command_line().GetSwitchValueASCII(switches::kEnableProfiling); | 1251 parsed_command_line().GetSwitchValueASCII(switches::kEnableProfiling); |
| 1263 bool enabled = flag.compare("0") != 0; | 1252 bool enabled = flag.compare("0") != 0; |
| 1264 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(enabled); | 1253 tracked_objects::ThreadData::InitializeAndSetTrackingStatus(enabled); |
| 1265 } | 1254 } |
| 1266 | 1255 |
| 1267 // This forces the TabCloseableStateWatcher to be created and, on chromeos, | 1256 // This forces the TabCloseableStateWatcher to be created and, on chromeos, |
| 1268 // register for the notifications it needs to track the closeable state of | 1257 // register for the notifications it needs to track the closeable state of |
| 1269 // tabs. | 1258 // tabs. |
| 1270 g_browser_process->tab_closeable_state_watcher(); | 1259 g_browser_process->tab_closeable_state_watcher(); |
| 1271 | 1260 |
| 1272 local_state_ = InitializeLocalState(parsed_command_line(), | 1261 PrefService* local_state = InitializeLocalState(parsed_command_line(), |
| 1273 is_first_run_); | 1262 is_first_run); |
| 1274 | 1263 |
| 1275 #if defined(USE_LINUX_BREAKPAD) | 1264 #if defined(USE_LINUX_BREAKPAD) |
| 1276 // Needs to be called after we have chrome::DIR_USER_DATA and | 1265 // Needs to be called after we have chrome::DIR_USER_DATA and |
| 1277 // g_browser_process. | 1266 // g_browser_process. |
| 1278 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | 1267 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
| 1279 new GetLinuxDistroTask()); | 1268 new GetLinuxDistroTask()); |
| 1280 | 1269 |
| 1281 if (IsCrashReportingEnabled(local_state_)) | 1270 if (IsCrashReportingEnabled(local_state)) |
| 1282 InitCrashReporter(); | 1271 InitCrashReporter(); |
| 1283 #endif | 1272 #endif |
| 1284 | 1273 |
| 1285 // If we're running tests (ui_task is non-null), then the ResourceBundle | 1274 // If we're running tests (ui_task is non-null), then the ResourceBundle |
| 1286 // has already been initialized. | 1275 // has already been initialized. |
| 1287 if (parameters().ui_task) { | 1276 if (parameters().ui_task) { |
| 1288 g_browser_process->SetApplicationLocale("en-US"); | 1277 g_browser_process->SetApplicationLocale("en-US"); |
| 1289 } else { | 1278 } else { |
| 1290 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is | 1279 // Mac starts it earlier in |PreMainMessageLoopStart()| (because it is |
| 1291 // needed when loading the MainMenu.nib and the language doesn't depend on | 1280 // needed when loading the MainMenu.nib and the language doesn't depend on |
| 1292 // anything since it comes from Cocoa. | 1281 // anything since it comes from Cocoa. |
| 1293 #if defined(OS_MACOSX) | 1282 #if defined(OS_MACOSX) |
| 1294 g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride()); | 1283 g_browser_process->SetApplicationLocale(l10n_util::GetLocaleOverride()); |
| 1295 #else | 1284 #else |
| 1296 const std::string locale = | 1285 const std::string locale = |
| 1297 local_state_->GetString(prefs::kApplicationLocale); | 1286 local_state->GetString(prefs::kApplicationLocale); |
| 1298 // On a POSIX OS other than ChromeOS, the parameter that is passed to the | 1287 // On a POSIX OS other than ChromeOS, the parameter that is passed to the |
| 1299 // method InitSharedInstance is ignored. | 1288 // method InitSharedInstance is ignored. |
| 1300 const std::string loaded_locale = | 1289 const std::string loaded_locale = |
| 1301 ResourceBundle::InitSharedInstance(locale); | 1290 ResourceBundle::InitSharedInstance(locale); |
| 1302 if (loaded_locale.empty() && | 1291 if (loaded_locale.empty() && |
| 1303 !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) { | 1292 !parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) { |
| 1304 ShowMissingLocaleMessageBox(); | 1293 ShowMissingLocaleMessageBox(); |
| 1305 return chrome::RESULT_CODE_MISSING_DATA; | 1294 return chrome::RESULT_CODE_MISSING_DATA; |
| 1306 } | 1295 } |
| 1307 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; | 1296 CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1347 // This needs to be called after the locale has been set. | 1336 // This needs to be called after the locale has been set. |
| 1348 RegisterTranslateableItems(); | 1337 RegisterTranslateableItems(); |
| 1349 #endif | 1338 #endif |
| 1350 | 1339 |
| 1351 browser_init_.reset(new BrowserInit); | 1340 browser_init_.reset(new BrowserInit); |
| 1352 | 1341 |
| 1353 // On first run, we need to process the predictor preferences before the | 1342 // On first run, we need to process the predictor preferences before the |
| 1354 // browser's profile_manager object is created, but after ResourceBundle | 1343 // browser's profile_manager object is created, but after ResourceBundle |
| 1355 // is initialized. | 1344 // is initialized. |
| 1356 master_prefs_.reset(new FirstRun::MasterPrefs); | 1345 master_prefs_.reset(new FirstRun::MasterPrefs); |
| 1357 first_run_ui_bypass_ = false; // True to skip first run UI. | 1346 bool first_run_ui_bypass = false; // True to skip first run UI. |
| 1358 if (is_first_run_) { | 1347 if (is_first_run) { |
| 1359 first_run_ui_bypass_ = !FirstRun::ProcessMasterPreferences( | 1348 first_run_ui_bypass = |
| 1360 user_data_dir_, master_prefs_.get()); | 1349 !FirstRun::ProcessMasterPreferences(user_data_dir, master_prefs_.get()); |
| 1361 AddFirstRunNewTabs(browser_init_.get(), master_prefs_->new_tabs); | 1350 AddFirstRunNewTabs(browser_init_.get(), master_prefs_->new_tabs); |
| 1362 | 1351 |
| 1363 // If we are running in App mode, we do not want to show the importer | 1352 // If we are running in App mode, we do not want to show the importer |
| 1364 // (first run) UI. | 1353 // (first run) UI. |
| 1365 if (!first_run_ui_bypass_ && | 1354 if (!first_run_ui_bypass && |
| 1366 (parsed_command_line().HasSwitch(switches::kApp) || | 1355 (parsed_command_line().HasSwitch(switches::kApp) || |
| 1367 parsed_command_line().HasSwitch(switches::kAppId) || | 1356 parsed_command_line().HasSwitch(switches::kAppId) || |
| 1368 parsed_command_line().HasSwitch(switches::kNoFirstRun))) | 1357 parsed_command_line().HasSwitch(switches::kNoFirstRun))) |
| 1369 first_run_ui_bypass_ = true; | 1358 first_run_ui_bypass = true; |
| 1370 } | 1359 } |
| 1371 | 1360 |
| 1372 // TODO(viettrungluu): why don't we run this earlier? | 1361 // TODO(viettrungluu): why don't we run this earlier? |
| 1373 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) | 1362 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) |
| 1374 WarnAboutMinimumSystemRequirements(); | 1363 WarnAboutMinimumSystemRequirements(); |
| 1375 | 1364 |
| 1376 // Enable print preview once for supported platforms. | 1365 // Enable print preview once for supported platforms. |
| 1377 #if defined(GOOGLE_CHROME_BUILD) | 1366 #if defined(GOOGLE_CHROME_BUILD) |
| 1378 local_state_->RegisterBooleanPref(prefs::kPrintingPrintPreviewEnabledOnce, | 1367 local_state->RegisterBooleanPref(prefs::kPrintingPrintPreviewEnabledOnce, |
| 1379 false, | 1368 false, |
| 1380 PrefService::UNSYNCABLE_PREF); | 1369 PrefService::UNSYNCABLE_PREF); |
| 1381 if (!local_state_->GetBoolean(prefs::kPrintingPrintPreviewEnabledOnce)) { | 1370 if (!local_state->GetBoolean(prefs::kPrintingPrintPreviewEnabledOnce)) { |
| 1382 local_state_->SetBoolean(prefs::kPrintingPrintPreviewEnabledOnce, true); | 1371 local_state->SetBoolean(prefs::kPrintingPrintPreviewEnabledOnce, true); |
| 1383 about_flags::SetExperimentEnabled(local_state_, "print-preview", true); | 1372 about_flags::SetExperimentEnabled(local_state, "print-preview", true); |
| 1384 } | 1373 } |
| 1385 #endif | 1374 #endif |
| 1386 | 1375 |
| 1387 // Convert active labs into switches. Modifies the current command line. | 1376 // Convert active labs into switches. Modifies the current command line. |
| 1388 about_flags::ConvertFlagsToSwitches(local_state_, | 1377 about_flags::ConvertFlagsToSwitches(local_state, |
| 1389 CommandLine::ForCurrentProcess()); | 1378 CommandLine::ForCurrentProcess()); |
| 1390 | 1379 |
| 1391 // Reset the command line in the crash report details, since we may have | 1380 // Reset the command line in the crash report details, since we may have |
| 1392 // just changed it to include experiments. | 1381 // just changed it to include experiments. |
| 1393 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); | 1382 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); |
| 1394 | 1383 |
| 1395 InitializeNetworkOptions(parsed_command_line()); | 1384 InitializeNetworkOptions(parsed_command_line()); |
| 1396 InitializeURLRequestThrottlerManager(browser_process_->net_log()); | 1385 InitializeURLRequestThrottlerManager(browser_process_->net_log()); |
| 1397 | 1386 |
| 1398 // Initialize histogram synchronizer system. This is a singleton and is used | 1387 // Initialize histogram synchronizer system. This is a singleton and is used |
| 1399 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of | 1388 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of |
| 1400 // scope. Even though NewRunnableMethod does AddRef and Release, the object | 1389 // scope. Even though NewRunnableMethod does AddRef and Release, the object |
| 1401 // will not be deleted after the Task is executed. | 1390 // will not be deleted after the Task is executed. |
| 1402 histogram_synchronizer_ = new HistogramSynchronizer(); | 1391 histogram_synchronizer_ = new HistogramSynchronizer(); |
| 1403 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); | 1392 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); |
| 1404 | 1393 |
| 1394 // Now the command line has been mutated based on about:flags, we can |
| 1395 // set up metrics and initialize field trials. |
| 1396 MetricsService* metrics = SetupMetricsAndFieldTrials(local_state); |
| 1397 |
| 1405 #if defined(USE_WEBKIT_COMPOSITOR) | 1398 #if defined(USE_WEBKIT_COMPOSITOR) |
| 1406 // We need to ensure WebKit has been initialized before we start the WebKit | 1399 // We need to ensure WebKit has been initialized before we start the WebKit |
| 1407 // compositor. This is done by the ResourceDispatcherHost on creation. | 1400 // compositor. This is done by the ResourceDispatcherHost on creation. |
| 1408 g_browser_process->resource_dispatcher_host(); | 1401 g_browser_process->resource_dispatcher_host(); |
| 1409 #endif | 1402 #endif |
| 1410 | 1403 |
| 1411 // Now that all preferences have been registered, set the install date | 1404 // Now that all preferences have been registered, set the install date |
| 1412 // for the uninstall metrics if this is our first run. This only actually | 1405 // for the uninstall metrics if this is our first run. This only actually |
| 1413 // gets used if the user has metrics reporting enabled at uninstall time. | 1406 // gets used if the user has metrics reporting enabled at uninstall time. |
| 1414 int64 install_date = | 1407 int64 install_date = |
| 1415 local_state_->GetInt64(prefs::kUninstallMetricsInstallDate); | 1408 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); |
| 1416 if (install_date == 0) { | 1409 if (install_date == 0) { |
| 1417 local_state_->SetInt64(prefs::kUninstallMetricsInstallDate, | 1410 local_state->SetInt64(prefs::kUninstallMetricsInstallDate, |
| 1418 base::Time::Now().ToTimeT()); | 1411 base::Time::Now().ToTimeT()); |
| 1419 } | 1412 } |
| 1420 | 1413 |
| 1421 #if defined(OS_MACOSX) | 1414 #if defined(OS_MACOSX) |
| 1422 // Get the Keychain API to register for distributed notifications on the main | 1415 // Get the Keychain API to register for distributed notifications on the main |
| 1423 // thread, which has a proper CFRunloop, instead of later on the I/O thread, | 1416 // thread, which has a proper CFRunloop, instead of later on the I/O thread, |
| 1424 // which doesn't. This ensures those notifications will get delivered | 1417 // which doesn't. This ensures those notifications will get delivered |
| 1425 // properly. See issue 37766. | 1418 // properly. See issue 37766. |
| 1426 // (Note that the callback mask here is empty. I don't want to register for | 1419 // (Note that the callback mask here is empty. I don't want to register for |
| 1427 // any callbacks, I just want to initialize the mechanism.) | 1420 // any callbacks, I just want to initialize the mechanism.) |
| 1428 SecKeychainAddCallback(&KeychainCallback, 0, NULL); | 1421 SecKeychainAddCallback(&KeychainCallback, 0, NULL); |
| 1429 #endif | 1422 #endif |
| 1430 | 1423 |
| 1431 return content::RESULT_CODE_NORMAL_EXIT; | 1424 CreateChildThreads(browser_process_.get()); |
| 1432 } | |
| 1433 | |
| 1434 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | |
| 1435 // Create watchdog thread after creating all other threads because it will | |
| 1436 // watch the other threads and they must be running. | |
| 1437 browser_process_->watchdog_thread(); | |
| 1438 | 1425 |
| 1439 #if defined(OS_CHROMEOS) | 1426 #if defined(OS_CHROMEOS) |
| 1440 // Now that the file thread exists we can record our stats. | 1427 // Now that the file thread exists we can record our stats. |
| 1441 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); | 1428 chromeos::BootTimesLoader::Get()->RecordChromeMainStats(); |
| 1442 | 1429 |
| 1443 #if defined(TOOLKIT_USES_GTK) | 1430 #if defined(TOOLKIT_USES_GTK) |
| 1444 // Read locale-specific GTK resource information. | 1431 // Read locale-specific GTK resource information. |
| 1445 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC); | 1432 std::string gtkrc = l10n_util::GetStringUTF8(IDS_LOCALE_GTKRC); |
| 1446 if (!gtkrc.empty()) | 1433 if (!gtkrc.empty()) |
| 1447 gtk_rc_parse_string(gtkrc.c_str()); | 1434 gtk_rc_parse_string(gtkrc.c_str()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 // initialization code sees policy settings. | 1564 // initialization code sees policy settings. |
| 1578 g_browser_process->browser_policy_connector()->InitializeUserPolicy( | 1565 g_browser_process->browser_policy_connector()->InitializeUserPolicy( |
| 1579 username, false /* wait_for_policy_fetch */); | 1566 username, false /* wait_for_policy_fetch */); |
| 1580 } else if (parsed_command_line().HasSwitch(switches::kLoginManager)) { | 1567 } else if (parsed_command_line().HasSwitch(switches::kLoginManager)) { |
| 1581 // Initialize status area mode early on. | 1568 // Initialize status area mode early on. |
| 1582 chromeos::StatusAreaViewChromeos:: | 1569 chromeos::StatusAreaViewChromeos:: |
| 1583 SetScreenMode(chromeos::StatusAreaViewChromeos::LOGIN_MODE_WEBUI); | 1570 SetScreenMode(chromeos::StatusAreaViewChromeos::LOGIN_MODE_WEBUI); |
| 1584 } | 1571 } |
| 1585 #endif | 1572 #endif |
| 1586 | 1573 |
| 1587 if (is_first_run_) { | 1574 if (is_first_run) { |
| 1588 // Warn the ProfileManager that an import process will run, possibly | 1575 // Warn the ProfileManager that an import process will run, possibly |
| 1589 // locking the WebDataService directory of the next Profile created. | 1576 // locking the WebDataService directory of the next Profile created. |
| 1590 g_browser_process->profile_manager()->SetWillImport(); | 1577 g_browser_process->profile_manager()->SetWillImport(); |
| 1591 } | 1578 } |
| 1592 | 1579 |
| 1593 profile_ = CreateProfile(parameters(), user_data_dir_, parsed_command_line()); | 1580 profile_ = CreateProfile(parameters(), user_data_dir, parsed_command_line()); |
| 1594 if (!profile_) | 1581 if (!profile_) |
| 1595 return content::RESULT_CODE_NORMAL_EXIT; | 1582 return content::RESULT_CODE_NORMAL_EXIT; |
| 1596 | 1583 |
| 1597 // Autoload any profiles which are running background apps. | 1584 // Autoload any profiles which are running background apps. |
| 1598 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. | 1585 // TODO(rlp): Do this on a separate thread. See http://crbug.com/99075. |
| 1599 if (!BackgroundModeManager::IsBackgroundModePermanentlyDisabled( | 1586 if (!BackgroundModeManager::IsBackgroundModePermanentlyDisabled( |
| 1600 &parsed_command_line())) { | 1587 &parsed_command_line())) { |
| 1601 g_browser_process->profile_manager()->AutoloadProfiles(); | 1588 g_browser_process->profile_manager()->AutoloadProfiles(); |
| 1602 } | 1589 } |
| 1603 // Post-profile init --------------------------------------------------------- | 1590 // Post-profile init --------------------------------------------------------- |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 // TODO(stevenjb): Move ChromeOS login code into PostProfileInitialized(). | 1654 // TODO(stevenjb): Move ChromeOS login code into PostProfileInitialized(). |
| 1668 // (Requires making ChromeBrowserMainPartsChromeos a non "main" Parts). | 1655 // (Requires making ChromeBrowserMainPartsChromeos a non "main" Parts). |
| 1669 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1656 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1670 chrome_extra_parts_[i]->PostProfileInitialized(); | 1657 chrome_extra_parts_[i]->PostProfileInitialized(); |
| 1671 | 1658 |
| 1672 // Show the First Run UI if this is the first time Chrome has been run on | 1659 // Show the First Run UI if this is the first time Chrome has been run on |
| 1673 // this computer, or we're being compelled to do so by a command line flag. | 1660 // this computer, or we're being compelled to do so by a command line flag. |
| 1674 // Note that this be done _after_ the PrefService is initialized and all | 1661 // Note that this be done _after_ the PrefService is initialized and all |
| 1675 // preferences are registered, since some of the code that the importer | 1662 // preferences are registered, since some of the code that the importer |
| 1676 // touches reads preferences. | 1663 // touches reads preferences. |
| 1677 if (is_first_run_) { | 1664 if (is_first_run) { |
| 1678 if (!first_run_ui_bypass_) { | 1665 if (!first_run_ui_bypass) { |
| 1679 FirstRun::AutoImport(profile_, | 1666 FirstRun::AutoImport(profile_, |
| 1680 master_prefs_->homepage_defined, | 1667 master_prefs_->homepage_defined, |
| 1681 master_prefs_->do_import_items, | 1668 master_prefs_->do_import_items, |
| 1682 master_prefs_->dont_import_items, | 1669 master_prefs_->dont_import_items, |
| 1683 master_prefs_->run_search_engine_experiment, | 1670 master_prefs_->run_search_engine_experiment, |
| 1684 master_prefs_->randomize_search_engine_experiment, | 1671 master_prefs_->randomize_search_engine_experiment, |
| 1685 master_prefs_->make_chrome_default, | 1672 master_prefs_->make_chrome_default, |
| 1686 process_singleton_.get()); | 1673 process_singleton_.get()); |
| 1687 #if defined(OS_POSIX) | 1674 #if defined(OS_POSIX) |
| 1688 // On Windows, the download is tagged with enable/disable stats so there | 1675 // On Windows, the download is tagged with enable/disable stats so there |
| 1689 // is no need for this code. | 1676 // is no need for this code. |
| 1690 | 1677 |
| 1691 // If stats reporting was turned on by the first run dialog then toggle | 1678 // If stats reporting was turned on by the first run dialog then toggle |
| 1692 // the pref. | 1679 // the pref. |
| 1693 if (GoogleUpdateSettings::GetCollectStatsConsent()) | 1680 if (GoogleUpdateSettings::GetCollectStatsConsent()) |
| 1694 local_state_->SetBoolean(prefs::kMetricsReportingEnabled, true); | 1681 local_state->SetBoolean(prefs::kMetricsReportingEnabled, true); |
| 1695 #endif // OS_POSIX | 1682 #endif // OS_POSIX |
| 1696 } // if (!first_run_ui_bypass_) | 1683 } // if (!first_run_ui_bypass) |
| 1697 | 1684 |
| 1698 Browser::SetNewHomePagePrefs(profile_->GetPrefs()); | 1685 Browser::SetNewHomePagePrefs(profile_->GetPrefs()); |
| 1699 g_browser_process->profile_manager()->OnImportFinished(profile_); | 1686 g_browser_process->profile_manager()->OnImportFinished(profile_); |
| 1700 } // if (is_first_run) | 1687 } // if (is_first_run) |
| 1701 | 1688 |
| 1702 #if defined(OS_WIN) | 1689 #if defined(OS_WIN) |
| 1703 // Sets things up so that if we crash from this point on, a dialog will | 1690 // Sets things up so that if we crash from this point on, a dialog will |
| 1704 // popup asking the user to restart chrome. It is done this late to avoid | 1691 // popup asking the user to restart chrome. It is done this late to avoid |
| 1705 // testing against a bunch of special cases that are taken care early on. | 1692 // testing against a bunch of special cases that are taken care early on. |
| 1706 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( | 1693 ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 | 1792 |
| 1806 #if defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD) | 1793 #if defined(OS_WIN) && !defined(GOOGLE_CHROME_BUILD) |
| 1807 if (parsed_command_line().HasSwitch(switches::kDebugPrint)) { | 1794 if (parsed_command_line().HasSwitch(switches::kDebugPrint)) { |
| 1808 FilePath path = | 1795 FilePath path = |
| 1809 parsed_command_line().GetSwitchValuePath(switches::kDebugPrint); | 1796 parsed_command_line().GetSwitchValuePath(switches::kDebugPrint); |
| 1810 printing::PrintedDocument::set_debug_dump_path(path); | 1797 printing::PrintedDocument::set_debug_dump_path(path); |
| 1811 } | 1798 } |
| 1812 #endif | 1799 #endif |
| 1813 | 1800 |
| 1814 HandleTestParameters(parsed_command_line()); | 1801 HandleTestParameters(parsed_command_line()); |
| 1815 RecordBreakpadStatusUMA(metrics_); | 1802 RecordBreakpadStatusUMA(metrics); |
| 1816 about_flags::RecordUMAStatistics(local_state_); | 1803 about_flags::RecordUMAStatistics(local_state); |
| 1817 LanguageUsageMetrics::RecordAcceptLanguages( | 1804 LanguageUsageMetrics::RecordAcceptLanguages( |
| 1818 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); | 1805 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)); |
| 1819 LanguageUsageMetrics::RecordApplicationLanguage( | 1806 LanguageUsageMetrics::RecordApplicationLanguage( |
| 1820 g_browser_process->GetApplicationLocale()); | 1807 g_browser_process->GetApplicationLocale()); |
| 1821 | 1808 |
| 1822 #if defined(OS_WIN) | 1809 #if defined(OS_WIN) |
| 1823 fragmentation_checker::RecordFragmentationMetricForCurrentModule(); | 1810 fragmentation_checker::RecordFragmentationMetricForCurrentModule(); |
| 1824 #endif | 1811 #endif |
| 1825 | 1812 |
| 1826 #if defined(OS_CHROMEOS) | 1813 #if defined(OS_CHROMEOS) |
| 1827 metrics_->StartExternalMetrics(); | 1814 metrics->StartExternalMetrics(); |
| 1828 | 1815 |
| 1829 // Initialize the audio handler on ChromeOS. | 1816 // Initialize the audio handler on ChromeOS. |
| 1830 chromeos::AudioHandler::Initialize(); | 1817 chromeos::AudioHandler::Initialize(); |
| 1831 | 1818 |
| 1832 // Listen for system key events so that the user will be able to adjust the | 1819 // Listen for system key events so that the user will be able to adjust the |
| 1833 // volume on the login screen, if Chrome is running on Chrome OS | 1820 // volume on the login screen, if Chrome is running on Chrome OS |
| 1834 // (i.e. not Linux desktop), and in non-test mode. | 1821 // (i.e. not Linux desktop), and in non-test mode. |
| 1835 if (chromeos::system::runtime_environment::IsRunningOnChromeOS() && | 1822 if (chromeos::system::runtime_environment::IsRunningOnChromeOS() && |
| 1836 !parameters().ui_task) { // ui_task is non-NULL when running tests. | 1823 !parameters().ui_task) { // ui_task is non-NULL when running tests. |
| 1837 chromeos::SystemKeyEventListener::Initialize(); | 1824 chromeos::SystemKeyEventListener::Initialize(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1850 return content::RESULT_CODE_NORMAL_EXIT; | 1837 return content::RESULT_CODE_NORMAL_EXIT; |
| 1851 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; | 1838 return chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR; |
| 1852 } | 1839 } |
| 1853 | 1840 |
| 1854 // Start watching for a hang. | 1841 // Start watching for a hang. |
| 1855 MetricsService::LogNeedForCleanShutdown(); | 1842 MetricsService::LogNeedForCleanShutdown(); |
| 1856 | 1843 |
| 1857 #if defined(OS_WIN) | 1844 #if defined(OS_WIN) |
| 1858 // We check this here because if the profile is OTR (chromeos possibility) | 1845 // We check this here because if the profile is OTR (chromeos possibility) |
| 1859 // it won't still be accessible after browser is destroyed. | 1846 // it won't still be accessible after browser is destroyed. |
| 1860 record_search_engine_ = is_first_run_ && !profile_->IsOffTheRecord(); | 1847 record_search_engine_ = is_first_run && !profile_->IsOffTheRecord(); |
| 1861 #endif | 1848 #endif |
| 1862 | 1849 |
| 1863 // ChildProcess:: is a misnomer unless you consider context. Use | 1850 // ChildProcess:: is a misnomer unless you consider context. Use |
| 1864 // of --wait-for-debugger only makes sense when Chrome itself is a | 1851 // of --wait-for-debugger only makes sense when Chrome itself is a |
| 1865 // child process (e.g. when launched by PyAuto). | 1852 // child process (e.g. when launched by PyAuto). |
| 1866 if (parsed_command_line().HasSwitch(switches::kWaitForDebugger)) { | 1853 if (parsed_command_line().HasSwitch(switches::kWaitForDebugger)) { |
| 1867 ChildProcess::WaitForDebugger("Browser"); | 1854 ChildProcess::WaitForDebugger("Browser"); |
| 1868 } | 1855 } |
| 1869 | 1856 |
| 1870 #if defined(OS_CHROMEOS) | 1857 #if defined(OS_CHROMEOS) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1906 parameters().ui_task->Run(); | 1893 parameters().ui_task->Run(); |
| 1907 delete parameters().ui_task; | 1894 delete parameters().ui_task; |
| 1908 run_message_loop_ = false; | 1895 run_message_loop_ = false; |
| 1909 } else { | 1896 } else { |
| 1910 // Most general initialization is behind us, but opening a | 1897 // Most general initialization is behind us, but opening a |
| 1911 // tab and/or session restore and such is still to be done. | 1898 // tab and/or session restore and such is still to be done. |
| 1912 base::TimeTicks browser_open_start = base::TimeTicks::Now(); | 1899 base::TimeTicks browser_open_start = base::TimeTicks::Now(); |
| 1913 | 1900 |
| 1914 // We are in regular browser boot sequence. Open initial tabs and enter the | 1901 // We are in regular browser boot sequence. Open initial tabs and enter the |
| 1915 // main message loop. | 1902 // main message loop. |
| 1916 int result_code; | |
| 1917 if (browser_init_->Start(parsed_command_line(), FilePath(), profile_, | 1903 if (browser_init_->Start(parsed_command_line(), FilePath(), profile_, |
| 1918 &result_code)) { | 1904 &result_code_)) { |
| 1919 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 1905 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
| 1920 // Initialize autoupdate timer. Timer callback costs basically nothing | 1906 // Initialize autoupdate timer. Timer callback costs basically nothing |
| 1921 // when browser is not in persistent mode, so it's OK to let it ride on | 1907 // when browser is not in persistent mode, so it's OK to let it ride on |
| 1922 // the main thread. This needs to be done here because we don't want | 1908 // the main thread. This needs to be done here because we don't want |
| 1923 // to start the timer when Chrome is run inside a test harness. | 1909 // to start the timer when Chrome is run inside a test harness. |
| 1924 g_browser_process->StartAutoupdateTimer(); | 1910 g_browser_process->StartAutoupdateTimer(); |
| 1925 #endif | 1911 #endif |
| 1926 | 1912 |
| 1927 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1913 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1928 // On Linux, the running exe will be updated if an upgrade becomes | 1914 // On Linux, the running exe will be updated if an upgrade becomes |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 // The XInput2 event listener needs to be shut down earlier than when | 2061 // The XInput2 event listener needs to be shut down earlier than when |
| 2076 // Singletons are finally destroyed in AtExitManager. | 2062 // Singletons are finally destroyed in AtExitManager. |
| 2077 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); | 2063 chromeos::XInputHierarchyChangedEventListener::GetInstance()->Stop(); |
| 2078 | 2064 |
| 2079 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, | 2065 // chromeos::SystemKeyEventListener::Shutdown() is always safe to call, |
| 2080 // even if Initialize() wasn't called. | 2066 // even if Initialize() wasn't called. |
| 2081 chromeos::SystemKeyEventListener::Shutdown(); | 2067 chromeos::SystemKeyEventListener::Shutdown(); |
| 2082 chromeos::AudioHandler::Shutdown(); | 2068 chromeos::AudioHandler::Shutdown(); |
| 2083 #endif | 2069 #endif |
| 2084 | 2070 |
| 2085 restart_last_session_ = browser_shutdown::ShutdownPreThreadsStop(); | |
| 2086 browser_process_->StartTearDown(); | |
| 2087 } | |
| 2088 | |
| 2089 void ChromeBrowserMainParts::PreStopThread(BrowserThread::ID identifier) { | |
| 2090 browser_process_->PreStopThread(identifier); | |
| 2091 } | |
| 2092 | |
| 2093 void ChromeBrowserMainParts::PostStopThread(BrowserThread::ID identifier) { | |
| 2094 browser_process_->PostStopThread(identifier); | |
| 2095 } | |
| 2096 | |
| 2097 void ChromeBrowserMainParts::PostDestroyThreads() { | |
| 2098 // browser_shutdown takes care of deleting browser_process, so we need to | 2071 // browser_shutdown takes care of deleting browser_process, so we need to |
| 2099 // release it. | 2072 // release it. |
| 2100 ignore_result(browser_process_.release()); | 2073 ignore_result(browser_process_.release()); |
| 2101 browser_shutdown::ShutdownPostThreadsStop(restart_last_session_); | 2074 browser_shutdown::Shutdown(); |
| 2102 master_prefs_.reset(); | 2075 master_prefs_.reset(); |
| 2103 process_singleton_.reset(); | 2076 process_singleton_.reset(); |
| 2104 | 2077 |
| 2105 // We need to do this check as late as possible, but due to modularity, this | 2078 // We need to do this check as late as possible, but due to modularity, this |
| 2106 // may be the last point in Chrome. This would be more effective if done at | 2079 // may be the last point in Chrome. This would be more effective if done at |
| 2107 // a higher level on the stack, so that it is impossible for an early return | 2080 // a higher level on the stack, so that it is impossible for an early return |
| 2108 // to bypass this code. Perhaps we need a *final* hook that is called on all | 2081 // to bypass this code. Perhaps we need a *final* hook that is called on all |
| 2109 // paths from content/browser/browser_main. | 2082 // paths from content/browser/browser_main. |
| 2110 CHECK(MetricsService::UmaMetricsProperlyShutdown()); | 2083 CHECK(MetricsService::UmaMetricsProperlyShutdown()); |
| 2111 | 2084 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2141 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && | 2114 if (env->GetVar(chrome::kPreReadEnvironmentVariable, &pre_read) && |
| 2142 (pre_read == "0" || pre_read == "1")) { | 2115 (pre_read == "0" || pre_read == "1")) { |
| 2143 std::string uma_name(name); | 2116 std::string uma_name(name); |
| 2144 uma_name += "_PreRead"; | 2117 uma_name += "_PreRead"; |
| 2145 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; | 2118 uma_name += pre_read == "1" ? "Enabled" : "Disabled"; |
| 2146 AddPreReadHistogramTime(uma_name.c_str(), time); | 2119 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2147 } | 2120 } |
| 2148 #endif | 2121 #endif |
| 2149 #endif | 2122 #endif |
| 2150 } | 2123 } |
| OLD | NEW |