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

Unified Diff: net/tools/balsa/string_piece_utils.h

Issue 1869503003: Convert //net and //chromecast to std::unordered_* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix cast Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: net/tools/balsa/string_piece_utils.h
diff --git a/net/tools/balsa/string_piece_utils.h b/net/tools/balsa/string_piece_utils.h
index ccc9d52729ff641ce5c5f66d64507c723ca19da6..69877646ee55a7e0165d071248ec92cf96f471b1 100644
--- a/net/tools/balsa/string_piece_utils.h
+++ b/net/tools/balsa/string_piece_utils.h
@@ -12,48 +12,6 @@
namespace net {
-#if defined(COMPILER_MSVC)
-struct StringPieceCaseCompare {
- static const size_t bucket_size = 4;
-
- size_t operator()(const base::StringPiece& sp) const {
- // based on __stl_string_hash in http://www.sgi.com/tech/stl/string
- size_t hash_val = 0;
- for (base::StringPiece::const_iterator it = sp.begin();
- it != sp.end(); ++it) {
- hash_val = 5 * hash_val + base::ToLowerASCII(*it);
- }
- return hash_val;
- }
-
- bool operator()(const base::StringPiece& sp1,
- const base::StringPiece& sp2) const {
- size_t len1 = sp1.length();
- size_t len2 = sp2.length();
- bool sp1_shorter = len1 < len2;
- size_t len = sp1_shorter ? len1 : len2;
-
- int rv = 0;
- for (size_t i = 0; i < len; i++) {
- char sp1_lower = base::ToLowerASCII(sp1[i]);
- char sp2_lower = base::ToLowerASCII(sp2[i]);
- if (sp1_lower < sp2_lower) {
- rv = -1;
- break;
- }
- if (sp1_lower > sp2_lower) {
- rv = 1;
- break;
- }
- }
-
- if (rv == 0) {
- return sp1_shorter;
- }
- return rv < 0;
- }
-};
-#else // COMPILER_MSVC
struct StringPieceCaseHash {
size_t operator()(const base::StringPiece& sp) const {
// based on __stl_string_hash in http://www.sgi.com/tech/stl/string
@@ -65,7 +23,6 @@ struct StringPieceCaseHash {
return hash_val;
}
};
-#endif // COMPILER_MSVC
struct StringPieceCaseEqual {
bool operator()(const base::StringPiece& piece1,

Powered by Google App Engine
This is Rietveld 408576698