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

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

Issue 10203002: Make URLRequestThrottlerManager a member of URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR (pure merge) Created 8 years, 8 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
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 #include "net/base/ssl_config_service.h" 112 #include "net/base/ssl_config_service.h"
113 #include "net/cookies/cookie_monster.h" 113 #include "net/cookies/cookie_monster.h"
114 #include "net/http/http_basic_stream.h" 114 #include "net/http/http_basic_stream.h"
115 #include "net/http/http_network_layer.h" 115 #include "net/http/http_network_layer.h"
116 #include "net/http/http_stream_factory.h" 116 #include "net/http/http_stream_factory.h"
117 #include "net/socket/client_socket_pool_base.h" 117 #include "net/socket/client_socket_pool_base.h"
118 #include "net/socket/client_socket_pool_manager.h" 118 #include "net/socket/client_socket_pool_manager.h"
119 #include "net/spdy/spdy_session.h" 119 #include "net/spdy/spdy_session.h"
120 #include "net/spdy/spdy_session_pool.h" 120 #include "net/spdy/spdy_session_pool.h"
121 #include "net/url_request/url_request.h" 121 #include "net/url_request/url_request.h"
122 #include "net/url_request/url_request_throttler_manager.h"
123 #include "net/websockets/websocket_job.h" 122 #include "net/websockets/websocket_job.h"
124 #include "ui/base/l10n/l10n_util.h" 123 #include "ui/base/l10n/l10n_util.h"
125 #include "ui/base/resource/resource_bundle.h" 124 #include "ui/base/resource/resource_bundle.h"
126 125
127 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 126 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
128 #include "chrome/browser/first_run/upgrade_util_linux.h" 127 #include "chrome/browser/first_run/upgrade_util_linux.h"
129 #endif 128 #endif
130 129
131 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
132 #include "chrome/browser/chromeos/cros/cros_library.h" 131 #include "chrome/browser/chromeos/cros/cros_library.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (parsed_command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { 278 if (parsed_command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
280 int value; 279 int value;
281 base::StringToInt( 280 base::StringToInt(
282 parsed_command_line.GetSwitchValueASCII( 281 parsed_command_line.GetSwitchValueASCII(
283 switches::kTestingFixedHttpsPort), 282 switches::kTestingFixedHttpsPort),
284 &value); 283 &value);
285 net::HttpStreamFactory::set_testing_fixed_https_port(value); 284 net::HttpStreamFactory::set_testing_fixed_https_port(value);
286 } 285 }
287 } 286 }
288 287
289 void InitializeURLRequestThrottlerManager(
290 const CommandLine& parsed_command_line,
291 net::NetLog* net_log) {
292 net::URLRequestThrottlerManager* manager =
293 net::URLRequestThrottlerManager::GetInstance();
294
295 // Always done in production, disabled only for unit tests.
296 manager->set_enable_thread_checks(true);
297
298 if (parsed_command_line.HasSwitch(
299 switches::kDisableExtensionsHttpThrottling)) {
300 manager->set_enforce_throttling(false);
301 }
302
303 // TODO(joi): Passing the NetLog here is temporary; once I switch the
304 // URLRequestThrottlerManager to be part of the URLRequestContext it will
305 // come from there. Doing it this way for now (2011/5/12) to try to fail
306 // fast in case A/B experiment gives unexpected results.
307 manager->set_net_log(net_log);
308 }
309
310 // Returns the new local state object, guaranteed non-NULL. 288 // Returns the new local state object, guaranteed non-NULL.
311 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, 289 PrefService* InitializeLocalState(const CommandLine& parsed_command_line,
312 bool is_first_run) { 290 bool is_first_run) {
313 FilePath local_state_path; 291 FilePath local_state_path;
314 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 292 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
315 bool local_state_file_exists = file_util::PathExists(local_state_path); 293 bool local_state_file_exists = file_util::PathExists(local_state_path);
316 294
317 // Load local state. This includes the application locale so we know which 295 // Load local state. This includes the application locale so we know which
318 // locale dll to load. 296 // locale dll to load.
319 PrefService* local_state = g_browser_process->local_state(); 297 PrefService* local_state = g_browser_process->local_state();
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 // just changed it to include experiments. 1348 // just changed it to include experiments.
1371 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); 1349 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess());
1372 1350
1373 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) 1351 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX)
1374 // Set the product channel for crash reports. 1352 // Set the product channel for crash reports.
1375 child_process_logging::SetChannel( 1353 child_process_logging::SetChannel(
1376 chrome::VersionInfo::GetVersionStringModifier()); 1354 chrome::VersionInfo::GetVersionStringModifier());
1377 #endif 1355 #endif
1378 1356
1379 InitializeNetworkOptions(parsed_command_line()); 1357 InitializeNetworkOptions(parsed_command_line());
1380 InitializeURLRequestThrottlerManager(parsed_command_line(),
1381 browser_process_->net_log());
1382 1358
1383 // Initialize histogram synchronizer system. This is a singleton and is used 1359 // Initialize histogram synchronizer system. This is a singleton and is used
1384 // for posting tasks via base::Bind. Its deleted when it goes out of scope. 1360 // for posting tasks via base::Bind. Its deleted when it goes out of scope.
1385 // Even though base::Bind does AddRef and Release, the object will not 1361 // Even though base::Bind does AddRef and Release, the object will not
1386 // be deleted after the Task is executed. 1362 // be deleted after the Task is executed.
1387 histogram_synchronizer_ = new HistogramSynchronizer(); 1363 histogram_synchronizer_ = new HistogramSynchronizer();
1388 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); 1364 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer();
1389 1365
1390 // Now that all preferences have been registered, set the install date 1366 // Now that all preferences have been registered, set the install date
1391 // for the uninstall metrics if this is our first run. This only actually 1367 // 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
2012 if (base::win::GetVersion() <= base::win::VERSION_XP) 1988 if (base::win::GetVersion() <= base::win::VERSION_XP)
2013 uma_name += "_XP"; 1989 uma_name += "_XP";
2014 1990
2015 uma_name += "_PreRead_"; 1991 uma_name += "_PreRead_";
2016 uma_name += pre_read_percentage; 1992 uma_name += pre_read_percentage;
2017 AddPreReadHistogramTime(uma_name.c_str(), time); 1993 AddPreReadHistogramTime(uma_name.c_str(), time);
2018 } 1994 }
2019 #endif 1995 #endif
2020 #endif 1996 #endif
2021 } 1997 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/io_thread.h » ('j') | chrome/browser/policy/device_management_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698