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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 if (parsed_command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | 278 if (parsed_command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { |
279 int value; | 279 int value; |
280 base::StringToInt( | 280 base::StringToInt( |
281 parsed_command_line.GetSwitchValueASCII( | 281 parsed_command_line.GetSwitchValueASCII( |
282 switches::kTestingFixedHttpsPort), | 282 switches::kTestingFixedHttpsPort), |
283 &value); | 283 &value); |
284 net::HttpStreamFactory::set_testing_fixed_https_port(value); | 284 net::HttpStreamFactory::set_testing_fixed_https_port(value); |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 void InitializeURLRequestThrottlerManager(net::NetLog* net_log) { | 288 void InitializeURLRequestThrottlerManager( |
289 net::URLRequestThrottlerManager::GetInstance()->set_enable_thread_checks( | 289 const CommandLine& parsed_command_line, |
290 true); | 290 net::NetLog* net_log) { |
| 291 net::URLRequestThrottlerManager* manager = |
| 292 net::URLRequestThrottlerManager::GetInstance(); |
| 293 |
| 294 // Always done in production, disabled only for unit tests. |
| 295 manager->set_enable_thread_checks(true); |
| 296 |
| 297 if (parsed_command_line.HasSwitch( |
| 298 switches::kDisableExtensionsHttpThrottling)) { |
| 299 manager->set_enforce_throttling(false); |
| 300 } |
291 | 301 |
292 // TODO(joi): Passing the NetLog here is temporary; once I switch the | 302 // TODO(joi): Passing the NetLog here is temporary; once I switch the |
293 // URLRequestThrottlerManager to be part of the URLRequestContext it will | 303 // URLRequestThrottlerManager to be part of the URLRequestContext it will |
294 // come from there. Doing it this way for now (2011/5/12) to try to fail | 304 // come from there. Doing it this way for now (2011/5/12) to try to fail |
295 // fast in case A/B experiment gives unexpected results. | 305 // fast in case A/B experiment gives unexpected results. |
296 net::URLRequestThrottlerManager::GetInstance()->set_net_log(net_log); | 306 manager->set_net_log(net_log); |
297 } | 307 } |
298 | 308 |
299 // Returns the new local state object, guaranteed non-NULL. | 309 // Returns the new local state object, guaranteed non-NULL. |
300 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, | 310 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, |
301 bool is_first_run) { | 311 bool is_first_run) { |
302 FilePath local_state_path; | 312 FilePath local_state_path; |
303 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 313 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
304 bool local_state_file_exists = file_util::PathExists(local_state_path); | 314 bool local_state_file_exists = file_util::PathExists(local_state_path); |
305 | 315 |
306 // Load local state. This includes the application locale so we know which | 316 // Load local state. This includes the application locale so we know which |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1327 // just changed it to include experiments. | 1337 // just changed it to include experiments. |
1328 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); | 1338 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); |
1329 | 1339 |
1330 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) | 1340 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) |
1331 // Set the product channel for crash reports. | 1341 // Set the product channel for crash reports. |
1332 child_process_logging::SetChannel( | 1342 child_process_logging::SetChannel( |
1333 chrome::VersionInfo::GetVersionStringModifier()); | 1343 chrome::VersionInfo::GetVersionStringModifier()); |
1334 #endif | 1344 #endif |
1335 | 1345 |
1336 InitializeNetworkOptions(parsed_command_line()); | 1346 InitializeNetworkOptions(parsed_command_line()); |
1337 InitializeURLRequestThrottlerManager(browser_process_->net_log()); | 1347 InitializeURLRequestThrottlerManager(parsed_command_line(), |
| 1348 browser_process_->net_log()); |
1338 | 1349 |
1339 // Initialize histogram synchronizer system. This is a singleton and is used | 1350 // Initialize histogram synchronizer system. This is a singleton and is used |
1340 // for posting tasks via base::Bind. Its deleted when it goes out of scope. | 1351 // for posting tasks via base::Bind. Its deleted when it goes out of scope. |
1341 // Even though base::Bind does AddRef and Release, the object will not | 1352 // Even though base::Bind does AddRef and Release, the object will not |
1342 // be deleted after the Task is executed. | 1353 // be deleted after the Task is executed. |
1343 histogram_synchronizer_ = new HistogramSynchronizer(); | 1354 histogram_synchronizer_ = new HistogramSynchronizer(); |
1344 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); | 1355 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); |
1345 | 1356 |
1346 // Now that all preferences have been registered, set the install date | 1357 // Now that all preferences have been registered, set the install date |
1347 // for the uninstall metrics if this is our first run. This only actually | 1358 // for the uninstall metrics if this is our first run. This only actually |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1979 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1969 uma_name += "_XP"; | 1980 uma_name += "_XP"; |
1970 | 1981 |
1971 uma_name += "_PreRead_"; | 1982 uma_name += "_PreRead_"; |
1972 uma_name += pre_read_percentage; | 1983 uma_name += pre_read_percentage; |
1973 AddPreReadHistogramTime(uma_name.c_str(), time); | 1984 AddPreReadHistogramTime(uma_name.c_str(), time); |
1974 } | 1985 } |
1975 #endif | 1986 #endif |
1976 #endif | 1987 #endif |
1977 } | 1988 } |
OLD | NEW |