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

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: Ready for review. 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
« no previous file with comments | « no previous file | chrome/browser/io_thread.h » ('j') | chrome/browser/io_thread.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 #include "net/base/ssl_config_service.h" 111 #include "net/base/ssl_config_service.h"
112 #include "net/cookies/cookie_monster.h" 112 #include "net/cookies/cookie_monster.h"
113 #include "net/http/http_basic_stream.h" 113 #include "net/http/http_basic_stream.h"
114 #include "net/http/http_network_layer.h" 114 #include "net/http/http_network_layer.h"
115 #include "net/http/http_stream_factory.h" 115 #include "net/http/http_stream_factory.h"
116 #include "net/socket/client_socket_pool_base.h" 116 #include "net/socket/client_socket_pool_base.h"
117 #include "net/socket/client_socket_pool_manager.h" 117 #include "net/socket/client_socket_pool_manager.h"
118 #include "net/spdy/spdy_session.h" 118 #include "net/spdy/spdy_session.h"
119 #include "net/spdy/spdy_session_pool.h" 119 #include "net/spdy/spdy_session_pool.h"
120 #include "net/url_request/url_request.h" 120 #include "net/url_request/url_request.h"
121 #include "net/url_request/url_request_throttler_manager.h" 121 #include "net/url_request/url_request_throttler_manager.h"
eroman 2012/04/24 19:05:57 Can this be removed as well?
Jói 2012/04/27 13:20:26 Done.
122 #include "net/websockets/websocket_job.h" 122 #include "net/websockets/websocket_job.h"
123 #include "ui/base/l10n/l10n_util.h" 123 #include "ui/base/l10n/l10n_util.h"
124 #include "ui/base/resource/resource_bundle.h" 124 #include "ui/base/resource/resource_bundle.h"
125 125
126 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 126 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
127 #include "chrome/browser/first_run/upgrade_util_linux.h" 127 #include "chrome/browser/first_run/upgrade_util_linux.h"
128 #endif 128 #endif
129 129
130 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
131 #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
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(
289 const CommandLine& parsed_command_line,
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 }
301
302 // TODO(joi): Passing the NetLog here is temporary; once I switch the
303 // URLRequestThrottlerManager to be part of the URLRequestContext it will
304 // come from there. Doing it this way for now (2011/5/12) to try to fail
305 // fast in case A/B experiment gives unexpected results.
306 manager->set_net_log(net_log);
307 }
308
309 // Returns the new local state object, guaranteed non-NULL. 288 // Returns the new local state object, guaranteed non-NULL.
310 PrefService* InitializeLocalState(const CommandLine& parsed_command_line, 289 PrefService* InitializeLocalState(const CommandLine& parsed_command_line,
311 bool is_first_run) { 290 bool is_first_run) {
312 FilePath local_state_path; 291 FilePath local_state_path;
313 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 292 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
314 bool local_state_file_exists = file_util::PathExists(local_state_path); 293 bool local_state_file_exists = file_util::PathExists(local_state_path);
315 294
316 // 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
317 // locale dll to load. 296 // locale dll to load.
318 PrefService* local_state = g_browser_process->local_state(); 297 PrefService* local_state = g_browser_process->local_state();
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 // just changed it to include experiments. 1316 // just changed it to include experiments.
1338 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess()); 1317 child_process_logging::SetCommandLine(CommandLine::ForCurrentProcess());
1339 1318
1340 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) 1319 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX)
1341 // Set the product channel for crash reports. 1320 // Set the product channel for crash reports.
1342 child_process_logging::SetChannel( 1321 child_process_logging::SetChannel(
1343 chrome::VersionInfo::GetVersionStringModifier()); 1322 chrome::VersionInfo::GetVersionStringModifier());
1344 #endif 1323 #endif
1345 1324
1346 InitializeNetworkOptions(parsed_command_line()); 1325 InitializeNetworkOptions(parsed_command_line());
1347 InitializeURLRequestThrottlerManager(parsed_command_line(),
1348 browser_process_->net_log());
1349 1326
1350 // Initialize histogram synchronizer system. This is a singleton and is used 1327 // Initialize histogram synchronizer system. This is a singleton and is used
1351 // for posting tasks via base::Bind. Its deleted when it goes out of scope. 1328 // for posting tasks via base::Bind. Its deleted when it goes out of scope.
1352 // Even though base::Bind does AddRef and Release, the object will not 1329 // Even though base::Bind does AddRef and Release, the object will not
1353 // be deleted after the Task is executed. 1330 // be deleted after the Task is executed.
1354 histogram_synchronizer_ = new HistogramSynchronizer(); 1331 histogram_synchronizer_ = new HistogramSynchronizer();
1355 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer(); 1332 tracking_synchronizer_ = new chrome_browser_metrics::TrackingSynchronizer();
1356 1333
1357 // Now that all preferences have been registered, set the install date 1334 // Now that all preferences have been registered, set the install date
1358 // for the uninstall metrics if this is our first run. This only actually 1335 // 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
1979 if (base::win::GetVersion() <= base::win::VERSION_XP) 1956 if (base::win::GetVersion() <= base::win::VERSION_XP)
1980 uma_name += "_XP"; 1957 uma_name += "_XP";
1981 1958
1982 uma_name += "_PreRead_"; 1959 uma_name += "_PreRead_";
1983 uma_name += pre_read_percentage; 1960 uma_name += pre_read_percentage;
1984 AddPreReadHistogramTime(uma_name.c_str(), time); 1961 AddPreReadHistogramTime(uma_name.c_str(), time);
1985 } 1962 }
1986 #endif 1963 #endif
1987 #endif 1964 #endif
1988 } 1965 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/io_thread.h » ('j') | chrome/browser/io_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698