| OLD | NEW |
| 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 <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "chrome/browser/metrics/tracking_synchronizer.h" | 62 #include "chrome/browser/metrics/tracking_synchronizer.h" |
| 63 #include "chrome/browser/metrics/variations/variations_service.h" | 63 #include "chrome/browser/metrics/variations/variations_service.h" |
| 64 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" | 64 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h" |
| 65 #include "chrome/browser/net/chrome_net_log.h" | 65 #include "chrome/browser/net/chrome_net_log.h" |
| 66 #include "chrome/browser/net/crl_set_fetcher.h" | 66 #include "chrome/browser/net/crl_set_fetcher.h" |
| 67 #include "chrome/browser/notifications/desktop_notification_service.h" | 67 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 68 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 68 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 69 #include "chrome/browser/performance_monitor/performance_monitor.h" | 69 #include "chrome/browser/performance_monitor/performance_monitor.h" |
| 70 #include "chrome/browser/performance_monitor/startup_timer.h" | 70 #include "chrome/browser/performance_monitor/startup_timer.h" |
| 71 #include "chrome/browser/plugins/plugin_prefs.h" | 71 #include "chrome/browser/plugins/plugin_prefs.h" |
| 72 #include "chrome/browser/power/process_power_collector.h" |
| 72 #include "chrome/browser/pref_service_flags_storage.h" | 73 #include "chrome/browser/pref_service_flags_storage.h" |
| 73 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 74 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 74 #include "chrome/browser/prefs/command_line_pref_store.h" | 75 #include "chrome/browser/prefs/command_line_pref_store.h" |
| 75 #include "chrome/browser/prefs/pref_metrics_service.h" | 76 #include "chrome/browser/prefs/pref_metrics_service.h" |
| 76 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 77 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
| 77 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 78 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 78 #include "chrome/browser/process_singleton.h" | 79 #include "chrome/browser/process_singleton.h" |
| 79 #include "chrome/browser/profiles/profile.h" | 80 #include "chrome/browser/profiles/profile.h" |
| 80 #include "chrome/browser/profiles/profile_manager.h" | 81 #include "chrome/browser/profiles/profile_manager.h" |
| 81 #include "chrome/browser/profiles/profiles_state.h" | 82 #include "chrome/browser/profiles/profiles_state.h" |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 | 1541 |
| 1541 run_message_loop_ = true; | 1542 run_message_loop_ = true; |
| 1542 } else { | 1543 } else { |
| 1543 run_message_loop_ = false; | 1544 run_message_loop_ = false; |
| 1544 } | 1545 } |
| 1545 browser_creator_.reset(); | 1546 browser_creator_.reset(); |
| 1546 #endif // !defined(OS_ANDROID) | 1547 #endif // !defined(OS_ANDROID) |
| 1547 | 1548 |
| 1548 performance_monitor::PerformanceMonitor::GetInstance()->Initialize(); | 1549 performance_monitor::PerformanceMonitor::GetInstance()->Initialize(); |
| 1549 | 1550 |
| 1551 #if !defined(OS_ANDROID) |
| 1552 process_power_collector_.reset(new ProcessPowerCollector); |
| 1553 process_power_collector_->Initialize(); |
| 1554 #endif |
| 1555 |
| 1550 PostBrowserStart(); | 1556 PostBrowserStart(); |
| 1551 | 1557 |
| 1552 if (parameters().ui_task) { | 1558 if (parameters().ui_task) { |
| 1553 // We end the startup timer here if we have parameters to run, because we | 1559 // We end the startup timer here if we have parameters to run, because we |
| 1554 // never start to run the main loop (where we normally stop the timer). | 1560 // never start to run the main loop (where we normally stop the timer). |
| 1555 startup_timer_->SignalStartupComplete( | 1561 startup_timer_->SignalStartupComplete( |
| 1556 performance_monitor::StartupTimer::STARTUP_TEST); | 1562 performance_monitor::StartupTimer::STARTUP_TEST); |
| 1557 parameters().ui_task->Run(); | 1563 parameters().ui_task->Run(); |
| 1558 delete parameters().ui_task; | 1564 delete parameters().ui_task; |
| 1559 run_message_loop_ = false; | 1565 run_message_loop_ = false; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 | 1618 |
| 1613 // Start watching for jank during shutdown. It gets disarmed when | 1619 // Start watching for jank during shutdown. It gets disarmed when |
| 1614 // |shutdown_watcher_| object is destructed. | 1620 // |shutdown_watcher_| object is destructed. |
| 1615 MetricsService::SetExecutionPhase(MetricsService::SHUTDOWN_TIMEBOMB_ARM, | 1621 MetricsService::SetExecutionPhase(MetricsService::SHUTDOWN_TIMEBOMB_ARM, |
| 1616 g_browser_process->local_state()); | 1622 g_browser_process->local_state()); |
| 1617 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1623 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
| 1618 | 1624 |
| 1619 // Disarm the startup hang detector time bomb if it is still Arm'ed. | 1625 // Disarm the startup hang detector time bomb if it is still Arm'ed. |
| 1620 startup_watcher_->Disarm(); | 1626 startup_watcher_->Disarm(); |
| 1621 | 1627 |
| 1628 // Remove observers attached to D-Bus clients before DbusThreadManager is |
| 1629 // shut down. |
| 1630 process_power_collector_.reset(); |
| 1631 |
| 1622 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) | 1632 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) |
| 1623 chrome_extra_parts_[i]->PostMainMessageLoopRun(); | 1633 chrome_extra_parts_[i]->PostMainMessageLoopRun(); |
| 1624 | 1634 |
| 1625 // Some tests don't set parameters.ui_task, so they started translate | 1635 // Some tests don't set parameters.ui_task, so they started translate |
| 1626 // language fetch that was never completed so we need to cleanup here | 1636 // language fetch that was never completed so we need to cleanup here |
| 1627 // otherwise it will be done by the destructor in a wrong thread. | 1637 // otherwise it will be done by the destructor in a wrong thread. |
| 1628 TranslateService::Shutdown(parameters().ui_task == NULL); | 1638 TranslateService::Shutdown(parameters().ui_task == NULL); |
| 1629 | 1639 |
| 1630 if (notify_result_ == ProcessSingleton::PROCESS_NONE) | 1640 if (notify_result_ == ProcessSingleton::PROCESS_NONE) |
| 1631 process_singleton_->Cleanup(); | 1641 process_singleton_->Cleanup(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 chromeos::CrosSettings::Shutdown(); | 1675 chromeos::CrosSettings::Shutdown(); |
| 1666 #endif | 1676 #endif |
| 1667 #endif | 1677 #endif |
| 1668 } | 1678 } |
| 1669 | 1679 |
| 1670 // Public members: | 1680 // Public members: |
| 1671 | 1681 |
| 1672 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1682 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 1673 chrome_extra_parts_.push_back(parts); | 1683 chrome_extra_parts_.push_back(parts); |
| 1674 } | 1684 } |
| OLD | NEW |