Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/debug/leak_tracker.h" | 14 #include "base/debug/leak_tracker.h" |
| 15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 18 #include "base/prefs/pref_registry_simple.h" | 18 #include "base/prefs/pref_registry_simple.h" |
| 19 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
| 20 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_piece.h" | |
| 22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
| 24 #include "base/threading/sequenced_worker_pool.h" | 25 #include "base/threading/sequenced_worker_pool.h" |
| 25 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
| 26 #include "base/threading/worker_pool.h" | 27 #include "base/threading/worker_pool.h" |
| 27 #include "base/time/time.h" | 28 #include "base/time/time.h" |
| 28 #include "build/build_config.h" | 29 #include "build/build_config.h" |
| 29 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/net/async_dns_field_trial.h" | 31 #include "chrome/browser/net/async_dns_field_trial.h" |
| 31 #include "chrome/browser/net/chrome_net_log.h" | 32 #include "chrome/browser/net/chrome_net_log.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; | 125 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; |
| 125 | 126 |
| 126 // The SPDY trial composes two different trial plus control groups: | 127 // The SPDY trial composes two different trial plus control groups: |
| 127 // * A "holdback" group with SPDY disabled, and corresponding control | 128 // * A "holdback" group with SPDY disabled, and corresponding control |
| 128 // (SPDY/3.1). The primary purpose of the holdback group is to encourage site | 129 // (SPDY/3.1). The primary purpose of the holdback group is to encourage site |
| 129 // operators to do feature detection rather than UA-sniffing. As such, this | 130 // operators to do feature detection rather than UA-sniffing. As such, this |
| 130 // trial runs continuously. | 131 // trial runs continuously. |
| 131 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and | 132 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and |
| 132 // eventual SPDY/4 deployment. | 133 // eventual SPDY/4 deployment. |
| 133 const char kSpdyFieldTrialName[] = "SPDY"; | 134 const char kSpdyFieldTrialName[] = "SPDY"; |
| 134 const char kSpdyFieldTrialHoldbackGroupName[] = "SpdyDisabled"; | 135 const char kSpdyFieldTrialHoldbackGroupNamePrefix[] = "SpdyDisabled"; |
| 135 const char kSpdyFieldTrialHoldbackControlGroupName[] = "Control"; | 136 const char kSpdyFieldTrialHoldbackControlGroupName[] = "Control"; |
| 136 const char kSpdyFieldTrialSpdy4GroupName[] = "Spdy4Enabled"; | 137 const char kSpdyFieldTrialSpdy31GroupNamePrefix[] = "Spdy31Enabled"; |
| 138 const char kSpdyFieldTrialSpdy4GroupNamePrefix[] = "Spdy4Enabled"; | |
| 137 const char kSpdyFieldTrialSpdy4ControlGroupName[] = "Spdy4Control"; | 139 const char kSpdyFieldTrialSpdy4ControlGroupName[] = "Spdy4Control"; |
| 138 | 140 |
| 139 // Field trial for Cache-Control: stale-while-revalidate directive. | 141 // Field trial for Cache-Control: stale-while-revalidate directive. |
| 140 const char kStaleWhileRevalidateFieldTrialName[] = "StaleWhileRevalidate"; | 142 const char kStaleWhileRevalidateFieldTrialName[] = "StaleWhileRevalidate"; |
| 141 | 143 |
| 142 #if defined(OS_MACOSX) && !defined(OS_IOS) | 144 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 143 void ObserveKeychainEvents() { | 145 void ObserveKeychainEvents() { |
| 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 145 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); | 147 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); |
| 146 } | 148 } |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); | 827 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); |
| 826 if (trial_group == kTCPFastOpenHttpsEnabledGroupName) | 828 if (trial_group == kTCPFastOpenHttpsEnabledGroupName) |
| 827 globals_->enable_tcp_fast_open_for_ssl.set(true); | 829 globals_->enable_tcp_fast_open_for_ssl.set(true); |
| 828 bool always_enable_if_supported = | 830 bool always_enable_if_supported = |
| 829 command_line.HasSwitch(switches::kEnableTcpFastOpen); | 831 command_line.HasSwitch(switches::kEnableTcpFastOpen); |
| 830 // Check for OS support of TCP FastOpen, and turn it on for all connections | 832 // Check for OS support of TCP FastOpen, and turn it on for all connections |
| 831 // if indicated by user. | 833 // if indicated by user. |
| 832 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_if_supported); | 834 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_if_supported); |
| 833 } | 835 } |
| 834 | 836 |
| 835 void IOThread::ConfigureSpdyFromTrial(const std::string& spdy_trial_group, | 837 void IOThread::ConfigureSpdyFromTrial(base::StringPiece spdy_trial_group, |
| 836 Globals* globals) { | 838 Globals* globals) { |
| 837 if (spdy_trial_group == kSpdyFieldTrialHoldbackGroupName) { | 839 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { |
| 838 // TODO(jgraettinger): Use net::NextProtosHttpOnly() instead? | 840 // TODO(jgraettinger): Use net::NextProtosHttpOnly() instead? |
| 839 net::HttpStreamFactory::set_spdy_enabled(false); | 841 net::HttpStreamFactory::set_spdy_enabled(false); |
| 840 } else if (spdy_trial_group == kSpdyFieldTrialHoldbackControlGroupName) { | 842 } else if (spdy_trial_group == kSpdyFieldTrialHoldbackControlGroupName) { |
| 841 // Use the current SPDY default (SPDY/3.1). | 843 // Use the current SPDY default (SPDY/3.1). |
| 842 globals->next_protos = net::NextProtosSpdy31(); | 844 globals->next_protos = net::NextProtosSpdy31(); |
| 843 globals->use_alternate_protocols.set(true); | 845 globals->use_alternate_protocols.set(true); |
| 844 } else if (spdy_trial_group == kSpdyFieldTrialSpdy4GroupName) { | 846 } else if (spdy_trial_group.starts_with( |
| 847 kSpdyFieldTrialSpdy31GroupNamePrefix)) { | |
| 848 globals->next_protos = net::NextProtosSpdy4Http2(); | |
| 849 globals->use_alternate_protocols.set(true); | |
| 850 } else if (spdy_trial_group.starts_with( | |
| 851 kSpdyFieldTrialSpdy4GroupNamePrefix)) { | |
| 845 globals->next_protos = net::NextProtosSpdy4Http2(); | 852 globals->next_protos = net::NextProtosSpdy4Http2(); |
| 846 globals->use_alternate_protocols.set(true); | 853 globals->use_alternate_protocols.set(true); |
| 847 } else if (spdy_trial_group == kSpdyFieldTrialSpdy4ControlGroupName) { | 854 } else if (spdy_trial_group == kSpdyFieldTrialSpdy4ControlGroupName) { |
|
Ryan Hamilton
2014/10/30 21:33:32
If you named the spdy/4 control group as:
Spdy31E
| |
| 848 // This control group is pinned at SPDY/3.1. | 855 // This control group is pinned at SPDY/3.1. |
| 849 globals->next_protos = net::NextProtosSpdy31(); | 856 globals->next_protos = net::NextProtosSpdy31(); |
| 850 globals->use_alternate_protocols.set(true); | 857 globals->use_alternate_protocols.set(true); |
| 851 } else { | 858 } else { |
| 852 // Use the current SPDY default (SPDY/3.1). | 859 // Use the current SPDY default (SPDY/3.1). |
| 853 globals->next_protos = net::NextProtosSpdy31(); | 860 globals->next_protos = net::NextProtosSpdy31(); |
| 854 globals->use_alternate_protocols.set(true); | 861 globals->use_alternate_protocols.set(true); |
| 855 } | 862 } |
| 856 } | 863 } |
| 857 | 864 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1432 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1439 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1433 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1440 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1434 net::QuicVersion version = supported_versions[i]; | 1441 net::QuicVersion version = supported_versions[i]; |
| 1435 if (net::QuicVersionToString(version) == quic_version) { | 1442 if (net::QuicVersionToString(version) == quic_version) { |
| 1436 return version; | 1443 return version; |
| 1437 } | 1444 } |
| 1438 } | 1445 } |
| 1439 | 1446 |
| 1440 return net::QUIC_VERSION_UNSUPPORTED; | 1447 return net::QUIC_VERSION_UNSUPPORTED; |
| 1441 } | 1448 } |
| OLD | NEW |