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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 #if defined(OS_CHROMEOS) | 586 #if defined(OS_CHROMEOS) |
587 // Test loading libcros and exit. We return 0 if the library could be loaded, | 587 // Test loading libcros and exit. We return 0 if the library could be loaded, |
588 // and 1 if it can't be. This is for validation that the library is installed | 588 // and 1 if it can't be. This is for validation that the library is installed |
589 // and versioned properly for Chrome to find. | 589 // and versioned properly for Chrome to find. |
590 if (command_line.HasSwitch(switches::kTestLoadLibcros)) | 590 if (command_line.HasSwitch(switches::kTestLoadLibcros)) |
591 exit(!chromeos::CrosLibrary::Get()->EnsureLoaded()); | 591 exit(!chromeos::CrosLibrary::Get()->EnsureLoaded()); |
592 #endif | 592 #endif |
593 } | 593 } |
594 | 594 |
595 void RunUIMessageLoop(BrowserProcess* browser_process) { | 595 void RunUIMessageLoop(BrowserProcess* browser_process) { |
596 TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); | 596 TRACE_EVENT_BEGIN_LEGACY("BrowserMain:MESSAGE_LOOP", 0, ""); |
597 | 597 |
598 // If the UI thread blocks, the whole UI is unresponsive. | 598 // If the UI thread blocks, the whole UI is unresponsive. |
599 // Do not allow disk IO from the UI thread. | 599 // Do not allow disk IO from the UI thread. |
600 base::ThreadRestrictions::SetIOAllowed(false); | 600 base::ThreadRestrictions::SetIOAllowed(false); |
601 | 601 |
602 #if defined(TOOLKIT_VIEWS) | 602 #if defined(TOOLKIT_VIEWS) |
603 views::AcceleratorHandler accelerator_handler; | 603 views::AcceleratorHandler accelerator_handler; |
604 MessageLoopForUI::current()->Run(&accelerator_handler); | 604 MessageLoopForUI::current()->Run(&accelerator_handler); |
605 #elif defined(USE_X11) | 605 #elif defined(USE_X11) |
606 MessageLoopForUI::current()->Run(NULL); | 606 MessageLoopForUI::current()->Run(NULL); |
607 #elif defined(OS_POSIX) | 607 #elif defined(OS_POSIX) |
608 MessageLoopForUI::current()->Run(); | 608 MessageLoopForUI::current()->Run(); |
609 #endif | 609 #endif |
610 #if defined(OS_CHROMEOS) | 610 #if defined(OS_CHROMEOS) |
611 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", | 611 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", |
612 true); | 612 true); |
613 #endif | 613 #endif |
614 | 614 |
615 TRACE_EVENT_END("BrowserMain:MESSAGE_LOOP", 0, ""); | 615 TRACE_EVENT_END_LEGACY("BrowserMain:MESSAGE_LOOP", 0, ""); |
616 } | 616 } |
617 | 617 |
618 void AddFirstRunNewTabs(BrowserInit* browser_init, | 618 void AddFirstRunNewTabs(BrowserInit* browser_init, |
619 const std::vector<GURL>& new_tabs) { | 619 const std::vector<GURL>& new_tabs) { |
620 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); | 620 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); |
621 it != new_tabs.end(); ++it) { | 621 it != new_tabs.end(); ++it) { |
622 if (it->is_valid()) | 622 if (it->is_valid()) |
623 browser_init->AddFirstRunTab(*it); | 623 browser_init->AddFirstRunTab(*it); |
624 } | 624 } |
625 } | 625 } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 1120 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
1121 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 1121 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
1122 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 1122 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
1123 #endif // #if defined(OS_CHROMEOS) | 1123 #endif // #if defined(OS_CHROMEOS) |
1124 return breakpad_enabled; | 1124 return breakpad_enabled; |
1125 } | 1125 } |
1126 #endif // #if defined(USE_LINUX_BREAKPAD) | 1126 #endif // #if defined(USE_LINUX_BREAKPAD) |
1127 | 1127 |
1128 // Main routine for running as the Browser process. | 1128 // Main routine for running as the Browser process. |
1129 int BrowserMain(const MainFunctionParams& parameters) { | 1129 int BrowserMain(const MainFunctionParams& parameters) { |
1130 TRACE_EVENT_BEGIN("BrowserMain", 0, ""); | 1130 TRACE_EVENT_BEGIN_LEGACY("BrowserMain", 0, ""); |
1131 | 1131 |
1132 // If we're running tests (ui_task is non-null). | 1132 // If we're running tests (ui_task is non-null). |
1133 if (parameters.ui_task) | 1133 if (parameters.ui_task) |
1134 browser_defaults::enable_help_app = false; | 1134 browser_defaults::enable_help_app = false; |
1135 | 1135 |
1136 scoped_ptr<BrowserMainParts> | 1136 scoped_ptr<BrowserMainParts> |
1137 parts(BrowserMainParts::CreateBrowserMainParts(parameters)); | 1137 parts(BrowserMainParts::CreateBrowserMainParts(parameters)); |
1138 | 1138 |
1139 parts->EarlyInitialization(); | 1139 parts->EarlyInitialization(); |
1140 | 1140 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 ignore_result(browser_process.release()); | 1848 ignore_result(browser_process.release()); |
1849 browser_shutdown::Shutdown(); | 1849 browser_shutdown::Shutdown(); |
1850 | 1850 |
1851 #if defined(OS_CHROMEOS) | 1851 #if defined(OS_CHROMEOS) |
1852 // To be precise, logout (browser shutdown) is not yet done, but the | 1852 // To be precise, logout (browser shutdown) is not yet done, but the |
1853 // remaining work is negligible, hence we say LogoutDone here. | 1853 // remaining work is negligible, hence we say LogoutDone here. |
1854 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1854 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1855 false); | 1855 false); |
1856 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1856 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1857 #endif | 1857 #endif |
1858 TRACE_EVENT_END("BrowserMain", 0, 0); | 1858 TRACE_EVENT_END_LEGACY("BrowserMain", 0, 0); |
1859 return result_code; | 1859 return result_code; |
1860 } | 1860 } |
OLD | NEW |