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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 50 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
51 #include "chrome/browser/metrics/histogram_synchronizer.h" | 51 #include "chrome/browser/metrics/histogram_synchronizer.h" |
52 #include "chrome/browser/metrics/metrics_log.h" | 52 #include "chrome/browser/metrics/metrics_log.h" |
53 #include "chrome/browser/metrics/metrics_service.h" | 53 #include "chrome/browser/metrics/metrics_service.h" |
54 #include "chrome/browser/metrics/thread_watcher.h" | 54 #include "chrome/browser/metrics/thread_watcher.h" |
55 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" | 55 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" |
56 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 56 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
57 #include "chrome/browser/net/chrome_net_log.h" | 57 #include "chrome/browser/net/chrome_net_log.h" |
58 #include "chrome/browser/net/predictor_api.h" | 58 #include "chrome/browser/net/predictor_api.h" |
59 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 59 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
60 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" | |
61 #include "chrome/browser/plugin_updater.h" | 60 #include "chrome/browser/plugin_updater.h" |
62 #include "chrome/browser/policy/browser_policy_connector.h" | 61 #include "chrome/browser/policy/browser_policy_connector.h" |
63 #include "chrome/browser/prefs/pref_service.h" | 62 #include "chrome/browser/prefs/pref_service.h" |
64 #include "chrome/browser/prefs/pref_value_store.h" | 63 #include "chrome/browser/prefs/pref_value_store.h" |
65 #include "chrome/browser/prerender/prerender_field_trial.h" | 64 #include "chrome/browser/prerender/prerender_field_trial.h" |
66 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 65 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
67 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 66 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
68 #include "chrome/browser/process_singleton.h" | 67 #include "chrome/browser/process_singleton.h" |
69 #include "chrome/browser/profiles/profile.h" | 68 #include "chrome/browser/profiles/profile.h" |
70 #include "chrome/browser/profiles/profile_manager.h" | 69 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 if (enabled) { | 639 if (enabled) { |
641 metrics->Start(); | 640 metrics->Start(); |
642 } | 641 } |
643 #endif // defined(GOOGLE_CHROME_BUILD) | 642 #endif // defined(GOOGLE_CHROME_BUILD) |
644 | 643 |
645 return metrics; | 644 return metrics; |
646 } | 645 } |
647 | 646 |
648 void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, | 647 void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, |
649 bool proxy_policy_is_set) { | 648 bool proxy_policy_is_set) { |
650 if (metrics_recording_enabled) | |
651 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start(); | |
652 | |
653 // Note: make sure to call ConnectionFieldTrial() before | 649 // Note: make sure to call ConnectionFieldTrial() before |
654 // ProxyConnectionsFieldTrial(). | 650 // ProxyConnectionsFieldTrial(). |
655 ConnectionFieldTrial(); | 651 ConnectionFieldTrial(); |
656 SocketTimeoutFieldTrial(); | 652 SocketTimeoutFieldTrial(); |
657 // If a policy is defining the number of active connections this field test | 653 // If a policy is defining the number of active connections this field test |
658 // shoud not be performed. | 654 // shoud not be performed. |
659 if (!proxy_policy_is_set) | 655 if (!proxy_policy_is_set) |
660 ProxyConnectionsFieldTrial(); | 656 ProxyConnectionsFieldTrial(); |
661 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 657 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
662 InstantFieldTrial::Activate(); | 658 InstantFieldTrial::Activate(); |
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 } | 2093 } |
2098 #endif | 2094 #endif |
2099 | 2095 |
2100 // Some tests don't set parameters.ui_task, so they started translate | 2096 // Some tests don't set parameters.ui_task, so they started translate |
2101 // language fetch that was never completed so we need to cleanup here | 2097 // language fetch that was never completed so we need to cleanup here |
2102 // otherwise it will be done by the destructor in a wrong thread. | 2098 // otherwise it will be done by the destructor in a wrong thread. |
2103 if (parameters.ui_task == NULL && translate_manager != NULL) | 2099 if (parameters.ui_task == NULL && translate_manager != NULL) |
2104 translate_manager->CleanupPendingUlrFetcher(); | 2100 translate_manager->CleanupPendingUlrFetcher(); |
2105 | 2101 |
2106 | 2102 |
2107 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Stop(); | |
2108 | |
2109 process_singleton.Cleanup(); | 2103 process_singleton.Cleanup(); |
2110 | 2104 |
2111 // Stop all tasks that might run on WatchDogThread. | 2105 // Stop all tasks that might run on WatchDogThread. |
2112 ThreadWatcherList::StopWatchingAll(); | 2106 ThreadWatcherList::StopWatchingAll(); |
2113 | 2107 |
2114 metrics->Stop(); | 2108 metrics->Stop(); |
2115 | 2109 |
2116 // browser_shutdown takes care of deleting browser_process, so we need to | 2110 // browser_shutdown takes care of deleting browser_process, so we need to |
2117 // release it. | 2111 // release it. |
2118 ignore_result(browser_process.release()); | 2112 ignore_result(browser_process.release()); |
2119 browser_shutdown::Shutdown(); | 2113 browser_shutdown::Shutdown(); |
2120 | 2114 |
2121 #if defined(OS_CHROMEOS) | 2115 #if defined(OS_CHROMEOS) |
2122 // To be precise, logout (browser shutdown) is not yet done, but the | 2116 // To be precise, logout (browser shutdown) is not yet done, but the |
2123 // remaining work is negligible, hence we say LogoutDone here. | 2117 // remaining work is negligible, hence we say LogoutDone here. |
2124 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2118 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
2125 false); | 2119 false); |
2126 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2120 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
2127 #endif | 2121 #endif |
2128 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2122 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
2129 return result_code; | 2123 return result_code; |
2130 } | 2124 } |
OLD | NEW |