Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome/browser/browser_main.cc

Issue 6966038: Anti-DDoS enhancements: Log to net log, UMA stats, improved policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/net/passive_log_collector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 #endif 198 #endif
198 199
199 #if defined(TOOLKIT_USES_GTK) 200 #if defined(TOOLKIT_USES_GTK)
200 #include "ui/gfx/gtk_util.h" 201 #include "ui/gfx/gtk_util.h"
201 #endif 202 #endif
202 203
203 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2) 204 #if defined(TOUCH_UI) && defined(HAVE_XINPUT2)
204 #include "views/touchui/touch_factory.h" 205 #include "views/touchui/touch_factory.h"
205 #endif 206 #endif
206 207
208 namespace net {
209 class NetLog;
210 } // namespace net
211
207 // BrowserMainParts ------------------------------------------------------------ 212 // BrowserMainParts ------------------------------------------------------------
208 213
209 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters) 214 BrowserMainParts::BrowserMainParts(const MainFunctionParams& parameters)
210 : parameters_(parameters), 215 : parameters_(parameters),
211 parsed_command_line_(parameters.command_line_) { 216 parsed_command_line_(parameters.command_line_) {
212 } 217 }
213 218
214 BrowserMainParts::~BrowserMainParts() { 219 BrowserMainParts::~BrowserMainParts() {
215 } 220 }
216 221
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 net::SpdySessionPool::enable_ip_pooling(false); 720 net::SpdySessionPool::enable_ip_pooling(false);
716 721
717 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { 722 if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) {
718 int value; 723 int value;
719 base::StringToInt(parsed_command_line.GetSwitchValueASCII( 724 base::StringToInt(parsed_command_line.GetSwitchValueASCII(
720 switches::kMaxSpdySessionsPerDomain), 725 switches::kMaxSpdySessionsPerDomain),
721 &value); 726 &value);
722 net::SpdySessionPool::set_max_sessions_per_domain(value); 727 net::SpdySessionPool::set_max_sessions_per_domain(value);
723 } 728 }
724 729
725 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks(
726 true);
727
728 SetDnsCertProvenanceCheckerFactory(CreateChromeDnsCertProvenanceChecker); 730 SetDnsCertProvenanceCheckerFactory(CreateChromeDnsCertProvenanceChecker);
729 731
730 if (parsed_command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { 732 if (parsed_command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) {
731 // Enable WebSocket over SPDY. 733 // Enable WebSocket over SPDY.
732 net::WebSocketJob::set_websocket_over_spdy_enabled(true); 734 net::WebSocketJob::set_websocket_over_spdy_enabled(true);
733 } 735 }
734 } 736 }
735 737
738 void InitializeURLRequestThrottlerManager(net::NetLog* net_log) {
739 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks(
740 true);
741
742 // TODO(joi): Passing the NetLog here is temporary; once I switch the
743 // URLRequestThrottlerManager to be part of the URLRequestContext it will
744 // come from there. Doing it this way for now (2011/5/12) to try to fail
745 // fast in case A/B experiment gives unexpected results.
746 net::URLRequestThrottlerManager::GetInstance()->set_net_log(net_log);
747 }
748
736 // Creates key child threads. We need to do this explicitly since 749 // Creates key child threads. We need to do this explicitly since
737 // BrowserThread::PostTask silently deletes a posted task if the target message 750 // BrowserThread::PostTask silently deletes a posted task if the target message
738 // loop isn't created. 751 // loop isn't created.
739 void CreateChildThreads(BrowserProcessImpl* process) { 752 void CreateChildThreads(BrowserProcessImpl* process) {
740 process->db_thread(); 753 process->db_thread();
741 process->file_thread(); 754 process->file_thread();
742 process->process_launcher_thread(); 755 process->process_launcher_thread();
743 process->cache_thread(); 756 process->cache_thread();
744 process->io_thread(); 757 process->io_thread();
745 #if defined(OS_CHROMEOS) 758 #if defined(OS_CHROMEOS)
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 1415
1403 // TODO(viettrungluu): why don't we run this earlier? 1416 // TODO(viettrungluu): why don't we run this earlier?
1404 if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs)) 1417 if (!parsed_command_line.HasSwitch(switches::kNoErrorDialogs))
1405 WarnAboutMinimumSystemRequirements(); 1418 WarnAboutMinimumSystemRequirements();
1406 1419
1407 // Convert active labs into switches. Modifies the current command line. 1420 // Convert active labs into switches. Modifies the current command line.
1408 about_flags::ConvertFlagsToSwitches(local_state, 1421 about_flags::ConvertFlagsToSwitches(local_state,
1409 CommandLine::ForCurrentProcess()); 1422 CommandLine::ForCurrentProcess());
1410 1423
1411 InitializeNetworkOptions(parsed_command_line); 1424 InitializeNetworkOptions(parsed_command_line);
1425 InitializeURLRequestThrottlerManager(browser_process->net_log());
1412 1426
1413 // Initialize histogram synchronizer system. This is a singleton and is used 1427 // Initialize histogram synchronizer system. This is a singleton and is used
1414 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of 1428 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of
1415 // scope. Even though NewRunnableMethod does AddRef and Release, the object 1429 // scope. Even though NewRunnableMethod does AddRef and Release, the object
1416 // will not be deleted after the Task is executed. 1430 // will not be deleted after the Task is executed.
1417 scoped_refptr<HistogramSynchronizer> histogram_synchronizer( 1431 scoped_refptr<HistogramSynchronizer> histogram_synchronizer(
1418 new HistogramSynchronizer()); 1432 new HistogramSynchronizer());
1419 1433
1420 // Initialize thread watcher system. This is a singleton and is used by 1434 // Initialize thread watcher system. This is a singleton and is used by
1421 // WatchDogThread to keep track of information about threads that are being 1435 // WatchDogThread to keep track of information about threads that are being
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 #if defined(OS_CHROMEOS) 1981 #if defined(OS_CHROMEOS)
1968 // To be precise, logout (browser shutdown) is not yet done, but the 1982 // To be precise, logout (browser shutdown) is not yet done, but the
1969 // remaining work is negligible, hence we say LogoutDone here. 1983 // remaining work is negligible, hence we say LogoutDone here.
1970 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 1984 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
1971 false); 1985 false);
1972 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 1986 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
1973 #endif 1987 #endif
1974 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 1988 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
1975 return result_code; 1989 return result_code;
1976 } 1990 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/passive_log_collector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698