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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "chrome/browser/first_run/first_run_browser_process.h" | 45 #include "chrome/browser/first_run/first_run_browser_process.h" |
46 #include "chrome/browser/first_run/upgrade_util.h" | 46 #include "chrome/browser/first_run/upgrade_util.h" |
47 #include "chrome/browser/jankometer.h" | 47 #include "chrome/browser/jankometer.h" |
48 #include "chrome/browser/metrics/field_trial_synchronizer.h" | 48 #include "chrome/browser/metrics/field_trial_synchronizer.h" |
49 #include "chrome/browser/metrics/histogram_synchronizer.h" | 49 #include "chrome/browser/metrics/histogram_synchronizer.h" |
50 #include "chrome/browser/metrics/metrics_log.h" | 50 #include "chrome/browser/metrics/metrics_log.h" |
51 #include "chrome/browser/metrics/metrics_service.h" | 51 #include "chrome/browser/metrics/metrics_service.h" |
52 #include "chrome/browser/metrics/thread_watcher.h" | 52 #include "chrome/browser/metrics/thread_watcher.h" |
53 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" | 53 #include "chrome/browser/net/chrome_dns_cert_provenance_checker.h" |
54 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 54 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
55 #include "chrome/browser/net/chrome_net_log.h" | |
55 #include "chrome/browser/net/predictor_api.h" | 56 #include "chrome/browser/net/predictor_api.h" |
56 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 57 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
57 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" | 58 #include "chrome/browser/net/websocket_experiment/websocket_experiment_runner.h" |
58 #include "chrome/browser/plugin_updater.h" | 59 #include "chrome/browser/plugin_updater.h" |
59 #include "chrome/browser/prefs/pref_service.h" | 60 #include "chrome/browser/prefs/pref_service.h" |
60 #include "chrome/browser/prefs/pref_value_store.h" | 61 #include "chrome/browser/prefs/pref_value_store.h" |
61 #include "chrome/browser/prerender/prerender_field_trial.h" | 62 #include "chrome/browser/prerender/prerender_field_trial.h" |
62 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 63 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
63 #include "chrome/browser/process_singleton.h" | 64 #include "chrome/browser/process_singleton.h" |
64 #include "chrome/browser/profiles/profile.h" | 65 #include "chrome/browser/profiles/profile.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 #endif | 197 #endif |
197 | 198 |
198 #if defined(TOOLKIT_USES_GTK) | 199 #if defined(TOOLKIT_USES_GTK) |
199 #include "ui/gfx/gtk_util.h" | 200 #include "ui/gfx/gtk_util.h" |
200 #endif | 201 #endif |
201 | 202 |
202 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) | 203 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) |
203 #include "views/touchui/touch_factory.h" | 204 #include "views/touchui/touch_factory.h" |
204 #endif | 205 #endif |
205 | 206 |
207 namespace net { | |
208 class NetLog; | |
209 } | |
yzshen1
2011/05/25 03:49:06
Please add "// namespace net"
Jói
2011/05/25 14:30:35
Done.
| |
210 | |
206 // BrowserMainParts ------------------------------------------------------------ | 211 // BrowserMainParts ------------------------------------------------------------ |
207 | 212 |
208 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) | 213 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) |
209 : parameters_(parameters), | 214 : parameters_(parameters), |
210 parsed_command_line_(parameters.command_line_) { | 215 parsed_command_line_(parameters.command_line_) { |
211 } | 216 } |
212 | 217 |
213 BrowserMainParts::~BrowserMainParts() { | 218 BrowserMainParts::~BrowserMainParts() { |
214 } | 219 } |
215 | 220 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 net::SpdySessionPool::enable_ip_pooling(false); | 719 net::SpdySessionPool::enable_ip_pooling(false); |
715 | 720 |
716 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { | 721 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { |
717 int value; | 722 int value; |
718 base::StringToInt(parsed_command_line.GetSwitchValueASCII( | 723 base::StringToInt(parsed_command_line.GetSwitchValueASCII( |
719 switches::kMaxSpdySessionsPerDomain), | 724 switches::kMaxSpdySessionsPerDomain), |
720 &value); | 725 &value); |
721 net::SpdySessionPool::set_max_sessions_per_domain(value); | 726 net::SpdySessionPool::set_max_sessions_per_domain(value); |
722 } | 727 } |
723 | 728 |
724 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks( | |
725 true); | |
726 | |
727 SetDnsCertProvenanceCheckerFactory(CreateChromeDnsCertProvenanceChecker); | 729 SetDnsCertProvenanceCheckerFactory(CreateChromeDnsCertProvenanceChecker); |
728 } | 730 } |
729 | 731 |
732 void InitializeURLRequestThrottlerManager(net::NetLog* net_log) { | |
733 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks( | |
734 true); | |
735 | |
736 // TODO(joi): Passing the NetLog here is temporary; once I switch the | |
737 // URLRequestThrottlerManager to be part of the URLRequestContext it will | |
738 // come from there. Doing it this way for now (2011/5/12) to try to fail | |
739 // fast in case A/B experiment gives unexpected results. | |
740 net::URLRequestThrottlerManager::GetInstance()->set_net_log(net_log); | |
741 } | |
742 | |
730 // Creates key child threads. We need to do this explicitly since | 743 // Creates key child threads. We need to do this explicitly since |
731 // BrowserThread::PostTask silently deletes a posted task if the target message | 744 // BrowserThread::PostTask silently deletes a posted task if the target message |
732 // loop isn't created. | 745 // loop isn't created. |
733 void CreateChildThreads(BrowserProcessImpl* process) { | 746 void CreateChildThreads(BrowserProcessImpl* process) { |
734 process->db_thread(); | 747 process->db_thread(); |
735 process->file_thread(); | 748 process->file_thread(); |
736 process->process_launcher_thread(); | 749 process->process_launcher_thread(); |
737 process->cache_thread(); | 750 process->cache_thread(); |
738 process->io_thread(); | 751 process->io_thread(); |
739 #if defined(OS_CHROMEOS) | 752 #if defined(OS_CHROMEOS) |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1384 | 1397 |
1385 // TODO(viettrungluu): why don't we run this earlier? | 1398 // TODO(viettrungluu): why don't we run this earlier? |
1386 if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) | 1399 if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) |
1387 WarnAboutMinimumSystemRequirements(); | 1400 WarnAboutMinimumSystemRequirements(); |
1388 | 1401 |
1389 // Convert active labs into switches. Modifies the current command line. | 1402 // Convert active labs into switches. Modifies the current command line. |
1390 about_flags::ConvertFlagsToSwitches(local_state, | 1403 about_flags::ConvertFlagsToSwitches(local_state, |
1391 CommandLine::ForCurrentProcess()); | 1404 CommandLine::ForCurrentProcess()); |
1392 | 1405 |
1393 InitializeNetworkOptions(parsed_command_line); | 1406 InitializeNetworkOptions(parsed_command_line); |
1407 InitializeURLRequestThrottlerManager(browser_process->net_log()); | |
1394 | 1408 |
1395 // Initialize histogram synchronizer system. This is a singleton and is used | 1409 // Initialize histogram synchronizer system. This is a singleton and is used |
1396 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of | 1410 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of |
1397 // scope. Even though NewRunnableMethod does AddRef and Release, the object | 1411 // scope. Even though NewRunnableMethod does AddRef and Release, the object |
1398 // will not be deleted after the Task is executed. | 1412 // will not be deleted after the Task is executed. |
1399 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( | 1413 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( |
1400 new HistogramSynchronizer()); | 1414 new HistogramSynchronizer()); |
1401 | 1415 |
1402 // Initialize thread watcher system. This is a singleton and is used by | 1416 // Initialize thread watcher system. This is a singleton and is used by |
1403 // WatchDogThread to keep track of information about threads that are being | 1417 // WatchDogThread to keep track of information about threads that are being |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1951 #if defined(OS_CHROMEOS) | 1965 #if defined(OS_CHROMEOS) |
1952 // To be precise, logout (browser shutdown) is not yet done, but the | 1966 // To be precise, logout (browser shutdown) is not yet done, but the |
1953 // remaining work is negligible, hence we say LogoutDone here. | 1967 // remaining work is negligible, hence we say LogoutDone here. |
1954 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 1968 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
1955 false); | 1969 false); |
1956 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 1970 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
1957 #endif | 1971 #endif |
1958 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 1972 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
1959 return result_code; | 1973 return result_code; |
1960 } | 1974 } |
OLD | NEW |