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

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

Issue 7283018: Introduce a policy to control the maximal number of connections per proxy server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved setting that policy to a really early point in the initialization of the system. Created 9 years, 5 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) 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 // Must initialize metrics after labs have been converted into switches, 270 // Must initialize metrics after labs have been converted into switches,
271 // but before field trials are set up (so that client ID is available for 271 // but before field trials are set up (so that client ID is available for
272 // one-time randomized field trials). 272 // one-time randomized field trials).
273 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state); 273 MetricsService* metrics = InitializeMetrics(parsed_command_line, local_state);
274 274
275 // Initialize FieldTrialList to support FieldTrials that use one-time 275 // Initialize FieldTrialList to support FieldTrials that use one-time
276 // randomization. The client ID will be empty if the user has not opted 276 // randomization. The client ID will be empty if the user has not opted
277 // to send metrics. 277 // to send metrics.
278 field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId())); 278 field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId()));
279 279
280 SetupFieldTrials(metrics->recording_active()); 280 SetupFieldTrials(metrics->recording_active(),
281 local_state->IsManagedPreference(
282 prefs::kMaxConnectionsPerProxy));
281 283
282 // Initialize FieldTrialSynchronizer system. This is a singleton and is used 284 // Initialize FieldTrialSynchronizer system. This is a singleton and is used
283 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of 285 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of
284 // scope. Even though NewRunnableMethod does AddRef and Release, the object 286 // scope. Even though NewRunnableMethod does AddRef and Release, the object
285 // will not be deleted after the Task is executed. 287 // will not be deleted after the Task is executed.
286 field_trial_synchronizer_ = new FieldTrialSynchronizer(); 288 field_trial_synchronizer_ = new FieldTrialSynchronizer();
287 289
288 return metrics; 290 return metrics;
289 } 291 }
290 292
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); 628 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled);
627 #endif // #if defined(OS_CHROMEOS) 629 #endif // #if defined(OS_CHROMEOS)
628 if (enabled) { 630 if (enabled) {
629 metrics->Start(); 631 metrics->Start();
630 } 632 }
631 #endif // defined(GOOGLE_CHROME_BUILD) 633 #endif // defined(GOOGLE_CHROME_BUILD)
632 634
633 return metrics; 635 return metrics;
634 } 636 }
635 637
636 void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled) { 638 void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled,
639 bool proxy_policy_is_set) {
637 if (metrics_recording_enabled) 640 if (metrics_recording_enabled)
638 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start(); 641 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start();
639 642
640 // Note: make sure to call ConnectionFieldTrial() before 643 // Note: make sure to call ConnectionFieldTrial() before
641 // ProxyConnectionsFieldTrial(). 644 // ProxyConnectionsFieldTrial().
642 ConnectionFieldTrial(); 645 ConnectionFieldTrial();
643 SocketTimeoutFieldTrial(); 646 SocketTimeoutFieldTrial();
644 ProxyConnectionsFieldTrial(); 647 // If a policy is defining the number of active connections this field test
648 // shoud not be performed.
649 if (!proxy_policy_is_set)
650 ProxyConnectionsFieldTrial();
645 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); 651 prerender::ConfigurePrefetchAndPrerender(parsed_command_line());
646 SpdyFieldTrial(); 652 SpdyFieldTrial();
647 ConnectBackupJobsFieldTrial(); 653 ConnectBackupJobsFieldTrial();
648 WarmConnectionFieldTrial(); 654 WarmConnectionFieldTrial();
649 } 655 }
650 656
651 // ----------------------------------------------------------------------------- 657 // -----------------------------------------------------------------------------
652 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure 658 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure
653 659
654 namespace { 660 namespace {
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 #if defined(OS_CHROMEOS) 2083 #if defined(OS_CHROMEOS)
2078 // To be precise, logout (browser shutdown) is not yet done, but the 2084 // To be precise, logout (browser shutdown) is not yet done, but the
2079 // remaining work is negligible, hence we say LogoutDone here. 2085 // remaining work is negligible, hence we say LogoutDone here.
2080 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", 2086 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone",
2081 false); 2087 false);
2082 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); 2088 chromeos::BootTimesLoader::Get()->WriteLogoutTimes();
2083 #endif 2089 #endif
2084 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); 2090 TRACE_EVENT_END_ETW("BrowserMain", 0, 0);
2085 return result_code; 2091 return result_code;
2086 } 2092 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698