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 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/crash_logging.h" | 14 #include "base/debug/crash_logging.h" |
15 #include "base/debug/debugger.h" | 15 #include "base/debug/debugger.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
18 #include "base/metrics/field_trial.h" | 18 #include "base/metrics/field_trial.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/prefs/json_pref_store.h" | 21 #include "base/prefs/json_pref_store.h" |
22 #include "base/prefs/pref_registry_simple.h" | 22 #include "base/prefs/pref_registry_simple.h" |
23 #include "base/prefs/pref_service.h" | 23 #include "base/prefs/pref_service.h" |
24 #include "base/prefs/pref_value_store.h" | 24 #include "base/prefs/pref_value_store.h" |
25 #include "base/prefs/scoped_user_pref_update.h" | 25 #include "base/prefs/scoped_user_pref_update.h" |
26 #include "base/process/process_info.h" | 26 #include "base/process/process_info.h" |
27 #include "base/profiler/cpu_profiler.h" | |
27 #include "base/profiler/scoped_tracker.h" | 28 #include "base/profiler/scoped_tracker.h" |
28 #include "base/run_loop.h" | 29 #include "base/run_loop.h" |
29 #include "base/strings/string_number_conversions.h" | 30 #include "base/strings/string_number_conversions.h" |
30 #include "base/strings/string_piece.h" | 31 #include "base/strings/string_piece.h" |
31 #include "base/strings/string_split.h" | 32 #include "base/strings/string_split.h" |
32 #include "base/strings/sys_string_conversions.h" | 33 #include "base/strings/sys_string_conversions.h" |
33 #include "base/strings/utf_string_conversions.h" | 34 #include "base/strings/utf_string_conversions.h" |
34 #include "base/sys_info.h" | 35 #include "base/sys_info.h" |
35 #include "base/threading/platform_thread.h" | 36 #include "base/threading/platform_thread.h" |
36 #include "base/time/time.h" | 37 #include "base/time/time.h" |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
989 // Must be done after g_browser_process is constructed, before | 990 // Must be done after g_browser_process is constructed, before |
990 // SetupMetricsAndFieldTrials(). | 991 // SetupMetricsAndFieldTrials(). |
991 chromeos::CrosSettings::Initialize(); | 992 chromeos::CrosSettings::Initialize(); |
992 #endif | 993 #endif |
993 | 994 |
994 // Now the command line has been mutated based on about:flags, we can setup | 995 // Now the command line has been mutated based on about:flags, we can setup |
995 // metrics and initialize field trials. The field trials are needed by | 996 // metrics and initialize field trials. The field trials are needed by |
996 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. | 997 // IOThread's initialization which happens in BrowserProcess:PreCreateThreads. |
997 SetupMetricsAndFieldTrials(); | 998 SetupMetricsAndFieldTrials(); |
998 | 999 |
1000 std::map<std::string, std::string> params; | |
cpu_(ooo_6.6-7.5)
2015/02/05 01:03:27
you need a better name for this map, this is a tho
Mike Wittman
2015/02/05 02:08:48
Changed to a pointer parameter.
| |
1001 base::CpuProfiler::Initialize(params); | |
1002 | |
999 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. | 1003 // ChromeOS needs ResourceBundle::InitSharedInstance to be called before this. |
1000 browser_process_->PreCreateThreads(); | 1004 browser_process_->PreCreateThreads(); |
1001 | 1005 |
1002 return content::RESULT_CODE_NORMAL_EXIT; | 1006 return content::RESULT_CODE_NORMAL_EXIT; |
1003 } | 1007 } |
1004 | 1008 |
1005 void ChromeBrowserMainParts::PreMainMessageLoopRun() { | 1009 void ChromeBrowserMainParts::PreMainMessageLoopRun() { |
1006 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); | 1010 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun"); |
1007 result_code_ = PreMainMessageLoopRunImpl(); | 1011 result_code_ = PreMainMessageLoopRunImpl(); |
1008 | 1012 |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1643 } | 1647 } |
1644 | 1648 |
1645 void ChromeBrowserMainParts::PostMainMessageLoopRun() { | 1649 void ChromeBrowserMainParts::PostMainMessageLoopRun() { |
1646 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostMainMessageLoopRun"); | 1650 TRACE_EVENT0("startup", "ChromeBrowserMainParts::PostMainMessageLoopRun"); |
1647 #if defined(OS_ANDROID) | 1651 #if defined(OS_ANDROID) |
1648 // Chrome on Android does not use default MessageLoop. It has its own | 1652 // Chrome on Android does not use default MessageLoop. It has its own |
1649 // Android specific MessageLoop | 1653 // Android specific MessageLoop |
1650 NOTREACHED(); | 1654 NOTREACHED(); |
1651 #else | 1655 #else |
1652 | 1656 |
1657 base::CpuProfiler::Stop(); | |
1658 | |
1653 // Start watching for jank during shutdown. It gets disarmed when | 1659 // Start watching for jank during shutdown. It gets disarmed when |
1654 // |shutdown_watcher_| object is destructed. | 1660 // |shutdown_watcher_| object is destructed. |
1655 metrics::MetricsService::SetExecutionPhase( | 1661 metrics::MetricsService::SetExecutionPhase( |
1656 metrics::MetricsService::SHUTDOWN_TIMEBOMB_ARM, | 1662 metrics::MetricsService::SHUTDOWN_TIMEBOMB_ARM, |
1657 g_browser_process->local_state()); | 1663 g_browser_process->local_state()); |
1658 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); | 1664 shutdown_watcher_->Arm(base::TimeDelta::FromSeconds(300)); |
1659 | 1665 |
1660 // Disarm the startup hang detector time bomb if it is still Arm'ed. | 1666 // Disarm the startup hang detector time bomb if it is still Arm'ed. |
1661 startup_watcher_->Disarm(); | 1667 startup_watcher_->Disarm(); |
1662 | 1668 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1710 chromeos::CrosSettings::Shutdown(); | 1716 chromeos::CrosSettings::Shutdown(); |
1711 #endif | 1717 #endif |
1712 #endif | 1718 #endif |
1713 } | 1719 } |
1714 | 1720 |
1715 // Public members: | 1721 // Public members: |
1716 | 1722 |
1717 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 1723 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
1718 chrome_extra_parts_.push_back(parts); | 1724 chrome_extra_parts_.push_back(parts); |
1719 } | 1725 } |
OLD | NEW |