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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 | 96 |
| 97 // The IOThread object must outlive any tasks posted to the IO thread before the | 97 // The IOThread object must outlive any tasks posted to the IO thread before the |
| 98 // Quit task, so base::Bind() calls are not refcounted. | 98 // Quit task, so base::Bind() calls are not refcounted. |
| 99 | 99 |
| 100 namespace { | 100 namespace { |
| 101 | 101 |
| 102 const char kQuicFieldTrialName[] = "QUIC"; | 102 const char kQuicFieldTrialName[] = "QUIC"; |
| 103 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; | 103 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; |
| 104 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; | 104 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; |
| 105 | 105 |
| 106 const char kSpdyFieldTrialName[] = "SPDY"; | |
| 107 const char kSpdyFieldTrialDisabledGroupName[] = "Disabled"; | |
| 108 | |
| 106 #if defined(OS_MACOSX) && !defined(OS_IOS) | 109 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 107 void ObserveKeychainEvents() { | 110 void ObserveKeychainEvents() { |
| 108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 109 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); | 112 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); |
| 110 } | 113 } |
| 111 #endif | 114 #endif |
| 112 | 115 |
| 113 // Used for the "system" URLRequestContext. | 116 // Used for the "system" URLRequestContext. |
| 114 class SystemURLRequestContext : public net::URLRequestContext { | 117 class SystemURLRequestContext : public net::URLRequestContext { |
| 115 public: | 118 public: |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 net::HttpStreamFactory::EnableNpnHttp2Draft04(); | 722 net::HttpStreamFactory::EnableNpnHttp2Draft04(); |
| 720 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) { | 723 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) { |
| 721 net::HttpStreamFactory::EnableNpnSpdy4a2(); | 724 net::HttpStreamFactory::EnableNpnSpdy4a2(); |
| 722 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { | 725 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { |
| 723 net::HttpStreamFactory::EnableNpnSpdy3(); | 726 net::HttpStreamFactory::EnableNpnSpdy3(); |
| 724 } else if (command_line.HasSwitch(switches::kEnableNpn)) { | 727 } else if (command_line.HasSwitch(switches::kEnableNpn)) { |
| 725 net::HttpStreamFactory::EnableNpnSpdy(); | 728 net::HttpStreamFactory::EnableNpnSpdy(); |
| 726 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { | 729 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { |
| 727 net::HttpStreamFactory::EnableNpnHttpOnly(); | 730 net::HttpStreamFactory::EnableNpnHttpOnly(); |
| 728 } else { | 731 } else { |
| 729 // Use SPDY/3.1 by default. | 732 std::string spdy_trial_group = |
| 730 net::HttpStreamFactory::EnableNpnSpdy31(); | 733 base::FieldTrialList::FindFullName(kSpdyFieldTrialName); |
|
Ryan Hamilton
2013/09/28 13:58:40
You need to make sure that you call FindFullName f
ramant (doing other things)
2013/09/29 23:41:32
Done.
| |
| 734 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName) { | |
| 735 net::HttpStreamFactory::set_spdy_enabled(false); | |
| 736 } else { | |
| 737 // Use SPDY/3.1 by default. | |
| 738 net::HttpStreamFactory::EnableNpnSpdy31(); | |
| 739 } | |
| 731 } | 740 } |
| 732 } | 741 } |
| 733 | 742 |
| 734 // TODO(rch): Make the client socket factory a per-network session | 743 // TODO(rch): Make the client socket factory a per-network session |
| 735 // instance, constructed from a NetworkSession::Params, to allow us | 744 // instance, constructed from a NetworkSession::Params, to allow us |
| 736 // to move this option to IOThread::Globals & | 745 // to move this option to IOThread::Globals & |
| 737 // HttpNetworkSession::Params. | 746 // HttpNetworkSession::Params. |
| 738 if (command_line.HasSwitch(switches::kEnableTcpFastOpen)) | 747 if (command_line.HasSwitch(switches::kEnableTcpFastOpen)) |
| 739 net::SetTCPFastOpenEnabled(true); | 748 net::SetTCPFastOpenEnabled(true); |
| 740 } | 749 } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 if (command_line.HasSwitch(switches::kDisableQuicHttps)) | 1024 if (command_line.HasSwitch(switches::kDisableQuicHttps)) |
| 1016 return false; | 1025 return false; |
| 1017 | 1026 |
| 1018 if (command_line.HasSwitch(switches::kEnableQuicHttps)) | 1027 if (command_line.HasSwitch(switches::kEnableQuicHttps)) |
| 1019 return true; | 1028 return true; |
| 1020 | 1029 |
| 1021 // HTTPS over QUIC should only be enabled if we are in the https | 1030 // HTTPS over QUIC should only be enabled if we are in the https |
| 1022 // field trial group. | 1031 // field trial group. |
| 1023 return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName; | 1032 return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName; |
| 1024 } | 1033 } |
| OLD | NEW |