| 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/browser_main.h" | 5 #include "chrome/browser/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 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 InitializeNetworkOptions(parsed_command_line); | 1430 InitializeNetworkOptions(parsed_command_line); |
| 1431 InitializeURLRequestThrottlerManager(browser_process->net_log()); | 1431 InitializeURLRequestThrottlerManager(browser_process->net_log()); |
| 1432 | 1432 |
| 1433 // Initialize histogram synchronizer system. This is a singleton and is used | 1433 // Initialize histogram synchronizer system. This is a singleton and is used |
| 1434 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of | 1434 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of |
| 1435 // scope. Even though NewRunnableMethod does AddRef and Release, the object | 1435 // scope. Even though NewRunnableMethod does AddRef and Release, the object |
| 1436 // will not be deleted after the Task is executed. | 1436 // will not be deleted after the Task is executed. |
| 1437 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( | 1437 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( |
| 1438 new HistogramSynchronizer()); | 1438 new HistogramSynchronizer()); |
| 1439 | 1439 |
| 1440 // Initialize thread watcher system. This is a singleton and is used by | |
| 1441 // WatchDogThread to keep track of information about threads that are being | |
| 1442 // watched. | |
| 1443 scoped_ptr<ThreadWatcherList> thread_watcher_list(new ThreadWatcherList()); | |
| 1444 | |
| 1445 // Now the command line has been mutated based on about:flags, we can | 1440 // Now the command line has been mutated based on about:flags, we can |
| 1446 // set up metrics and initialize field trials. | 1441 // set up metrics and initialize field trials. |
| 1447 MetricsService* metrics = parts->SetupMetricsAndFieldTrials( | 1442 MetricsService* metrics = parts->SetupMetricsAndFieldTrials( |
| 1448 parsed_command_line, local_state); | 1443 parsed_command_line, local_state); |
| 1449 | 1444 |
| 1450 // Now that all preferences have been registered, set the install date | 1445 // Now that all preferences have been registered, set the install date |
| 1451 // for the uninstall metrics if this is our first run. This only actually | 1446 // for the uninstall metrics if this is our first run. This only actually |
| 1452 // gets used if the user has metrics reporting enabled at uninstall time. | 1447 // gets used if the user has metrics reporting enabled at uninstall time. |
| 1453 int64 install_date = | 1448 int64 install_date = |
| 1454 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); | 1449 local_state->GetInt64(prefs::kUninstallMetricsInstallDate); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 // Schedule a GPU blacklist auto update. This also loads the current one. | 1881 // Schedule a GPU blacklist auto update. This also loads the current one. |
| 1887 scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater = | 1882 scoped_refptr<GpuBlacklistUpdater> gpu_blacklist_updater = |
| 1888 new GpuBlacklistUpdater(); | 1883 new GpuBlacklistUpdater(); |
| 1889 // Don't start auto update in tests. | 1884 // Don't start auto update in tests. |
| 1890 if (parsed_command_line.GetSwitchValueASCII(switches::kUseGL) != | 1885 if (parsed_command_line.GetSwitchValueASCII(switches::kUseGL) != |
| 1891 gfx::kGLImplementationOSMesaName) { | 1886 gfx::kGLImplementationOSMesaName) { |
| 1892 gpu_blacklist_updater->StartAfterDelay(); | 1887 gpu_blacklist_updater->StartAfterDelay(); |
| 1893 } | 1888 } |
| 1894 | 1889 |
| 1895 // Start watching all browser threads for responsiveness. | 1890 // Start watching all browser threads for responsiveness. |
| 1896 ThreadWatcherList::StartWatchingAll(); | 1891 ThreadWatcherList::StartWatchingAll(parsed_command_line); |
| 1897 | 1892 |
| 1898 int result_code = ResultCodes::NORMAL_EXIT; | 1893 int result_code = ResultCodes::NORMAL_EXIT; |
| 1899 if (parameters.ui_task) { | 1894 if (parameters.ui_task) { |
| 1900 // We are in test mode. Run one task and enter the main message loop. | 1895 // We are in test mode. Run one task and enter the main message loop. |
| 1901 if (pool) | 1896 if (pool) |
| 1902 pool->Recycle(); | 1897 pool->Recycle(); |
| 1903 parameters.ui_task->Run(); | 1898 parameters.ui_task->Run(); |
| 1904 delete parameters.ui_task; | 1899 delete parameters.ui_task; |
| 1905 } else { | 1900 } else { |
| 1906 // Most general initialization is behind us, but opening a | 1901 // Most general initialization is behind us, but opening a |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 #if defined(OS_CHROMEOS) | 1998 #if defined(OS_CHROMEOS) |
| 2004 // To be precise, logout (browser shutdown) is not yet done, but the | 1999 // To be precise, logout (browser shutdown) is not yet done, but the |
| 2005 // remaining work is negligible, hence we say LogoutDone here. | 2000 // remaining work is negligible, hence we say LogoutDone here. |
| 2006 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2001 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
| 2007 false); | 2002 false); |
| 2008 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2003 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
| 2009 #endif | 2004 #endif |
| 2010 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2005 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
| 2011 return result_code; | 2006 return result_code; |
| 2012 } | 2007 } |
| OLD | NEW |