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

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

Issue 2943703002: Use ContainsValue() instead of std::find() in net/ (Closed)
Patch Set: Created 3 years, 6 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/log/net_log.cc ('k') | no next file » | 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_tag.h" 5 #include "net/quic/core/quic_tag.h"
6 6
7 #include <algorithm>
8
9 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/stl_util.h"
10 #include "net/quic/platform/api/quic_text_utils.h" 9 #include "net/quic/platform/api/quic_text_utils.h"
11 10
12 namespace net { 11 namespace net {
13 12
14 bool FindMutualQuicTag(const QuicTagVector& our_tags, 13 bool FindMutualQuicTag(const QuicTagVector& our_tags,
15 const QuicTagVector& their_tags, 14 const QuicTagVector& their_tags,
16 QuicTag* out_result, 15 QuicTag* out_result,
17 size_t* out_index) { 16 size_t* out_index) {
18 const size_t num_our_tags = our_tags.size(); 17 const size_t num_our_tags = our_tags.size();
19 const size_t num_their_tags = their_tags.size(); 18 const size_t num_their_tags = their_tags.size();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 54
56 return QuicTextUtils::Uint64ToString(orig_tag); 55 return QuicTextUtils::Uint64ToString(orig_tag);
57 } 56 }
58 57
59 uint32_t MakeQuicTag(char a, char b, char c, char d) { 58 uint32_t MakeQuicTag(char a, char b, char c, char d) {
60 return static_cast<uint32_t>(a) | static_cast<uint32_t>(b) << 8 | 59 return static_cast<uint32_t>(a) | static_cast<uint32_t>(b) << 8 |
61 static_cast<uint32_t>(c) << 16 | static_cast<uint32_t>(d) << 24; 60 static_cast<uint32_t>(c) << 16 | static_cast<uint32_t>(d) << 24;
62 } 61 }
63 62
64 bool ContainsQuicTag(const QuicTagVector& tag_vector, QuicTag tag) { 63 bool ContainsQuicTag(const QuicTagVector& tag_vector, QuicTag tag) {
65 return std::find(tag_vector.begin(), tag_vector.end(), tag) != 64 return base::ContainsValue(tag_vector, tag);
66 tag_vector.end();
67 } 65 }
68 66
69 } // namespace net 67 } // namespace net
OLDNEW
« no previous file with comments | « net/log/net_log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698