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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 #if defined(OS_CHROMEOS) | 551 #if defined(OS_CHROMEOS) |
552 // Test loading libcros and exit. We return 0 if the library could be loaded, | 552 // Test loading libcros and exit. We return 0 if the library could be loaded, |
553 // and 1 if it can't be. This is for validation that the library is installed | 553 // and 1 if it can't be. This is for validation that the library is installed |
554 // and versioned properly for Chrome to find. | 554 // and versioned properly for Chrome to find. |
555 if (command_line.HasSwitch(switches::kTestLoadLibcros)) | 555 if (command_line.HasSwitch(switches::kTestLoadLibcros)) |
556 exit(!chromeos::CrosLibrary::Get()->EnsureLoaded()); | 556 exit(!chromeos::CrosLibrary::Get()->EnsureLoaded()); |
557 #endif | 557 #endif |
558 } | 558 } |
559 | 559 |
560 void RunUIMessageLoop(BrowserProcess* browser_process) { | 560 void RunUIMessageLoop(BrowserProcess* browser_process) { |
561 TRACE_EVENT_BEGIN("BrowserMain:MESSAGE_LOOP", 0, ""); | 561 TRACE_EVENT_BEGIN_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
562 | 562 |
563 // If the UI thread blocks, the whole UI is unresponsive. | 563 // If the UI thread blocks, the whole UI is unresponsive. |
564 // Do not allow disk IO from the UI thread. | 564 // Do not allow disk IO from the UI thread. |
565 base::ThreadRestrictions::SetIOAllowed(false); | 565 base::ThreadRestrictions::SetIOAllowed(false); |
566 | 566 |
567 #if defined(TOOLKIT_VIEWS) | 567 #if defined(TOOLKIT_VIEWS) |
568 views::AcceleratorHandler accelerator_handler; | 568 views::AcceleratorHandler accelerator_handler; |
569 MessageLoopForUI::current()->Run(&accelerator_handler); | 569 MessageLoopForUI::current()->Run(&accelerator_handler); |
570 #elif defined(USE_X11) | 570 #elif defined(USE_X11) |
571 MessageLoopForUI::current()->Run(NULL); | 571 MessageLoopForUI::current()->Run(NULL); |
572 #elif defined(OS_POSIX) | 572 #elif defined(OS_POSIX) |
573 MessageLoopForUI::current()->Run(); | 573 MessageLoopForUI::current()->Run(); |
574 #endif | 574 #endif |
575 #if defined(OS_CHROMEOS) | 575 #if defined(OS_CHROMEOS) |
576 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", | 576 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("UIMessageLoopEnded", |
577 true); | 577 true); |
578 #endif | 578 #endif |
579 | 579 |
580 TRACE_EVENT_END("BrowserMain:MESSAGE_LOOP", 0, ""); | 580 TRACE_EVENT_END_ETW("BrowserMain:MESSAGE_LOOP", 0, ""); |
581 } | 581 } |
582 | 582 |
583 void AddFirstRunNewTabs(BrowserInit* browser_init, | 583 void AddFirstRunNewTabs(BrowserInit* browser_init, |
584 const std::vector<GURL>& new_tabs) { | 584 const std::vector<GURL>& new_tabs) { |
585 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); | 585 for (std::vector<GURL>::const_iterator it = new_tabs.begin(); |
586 it != new_tabs.end(); ++it) { | 586 it != new_tabs.end(); ++it) { |
587 if (it->is_valid()) | 587 if (it->is_valid()) |
588 browser_init->AddFirstRunTab(*it); | 588 browser_init->AddFirstRunTab(*it); |
589 } | 589 } |
590 } | 590 } |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 1090 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
1091 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 1091 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) |
1092 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | 1092 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; |
1093 #endif // #if defined(OS_CHROMEOS) | 1093 #endif // #if defined(OS_CHROMEOS) |
1094 return breakpad_enabled; | 1094 return breakpad_enabled; |
1095 } | 1095 } |
1096 #endif // #if defined(USE_LINUX_BREAKPAD) | 1096 #endif // #if defined(USE_LINUX_BREAKPAD) |
1097 | 1097 |
1098 // Main routine for running as the Browser process. | 1098 // Main routine for running as the Browser process. |
1099 int BrowserMain(const MainFunctionParams& parameters) { | 1099 int BrowserMain(const MainFunctionParams& parameters) { |
1100 TRACE_EVENT_BEGIN("BrowserMain", 0, ""); | 1100 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); |
1101 | 1101 |
1102 // If we're running tests (ui_task is non-null). | 1102 // If we're running tests (ui_task is non-null). |
1103 if (parameters.ui_task) | 1103 if (parameters.ui_task) |
1104 browser_defaults::enable_help_app = false; | 1104 browser_defaults::enable_help_app = false; |
1105 | 1105 |
1106 scoped_ptr<BrowserMainParts> | 1106 scoped_ptr<BrowserMainParts> |
1107 parts(BrowserMainParts::CreateBrowserMainParts(parameters)); | 1107 parts(BrowserMainParts::CreateBrowserMainParts(parameters)); |
1108 | 1108 |
1109 parts->EarlyInitialization(); | 1109 parts->EarlyInitialization(); |
1110 | 1110 |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 ignore_result(browser_process.release()); | 1860 ignore_result(browser_process.release()); |
1861 browser_shutdown::Shutdown(); | 1861 browser_shutdown::Shutdown(); |
1862 | 1862 |
1863 #if defined(OS_CHROMEOS) | 1863 #if defined(OS_CHROMEOS) |
1864 // To be precise, logout (browser shutdown) is not yet done, but the | 1864 // To be precise, logout (browser shutdown) is not yet done, but the |
1865 // remaining work is negligible, hence we say LogoutDone here. | 1865 // remaining work is negligible, hence we say LogoutDone here. |
1866 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1866 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1867 false); | 1867 false); |
1868 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1868 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1869 #endif | 1869 #endif |
1870 TRACE_EVENT_END("BrowserMain", 0, 0); | 1870 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
1871 return result_code; | 1871 return result_code; |
1872 } | 1872 } |
OLD | NEW |