OLD | NEW |
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 Loading... |
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 Loading... |
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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 #if defined(OS_CHROMEOS) | 2081 #if defined(OS_CHROMEOS) |
2076 // To be precise, logout (browser shutdown) is not yet done, but the | 2082 // To be precise, logout (browser shutdown) is not yet done, but the |
2077 // remaining work is negligible, hence we say LogoutDone here. | 2083 // remaining work is negligible, hence we say LogoutDone here. |
2078 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2084 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
2079 false); | 2085 false); |
2080 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2086 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
2081 #endif | 2087 #endif |
2082 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2088 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
2083 return result_code; | 2089 return result_code; |
2084 } | 2090 } |
OLD | NEW |