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/http/http_server_properties.h" | 5 #include "net/http/http_server_properties.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 case kProtoUnknown: | 94 case kProtoUnknown: |
95 case kProtoHTTP11: | 95 case kProtoHTTP11: |
96 break; | 96 break; |
97 } | 97 } |
98 | 98 |
99 NOTREACHED() << "Invalid NextProto: " << next_proto; | 99 NOTREACHED() << "Invalid NextProto: " << next_proto; |
100 return UNINITIALIZED_ALTERNATE_PROTOCOL; | 100 return UNINITIALIZED_ALTERNATE_PROTOCOL; |
101 } | 101 } |
102 | 102 |
103 std::string AlternateProtocolInfo::ToString() const { | 103 std::string AlternateProtocolInfo::ToString() const { |
104 return base::StringPrintf("%d:%s p=%f", port, | 104 return base::StringPrintf( |
105 AlternateProtocolToString(protocol), | 105 "%d:%s p=%f", port, AlternateProtocolToString(protocol), probability); |
106 probability); | 106 } |
| 107 |
| 108 std::string AlternateProtocolsToString(AlternateProtocols protocols) { |
| 109 std::string output{}; |
| 110 for (AlternateProtocols::const_iterator it = protocols.begin(); |
| 111 it != protocols.end(); |
| 112 ++it) { |
| 113 output.append(it->ToString()); |
| 114 output.append("; "); |
| 115 } |
| 116 return output; |
107 } | 117 } |
108 | 118 |
109 } // namespace net | 119 } // namespace net |
OLD | NEW |