Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: net/quic/core/quic_versions.cc

Issue 2875333002: Landing Recent QUIC changes until Mon May 8 21:42:46 2017 +0000 (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_versions.h ('k') | net/quic/quartc/quartc_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_tag.h" 8 #include "net/quic/core/quic_tag.h"
9 #include "net/quic/core/quic_types.h" 9 #include "net/quic/core/quic_types.h"
10 #include "net/quic/platform/api/quic_flags.h" 10 #include "net/quic/platform/api/quic_flags.h"
(...skipping 12 matching lines...) Expand all
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_39) { 33 if (version == QUIC_VERSION_40) {
34 if (GetQuicFlag(FLAGS_quic_enable_version_40) &&
35 FLAGS_quic_reloadable_flag_quic_enable_version_39 &&
36 FLAGS_quic_reloadable_flag_quic_enable_version_38) {
37 filtered_versions.push_back(version);
38 }
39 } else if (version == QUIC_VERSION_39) {
34 if (FLAGS_quic_reloadable_flag_quic_enable_version_39 && 40 if (FLAGS_quic_reloadable_flag_quic_enable_version_39 &&
35 FLAGS_quic_reloadable_flag_quic_enable_version_38) { 41 FLAGS_quic_reloadable_flag_quic_enable_version_38) {
36 filtered_versions.push_back(version); 42 filtered_versions.push_back(version);
37 } 43 }
38 } else if (version == QUIC_VERSION_38) { 44 } else if (version == QUIC_VERSION_38) {
39 if (FLAGS_quic_reloadable_flag_quic_enable_version_38) { 45 if (FLAGS_quic_reloadable_flag_quic_enable_version_38) {
40 filtered_versions.push_back(version); 46 filtered_versions.push_back(version);
41 } 47 }
42 } else { 48 } else {
43 filtered_versions.push_back(version); 49 filtered_versions.push_back(version);
(...skipping 18 matching lines...) Expand all
62 case QUIC_VERSION_35: 68 case QUIC_VERSION_35:
63 return MakeQuicTag('Q', '0', '3', '5'); 69 return MakeQuicTag('Q', '0', '3', '5');
64 case QUIC_VERSION_36: 70 case QUIC_VERSION_36:
65 return MakeQuicTag('Q', '0', '3', '6'); 71 return MakeQuicTag('Q', '0', '3', '6');
66 case QUIC_VERSION_37: 72 case QUIC_VERSION_37:
67 return MakeQuicTag('Q', '0', '3', '7'); 73 return MakeQuicTag('Q', '0', '3', '7');
68 case QUIC_VERSION_38: 74 case QUIC_VERSION_38:
69 return MakeQuicTag('Q', '0', '3', '8'); 75 return MakeQuicTag('Q', '0', '3', '8');
70 case QUIC_VERSION_39: 76 case QUIC_VERSION_39:
71 return MakeQuicTag('Q', '0', '3', '9'); 77 return MakeQuicTag('Q', '0', '3', '9');
78 case QUIC_VERSION_40:
79 return MakeQuicTag('Q', '0', '4', '0');
72 default: 80 default:
73 // This shold be an ERROR because we should never attempt to convert an 81 // This shold be an ERROR because we should never attempt to convert an
74 // invalid QuicVersion to be written to the wire. 82 // invalid QuicVersion to be written to the wire.
75 QUIC_LOG(ERROR) << "Unsupported QuicVersion: " << version; 83 QUIC_LOG(ERROR) << "Unsupported QuicVersion: " << version;
76 return 0; 84 return 0;
77 } 85 }
78 } 86 }
79 87
80 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { 88 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
81 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 89 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
(...skipping 11 matching lines...) Expand all
93 case x: \ 101 case x: \
94 return #x 102 return #x
95 103
96 string QuicVersionToString(const QuicVersion version) { 104 string QuicVersionToString(const QuicVersion version) {
97 switch (version) { 105 switch (version) {
98 RETURN_STRING_LITERAL(QUIC_VERSION_35); 106 RETURN_STRING_LITERAL(QUIC_VERSION_35);
99 RETURN_STRING_LITERAL(QUIC_VERSION_36); 107 RETURN_STRING_LITERAL(QUIC_VERSION_36);
100 RETURN_STRING_LITERAL(QUIC_VERSION_37); 108 RETURN_STRING_LITERAL(QUIC_VERSION_37);
101 RETURN_STRING_LITERAL(QUIC_VERSION_38); 109 RETURN_STRING_LITERAL(QUIC_VERSION_38);
102 RETURN_STRING_LITERAL(QUIC_VERSION_39); 110 RETURN_STRING_LITERAL(QUIC_VERSION_39);
111 RETURN_STRING_LITERAL(QUIC_VERSION_40);
103 default: 112 default:
104 return "QUIC_VERSION_UNSUPPORTED"; 113 return "QUIC_VERSION_UNSUPPORTED";
105 } 114 }
106 } 115 }
107 116
108 string QuicVersionVectorToString(const QuicVersionVector& versions) { 117 string QuicVersionVectorToString(const QuicVersionVector& versions) {
109 string result = ""; 118 string result = "";
110 for (size_t i = 0; i < versions.size(); ++i) { 119 for (size_t i = 0; i < versions.size(); ++i) {
111 if (i != 0) { 120 if (i != 0) {
112 result.append(","); 121 result.append(",");
113 } 122 }
114 result.append(QuicVersionToString(versions[i])); 123 result.append(QuicVersionToString(versions[i]));
115 } 124 }
116 return result; 125 return result;
117 } 126 }
118 127
119 } // namespace net 128 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_versions.h ('k') | net/quic/quartc/quartc_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698