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

Side by Side Diff: net/quic/core/quic_utils.h

Issue 2508393002: Get rid of the unused Priority argument to QuicUtils::FindMutualTag. No behavior change. (Closed)
Patch Set: Created 4 years, 1 month 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/crypto/quic_crypto_server_config.cc ('k') | net/quic/core/quic_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 // Some helpers for quic. 5 // Some helpers for quic.
6 6
7 #ifndef NET_QUIC_CORE_QUIC_UTILS_H_ 7 #ifndef NET_QUIC_CORE_QUIC_UTILS_H_
8 #define NET_QUIC_CORE_QUIC_UTILS_H_ 8 #define NET_QUIC_CORE_QUIC_UTILS_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 14 matching lines...) Expand all
25 #define QUIC_ALIGNED(X) __declspec(align(X)) 25 #define QUIC_ALIGNED(X) __declspec(align(X))
26 #else 26 #else
27 #define QUIC_ALIGN_OF alignof 27 #define QUIC_ALIGN_OF alignof
28 #define QUIC_ALIGNED(X) __attribute__((aligned(X))) 28 #define QUIC_ALIGNED(X) __attribute__((aligned(X)))
29 #endif // _MSC_VER 29 #endif // _MSC_VER
30 30
31 namespace net { 31 namespace net {
32 32
33 class NET_EXPORT_PRIVATE QuicUtils { 33 class NET_EXPORT_PRIVATE QuicUtils {
34 public: 34 public:
35 enum Priority {
36 LOCAL_PRIORITY,
37 PEER_PRIORITY,
38 };
39
40 // Returns the 64 bit FNV1a hash of the data. See 35 // Returns the 64 bit FNV1a hash of the data. See
41 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param 36 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
42 static uint64_t FNV1a_64_Hash(const char* data, int len); 37 static uint64_t FNV1a_64_Hash(const char* data, int len);
43 38
44 // returns the 128 bit FNV1a hash of the data. See 39 // returns the 128 bit FNV1a hash of the data. See
45 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param 40 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
46 static uint128 FNV1a_128_Hash(const char* data1, int len1); 41 static uint128 FNV1a_128_Hash(const char* data1, int len1);
47 42
48 // returns the 128 bit FNV1a hash of the two sequences of data. See 43 // returns the 128 bit FNV1a hash of the two sequences of data. See
49 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param 44 // http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
50 static uint128 FNV1a_128_Hash_Two(const char* data1, 45 static uint128 FNV1a_128_Hash_Two(const char* data1,
51 int len1, 46 int len1,
52 const char* data2, 47 const char* data2,
53 int len2); 48 int len2);
54 49
55 // FindMutualTag sets |out_result| to the first tag in the priority list that 50 // FindMutualTag sets |out_result| to the first tag in the priority list that
56 // is also in the other list and returns true. If there is no intersection it 51 // is also in the other list and returns true. If there is no intersection it
57 // returns false. 52 // returns false.
58 // 53 //
59 // Which list has priority is determined by |priority|.
60 //
61 // If |out_index| is non-nullptr and a match is found then the index of that 54 // If |out_index| is non-nullptr and a match is found then the index of that
62 // match in |their_tags| is written to |out_index|. 55 // match in |their_tags| is written to |out_index|.
63 static bool FindMutualTag(const QuicTagVector& our_tags, 56 static bool FindMutualTag(const QuicTagVector& our_tags,
64 const QuicTag* their_tags, 57 const QuicTag* their_tags,
65 size_t num_their_tags, 58 size_t num_their_tags,
66 Priority priority,
67 QuicTag* out_result, 59 QuicTag* out_result,
68 size_t* out_index); 60 size_t* out_index);
69 61
70 // SerializeUint128 writes the first 96 bits of |v| in little-endian form 62 // SerializeUint128 writes the first 96 bits of |v| in little-endian form
71 // to |out|. 63 // to |out|.
72 static void SerializeUint128Short(uint128 v, uint8_t* out); 64 static void SerializeUint128Short(uint128 v, uint8_t* out);
73 65
74 // Returns the name of the QuicRstStreamErrorCode as a char* 66 // Returns the name of the QuicRstStreamErrorCode as a char*
75 static const char* StreamErrorToString(QuicRstStreamErrorCode error); 67 static const char* StreamErrorToString(QuicRstStreamErrorCode error);
76 68
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) { 143 inline QuicIOVector MakeIOVector(base::StringPiece str, struct iovec* iov) {
152 iov->iov_base = const_cast<char*>(str.data()); 144 iov->iov_base = const_cast<char*>(str.data());
153 iov->iov_len = static_cast<size_t>(str.size()); 145 iov->iov_len = static_cast<size_t>(str.size());
154 QuicIOVector quic_iov(iov, 1, str.size()); 146 QuicIOVector quic_iov(iov, 1, str.size());
155 return quic_iov; 147 return quic_iov;
156 } 148 }
157 149
158 } // namespace net 150 } // namespace net
159 151
160 #endif // NET_QUIC_CORE_QUIC_UTILS_H_ 152 #endif // NET_QUIC_CORE_QUIC_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/core/crypto/quic_crypto_server_config.cc ('k') | net/quic/core/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698