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

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

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 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_unacked_packet_map.cc ('k') | net/quic/core/spdy_utils.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 "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "net/quic/core/quic_error_codes.h" 9 #include "net/quic/core/quic_error_codes.h"
10 #include "net/quic/core/quic_flags.h" 10 #include "net/quic/core/quic_flags.h"
11 #include "net/quic/core/quic_tag.h" 11 #include "net/quic/core/quic_tag.h"
12 #include "net/quic/core/quic_types.h" 12 #include "net/quic/core/quic_types.h"
13 #include "net/quic/platform/api/quic_logging.h"
13 14
14 using base::StringPiece; 15 using base::StringPiece;
15 using std::string; 16 using std::string;
16 17
17 namespace net { 18 namespace net {
18 19
19 QuicVersionVector AllSupportedVersions() { 20 QuicVersionVector AllSupportedVersions() {
20 QuicVersionVector supported_versions; 21 QuicVersionVector supported_versions;
21 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 22 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
22 supported_versions.push_back(kSupportedQuicVersions[i]); 23 supported_versions.push_back(kSupportedQuicVersions[i]);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return MakeQuicTag('Q', '0', '3', '4'); 70 return MakeQuicTag('Q', '0', '3', '4');
70 case QUIC_VERSION_35: 71 case QUIC_VERSION_35:
71 return MakeQuicTag('Q', '0', '3', '5'); 72 return MakeQuicTag('Q', '0', '3', '5');
72 case QUIC_VERSION_36: 73 case QUIC_VERSION_36:
73 return MakeQuicTag('Q', '0', '3', '6'); 74 return MakeQuicTag('Q', '0', '3', '6');
74 case QUIC_VERSION_37: 75 case QUIC_VERSION_37:
75 return MakeQuicTag('Q', '0', '3', '7'); 76 return MakeQuicTag('Q', '0', '3', '7');
76 default: 77 default:
77 // This shold be an ERROR because we should never attempt to convert an 78 // This shold be an ERROR because we should never attempt to convert an
78 // invalid QuicVersion to be written to the wire. 79 // invalid QuicVersion to be written to the wire.
79 LOG(ERROR) << "Unsupported QuicVersion: " << version; 80 QUIC_LOG(ERROR) << "Unsupported QuicVersion: " << version;
80 return 0; 81 return 0;
81 } 82 }
82 } 83 }
83 84
84 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) { 85 QuicVersion QuicTagToQuicVersion(const QuicTag version_tag) {
85 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) { 86 for (size_t i = 0; i < arraysize(kSupportedQuicVersions); ++i) {
86 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) { 87 if (version_tag == QuicVersionToQuicTag(kSupportedQuicVersions[i])) {
87 return kSupportedQuicVersions[i]; 88 return kSupportedQuicVersions[i];
88 } 89 }
89 } 90 }
90 // Reading from the client so this should not be considered an ERROR. 91 // Reading from the client so this should not be considered an ERROR.
91 DVLOG(1) << "Unsupported QuicTag version: " << QuicTagToString(version_tag); 92 QUIC_DLOG(INFO) << "Unsupported QuicTag version: "
93 << QuicTagToString(version_tag);
92 return QUIC_VERSION_UNSUPPORTED; 94 return QUIC_VERSION_UNSUPPORTED;
93 } 95 }
94 96
95 #define RETURN_STRING_LITERAL(x) \ 97 #define RETURN_STRING_LITERAL(x) \
96 case x: \ 98 case x: \
97 return #x 99 return #x
98 100
99 string QuicVersionToString(const QuicVersion version) { 101 string QuicVersionToString(const QuicVersion version) {
100 switch (version) { 102 switch (version) {
101 RETURN_STRING_LITERAL(QUIC_VERSION_34); 103 RETURN_STRING_LITERAL(QUIC_VERSION_34);
(...skipping 10 matching lines...) Expand all
112 for (size_t i = 0; i < versions.size(); ++i) { 114 for (size_t i = 0; i < versions.size(); ++i) {
113 if (i != 0) { 115 if (i != 0) {
114 result.append(","); 116 result.append(",");
115 } 117 }
116 result.append(QuicVersionToString(versions[i])); 118 result.append(QuicVersionToString(versions[i]));
117 } 119 }
118 return result; 120 return result;
119 } 121 }
120 122
121 } // namespace net 123 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_unacked_packet_map.cc ('k') | net/quic/core/spdy_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698