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 "net/quic/core/quic_versions.h" | 5 #include "net/quic/core/quic_versions.h" |
6 | 6 |
7 #include "net/quic/core/quic_error_codes.h" | 7 #include "net/quic/core/quic_error_codes.h" |
8 #include "net/quic/core/quic_flags.h" | 8 #include "net/quic/core/quic_flags.h" |
9 #include "net/quic/core/quic_tag.h" | 9 #include "net/quic/core/quic_tag.h" |
10 #include "net/quic/core/quic_types.h" | 10 #include "net/quic/core/quic_types.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 QuicVersionVector CurrentSupportedVersions() { | 25 QuicVersionVector CurrentSupportedVersions() { |
26 return FilterSupportedVersions(AllSupportedVersions()); | 26 return FilterSupportedVersions(AllSupportedVersions()); |
27 } | 27 } |
28 | 28 |
29 QuicVersionVector FilterSupportedVersions(QuicVersionVector versions) { | 29 QuicVersionVector FilterSupportedVersions(QuicVersionVector versions) { |
30 QuicVersionVector filtered_versions(versions.size()); | 30 QuicVersionVector filtered_versions(versions.size()); |
31 filtered_versions.clear(); // Guaranteed by spec not to change capacity. | 31 filtered_versions.clear(); // Guaranteed by spec not to change capacity. |
32 for (QuicVersion version : versions) { | 32 for (QuicVersion version : versions) { |
33 if (version == QUIC_VERSION_38) { | 33 if (version == QUIC_VERSION_39) { |
34 if (FLAGS_quic_enable_version_38 && | 34 if (base::GetFlag(FLAGS_quic_enable_version_39) && |
| 35 FLAGS_quic_reloadable_flag_quic_enable_version_38 && |
35 FLAGS_quic_reloadable_flag_quic_enable_version_37 && | 36 FLAGS_quic_reloadable_flag_quic_enable_version_37 && |
36 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { | 37 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { |
37 filtered_versions.push_back(version); | 38 filtered_versions.push_back(version); |
| 39 } |
| 40 } else if (version == QUIC_VERSION_38) { |
| 41 if (FLAGS_quic_reloadable_flag_quic_enable_version_38 && |
| 42 FLAGS_quic_reloadable_flag_quic_enable_version_37 && |
| 43 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { |
| 44 filtered_versions.push_back(version); |
38 } | 45 } |
39 } else if (version == QUIC_VERSION_37) { | 46 } else if (version == QUIC_VERSION_37) { |
40 if (FLAGS_quic_reloadable_flag_quic_enable_version_37 && | 47 if (FLAGS_quic_reloadable_flag_quic_enable_version_37 && |
41 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { | 48 FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { |
42 filtered_versions.push_back(version); | 49 filtered_versions.push_back(version); |
43 } | 50 } |
44 } else if (version == QUIC_VERSION_36) { | 51 } else if (version == QUIC_VERSION_36) { |
45 if (FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { | 52 if (FLAGS_quic_reloadable_flag_quic_enable_version_36_v3) { |
46 filtered_versions.push_back(version); | 53 filtered_versions.push_back(version); |
47 } | 54 } |
(...skipping 24 matching lines...) Expand all Loading... |
72 case QUIC_VERSION_34: | 79 case QUIC_VERSION_34: |
73 return MakeQuicTag('Q', '0', '3', '4'); | 80 return MakeQuicTag('Q', '0', '3', '4'); |
74 case QUIC_VERSION_35: | 81 case QUIC_VERSION_35: |
75 return MakeQuicTag('Q', '0', '3', '5'); | 82 return MakeQuicTag('Q', '0', '3', '5'); |
76 case QUIC_VERSION_36: | 83 case QUIC_VERSION_36: |
77 return MakeQuicTag('Q', '0', '3', '6'); | 84 return MakeQuicTag('Q', '0', '3', '6'); |
78 case QUIC_VERSION_37: | 85 case QUIC_VERSION_37: |
79 return MakeQuicTag('Q', '0', '3', '7'); | 86 return MakeQuicTag('Q', '0', '3', '7'); |
80 case QUIC_VERSION_38: | 87 case QUIC_VERSION_38: |
81 return MakeQuicTag('Q', '0', '3', '8'); | 88 return MakeQuicTag('Q', '0', '3', '8'); |
| 89 case QUIC_VERSION_39: |
| 90 return MakeQuicTag('Q', '0', '3', '9'); |
82 default: | 91 default: |
83 // This shold be an ERROR because we should never attempt to convert an | 92 // This shold be an ERROR because we should never attempt to convert an |
84 // invalid QuicVersion to be written to the wire. | 93 // invalid QuicVersion to be written to the wire. |
85 QUIC_LOG(ERROR) << "Unsupported QuicVersion: " << version; | 94 QUIC_LOG(ERROR) << "Unsupported QuicVersion: " << version; |
86 return 0; | 95 return 0; |
87 } | 96 } |
88 } | 97 } |
89 | 98 |
90 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { | 99 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { |
91 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { | 100 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { |
(...skipping 11 matching lines...) Expand all Loading... |
103 case x: \ | 112 case x: \ |
104 return #x | 113 return #x |
105 | 114 |
106 string QuicVersionToString(const QuicVersion version) { | 115 string QuicVersionToString(const QuicVersion version) { |
107 switch (version) { | 116 switch (version) { |
108 RETURN_STRING_LITERAL(QUIC_VERSION_34); | 117 RETURN_STRING_LITERAL(QUIC_VERSION_34); |
109 RETURN_STRING_LITERAL(QUIC_VERSION_35); | 118 RETURN_STRING_LITERAL(QUIC_VERSION_35); |
110 RETURN_STRING_LITERAL(QUIC_VERSION_36); | 119 RETURN_STRING_LITERAL(QUIC_VERSION_36); |
111 RETURN_STRING_LITERAL(QUIC_VERSION_37); | 120 RETURN_STRING_LITERAL(QUIC_VERSION_37); |
112 RETURN_STRING_LITERAL(QUIC_VERSION_38); | 121 RETURN_STRING_LITERAL(QUIC_VERSION_38); |
| 122 RETURN_STRING_LITERAL(QUIC_VERSION_39); |
113 default: | 123 default: |
114 return "QUIC_VERSION_UNSUPPORTED"; | 124 return "QUIC_VERSION_UNSUPPORTED"; |
115 } | 125 } |
116 } | 126 } |
117 | 127 |
118 string QuicVersionVectorToString(const QuicVersionVector& versions) { | 128 string QuicVersionVectorToString(const QuicVersionVector& versions) { |
119 string result = ""; | 129 string result = ""; |
120 for (size_t i = 0; i < versions.size(); ++i) { | 130 for (size_t i = 0; i < versions.size(); ++i) { |
121 if (i != 0) { | 131 if (i != 0) { |
122 result.append(","); | 132 result.append(","); |
123 } | 133 } |
124 result.append(QuicVersionToString(versions[i])); | 134 result.append(QuicVersionToString(versions[i])); |
125 } | 135 } |
126 return result; | 136 return result; |
127 } | 137 } |
128 | 138 |
129 } // namespace net | 139 } // namespace net |
OLD | NEW |