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)); | |
283 | 281 |
284 // Initialize FieldTrialSynchronizer system. This is a singleton and is used | 282 // Initialize FieldTrialSynchronizer system. This is a singleton and is used |
285 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of | 283 // for posting tasks via NewRunnableMethod. Its deleted when it goes out of |
286 // scope. Even though NewRunnableMethod does AddRef and Release, the object | 284 // scope. Even though NewRunnableMethod does AddRef and Release, the object |
287 // will not be deleted after the Task is executed. | 285 // will not be deleted after the Task is executed. |
288 field_trial_synchronizer_ = new FieldTrialSynchronizer(); | 286 field_trial_synchronizer_ = new FieldTrialSynchronizer(); |
289 | 287 |
290 return metrics; | 288 return metrics; |
291 } | 289 } |
292 | 290 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 626 bool enabled = local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
629 #endif // #if defined(OS_CHROMEOS) | 627 #endif // #if defined(OS_CHROMEOS) |
630 if (enabled) { | 628 if (enabled) { |
631 metrics->Start(); | 629 metrics->Start(); |
632 } | 630 } |
633 #endif // defined(GOOGLE_CHROME_BUILD) | 631 #endif // defined(GOOGLE_CHROME_BUILD) |
634 | 632 |
635 return metrics; | 633 return metrics; |
636 } | 634 } |
637 | 635 |
638 void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, | 636 void BrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled) { |
639 bool proxy_policy_is_set) { | |
640 if (metrics_recording_enabled) | 637 if (metrics_recording_enabled) |
641 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start(); | 638 chrome_browser_net_websocket_experiment::WebSocketExperimentRunner::Start(); |
642 | 639 |
643 // Note: make sure to call ConnectionFieldTrial() before | 640 // Note: make sure to call ConnectionFieldTrial() before |
644 // ProxyConnectionsFieldTrial(). | 641 // ProxyConnectionsFieldTrial(). |
645 ConnectionFieldTrial(); | 642 ConnectionFieldTrial(); |
646 SocketTimeoutFieldTrial(); | 643 SocketTimeoutFieldTrial(); |
647 // If a policy is defining the number of active connections this field test | 644 ProxyConnectionsFieldTrial(); |
648 // shoud not be performed. | |
649 if (!proxy_policy_is_set) | |
650 ProxyConnectionsFieldTrial(); | |
651 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); | 645 prerender::ConfigurePrefetchAndPrerender(parsed_command_line()); |
652 SpdyFieldTrial(); | 646 SpdyFieldTrial(); |
653 ConnectBackupJobsFieldTrial(); | 647 ConnectBackupJobsFieldTrial(); |
654 WarmConnectionFieldTrial(); | 648 WarmConnectionFieldTrial(); |
655 } | 649 } |
656 | 650 |
657 // ----------------------------------------------------------------------------- | 651 // ----------------------------------------------------------------------------- |
658 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure | 652 // TODO(viettrungluu): move more/rest of BrowserMain() into above structure |
659 | 653 |
660 namespace { | 654 namespace { |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 #if defined(OS_CHROMEOS) | 2075 #if defined(OS_CHROMEOS) |
2082 // To be precise, logout (browser shutdown) is not yet done, but the | 2076 // To be precise, logout (browser shutdown) is not yet done, but the |
2083 // remaining work is negligible, hence we say LogoutDone here. | 2077 // remaining work is negligible, hence we say LogoutDone here. |
2084 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", | 2078 chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker("LogoutDone", |
2085 false); | 2079 false); |
2086 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); | 2080 chromeos::BootTimesLoader::Get()->WriteLogoutTimes(); |
2087 #endif | 2081 #endif |
2088 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); | 2082 TRACE_EVENT_END_ETW("BrowserMain", 0, 0); |
2089 return result_code; | 2083 return result_code; |
2090 } | 2084 } |
OLD | NEW |