summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidben <davidben@chromium.org>2016-01-20 17:40:42 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-21 01:41:32 +0000
commit021a2b496a7eb7222c0c7f4d8cd01d697c3f2dda (patch)
treed1af96a93a7e2f4defa4c680bc50a3170f06561a
parent38b5efd43f39caec997e343801e3ae712d4c67ad (diff)
downloadchromium_src-021a2b496a7eb7222c0c7f4d8cd01d697c3f2dda.zip
chromium_src-021a2b496a7eb7222c0c7f4d8cd01d697c3f2dda.tar.gz
chromium_src-021a2b496a7eb7222c0c7f4d8cd01d697c3f2dda.tar.bz2
Revert of Allow std::unordered_*. (patchset #15 id:280001 of https://codereview.chromium.org/1502373009/ )
Reason for revert: MSan build failure. https://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Linux%20ChromeOS%20MSan%20Builder/builds/12498 Original issue's description: > Allow std::unordered_*. > > base::hash_* is, as a transition step, implemented in terms of > std::unordered_*. Later commits will convert existing uses. > > Also fix a host of IWYU problems that arose from this CL. > > (NOPRESUBMIT because the wstring presubmit check is overzealous > and complains about the reference to wstring in the comment.) > > NOPRESUBMIT=true > BUG=576864 > TBR=derat@chromium.org,blundell@chromium.org,jbauman@chromium.org,dalecurtis@chromium.org > CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel > > Committed: https://crrev.com/3f37f7f1459e7b5a452c0e433493e0a6e9649ca7 > Cr-Commit-Position: refs/heads/master@{#370553} TBR=danakj@chromium.org,thakis@chromium.org,derat@chromium.org,blundell@chromium.org,dalecurtis@chromium.org,jbauman@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=576864 Review URL: https://codereview.chromium.org/1610023003 Cr-Commit-Position: refs/heads/master@{#370559}
-rw-r--r--ash/display/display_info.cc5
-rw-r--r--base/containers/hash_tables.h252
-rw-r--r--base/containers/scoped_ptr_hash_map.h2
-rw-r--r--base/hash.h81
-rw-r--r--base/location.h4
-rw-r--r--base/strings/string16.h17
-rw-r--r--base/strings/string16_unittest.cc14
-rw-r--r--base/strings/string_piece.h6
-rw-r--r--cc/debug/picture_debug_util.cc1
-rw-r--r--cc/layers/delegated_renderer_layer_impl.cc9
-rw-r--r--cc/quads/render_pass.h3
-rw-r--r--cc/quads/render_pass_id.cc6
-rw-r--r--cc/quads/render_pass_id.h1
-rw-r--r--cc/surfaces/surface_aggregator.cc9
-rw-r--r--cc/surfaces/surface_sequence.h3
-rw-r--r--cc/tiles/image_decode_controller.h11
-rw-r--r--chrome/browser/devtools/devtools_file_watcher.cc1
-rw-r--r--chrome/browser/extensions/api/log_private/filter_handler.cc1
-rw-r--r--chrome/browser/google/google_brand.cc1
-rw-r--r--chrome/browser/spellchecker/spellcheck_host_metrics.h1
-rw-r--r--chrome/browser/sync_file_system/drive_backend/metadata_database_index.h1
-rw-r--r--chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.cc2
-rw-r--r--components/favicon_base/favicon_util.cc1
-rw-r--r--components/mus/ws/display_manager.h1
-rw-r--r--components/sync_bookmarks/bookmark_model_associator.h2
-rw-r--r--content/browser/gpu/browser_gpu_memory_buffer_manager.h3
-rw-r--r--gpu/command_buffer/service/framebuffer_completeness_cache.h2
-rw-r--r--media/blink/multibuffer.h11
-rw-r--r--net/base/network_change_notifier_linux.h1
-rw-r--r--net/base/port_util.cc1
-rw-r--r--net/disk_cache/simple/simple_index_file.cc5
-rw-r--r--net/server/web_socket_encoder.cc1
-rw-r--r--net/spdy/spdy_alt_svc_wire_format.cc1
-rw-r--r--net/ssl/client_cert_store_nss.cc2
-rw-r--r--net/tools/quic/quic_server_session_base_test.cc1
-rw-r--r--net/tools/quic/quic_simple_server_session_test.cc1
-rw-r--r--styleguide/c++/c++11.html44
-rw-r--r--ui/base/x/selection_utils.cc1
-rw-r--r--ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc2
-rw-r--r--ui/gfx/generic_shared_memory_id.h4
40 files changed, 305 insertions, 210 deletions
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
index a85d175..b89d4d5 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -2,14 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ash/display/display_info.h"
-
#include <stdio.h>
-
-#include <algorithm>
#include <string>
#include <vector>
+#include "ash/display/display_info.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
diff --git a/base/containers/hash_tables.h b/base/containers/hash_tables.h
index 54bf98b..c421ddd 100644
--- a/base/containers/hash_tables.h
+++ b/base/containers/hash_tables.h
@@ -1,75 +1,281 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+//
+
+//
+// Deal with the differences between Microsoft and GNU implemenations
+// of hash_map. Allows all platforms to use |base::hash_map| and
+// |base::hash_set|.
+// eg:
+// base::hash_map<int> my_map;
+// base::hash_set<int> my_set;
+//
+// NOTE: It is an explicit non-goal of this class to provide a generic hash
+// function for pointers. If you want to hash a pointers to a particular class,
+// please define the template specialization elsewhere (for example, in its
+// header file) and keep it specific to just pointers to that class. This is
+// because identity hashes are not desirable for all types that might show up
+// in containers as pointers.
#ifndef BASE_CONTAINERS_HASH_TABLES_H_
#define BASE_CONTAINERS_HASH_TABLES_H_
-#include <cstddef>
+#include <stddef.h>
+#include <stdint.h>
+
+#include <utility>
+
+#include "base/strings/string16.h"
+#include "build/build_config.h"
+
+#if defined(COMPILER_MSVC)
#include <unordered_map>
#include <unordered_set>
-#include <utility>
-#include "base/hash.h"
+#define BASE_HASH_NAMESPACE std
-// This header file is deprecated. Use the corresponding C++11 type
-// instead. https://crbug.com/576864
+#elif defined(COMPILER_GCC)
-// Use a custom hasher instead.
#define BASE_HASH_NAMESPACE base_hash
+// This is a hack to disable the gcc 4.4 warning about hash_map and hash_set
+// being deprecated. We can get rid of this when we upgrade to VS2008 and we
+// can use <tr1/unordered_map> and <tr1/unordered_set>.
+#ifdef __DEPRECATED
+#define CHROME_OLD__DEPRECATED __DEPRECATED
+#undef __DEPRECATED
+#endif
+
+#include <ext/hash_map>
+#include <ext/hash_set>
+#define BASE_HASH_IMPL_NAMESPACE __gnu_cxx
+
+#include <string>
+
+#ifdef CHROME_OLD__DEPRECATED
+#define __DEPRECATED CHROME_OLD__DEPRECATED
+#undef CHROME_OLD__DEPRECATED
+#endif
+
namespace BASE_HASH_NAMESPACE {
-// A separate hasher which, by default, forwards to std::hash. This is so legacy
-// uses of BASE_HASH_NAMESPACE with base::hash_map do not interfere with
-// std::hash mid-transition.
+// The pre-standard hash behaves like C++11's std::hash, except around pointers.
+// const char* is specialized to hash the C string and hash functions for
+// general T* are missing. Define a BASE_HASH_NAMESPACE::hash which aligns with
+// the C++11 behavior.
+
template<typename T>
struct hash {
std::size_t operator()(const T& value) const {
- return std::hash<T>()(value);
+ return BASE_HASH_IMPL_NAMESPACE::hash<T>()(value);
}
};
-// Use base::IntPairHash from base/hash.h as a custom hasher instead.
-template<typename Type1, typename Type2>
-struct hash<std::pair<Type1, Type2> > {
- std::size_t operator()(std::pair<Type1, Type2> value) const {
- return base::HashInts(value.first, value.second);
+template<typename T>
+struct hash<T*> {
+ std::size_t operator()(T* value) const {
+ return BASE_HASH_IMPL_NAMESPACE::hash<uintptr_t>()(
+ reinterpret_cast<uintptr_t>(value));
}
};
+// The GNU C++ library provides identity hash functions for many integral types,
+// but not for |long long|. This hash function will truncate if |size_t| is
+// narrower than |long long|. This is probably good enough for what we will
+// use it for.
+
+#define DEFINE_TRIVIAL_HASH(integral_type) \
+ template<> \
+ struct hash<integral_type> { \
+ std::size_t operator()(integral_type value) const { \
+ return static_cast<std::size_t>(value); \
+ } \
+ }
+
+DEFINE_TRIVIAL_HASH(long long);
+DEFINE_TRIVIAL_HASH(unsigned long long);
+
+#undef DEFINE_TRIVIAL_HASH
+
+// Implement string hash functions so that strings of various flavors can
+// be used as keys in STL maps and sets. The hash algorithm comes from the
+// GNU C++ library, in <tr1/functional>. It is duplicated here because GCC
+// versions prior to 4.3.2 are unable to compile <tr1/functional> when RTTI
+// is disabled, as it is in our build.
+
+#define DEFINE_STRING_HASH(string_type) \
+ template<> \
+ struct hash<string_type> { \
+ std::size_t operator()(const string_type& s) const { \
+ std::size_t result = 0; \
+ for (string_type::const_iterator i = s.begin(); i != s.end(); ++i) \
+ result = (result * 131) + *i; \
+ return result; \
+ } \
+ }
+
+DEFINE_STRING_HASH(std::string);
+DEFINE_STRING_HASH(base::string16);
+
+#undef DEFINE_STRING_HASH
+
} // namespace BASE_HASH_NAMESPACE
+#else // COMPILER
+#error define BASE_HASH_NAMESPACE for your compiler
+#endif // COMPILER
+
namespace base {
-// Use std::unordered_map instead.
+// On MSVC, use the C++11 containers.
+#if defined(COMPILER_MSVC)
+
template<class Key, class T,
- class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Hash = std::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<std::pair<const Key, T>>>
using hash_map = std::unordered_map<Key, T, Hash, Pred, Alloc>;
-// Use std::unordered_multimap instead.
template<class Key, class T,
- class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Hash = std::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<std::pair<const Key, T>>>
using hash_multimap = std::unordered_multimap<Key, T, Hash, Pred, Alloc>;
-// Use std::unordered_multiset instead.
template<class Key,
- class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Hash = std::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key>>
using hash_multiset = std::unordered_multiset<Key, Hash, Pred, Alloc>;
-// Use std::unordered_set instead.
template<class Key,
- class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Hash = std::hash<Key>,
class Pred = std::equal_to<Key>,
class Alloc = std::allocator<Key>>
using hash_set = std::unordered_set<Key, Hash, Pred, Alloc>;
+#else // !COMPILER_MSVC
+
+// Otherwise, use the pre-standard ones, but override the default hash to match
+// C++11.
+template<class Key, class T,
+ class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<std::pair<const Key, T>>>
+using hash_map = BASE_HASH_IMPL_NAMESPACE::hash_map<Key, T, Hash, Pred, Alloc>;
+
+template<class Key, class T,
+ class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<std::pair<const Key, T>>>
+using hash_multimap =
+ BASE_HASH_IMPL_NAMESPACE::hash_multimap<Key, T, Hash, Pred, Alloc>;
+
+template<class Key,
+ class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<Key>>
+using hash_multiset =
+ BASE_HASH_IMPL_NAMESPACE::hash_multiset<Key, Hash, Pred, Alloc>;
+
+template<class Key,
+ class Hash = BASE_HASH_NAMESPACE::hash<Key>,
+ class Pred = std::equal_to<Key>,
+ class Alloc = std::allocator<Key>>
+using hash_set = BASE_HASH_IMPL_NAMESPACE::hash_set<Key, Hash, Pred, Alloc>;
+
+#undef BASE_HASH_IMPL_NAMESPACE
+
+#endif // COMPILER_MSVC
+
+// Implement hashing for pairs of at-most 32 bit integer values.
+// When size_t is 32 bits, we turn the 64-bit hash code into 32 bits by using
+// multiply-add hashing. This algorithm, as described in
+// Theorem 4.3.3 of the thesis "Über die Komplexität der Multiplikation in
+// eingeschränkten Branchingprogrammmodellen" by Woelfel, is:
+//
+// h32(x32, y32) = (h64(x32, y32) * rand_odd64 + rand16 * 2^16) % 2^64 / 2^32
+//
+// Contact danakj@chromium.org for any questions.
+inline std::size_t HashInts32(uint32_t value1, uint32_t value2) {
+ uint64_t value1_64 = value1;
+ uint64_t hash64 = (value1_64 << 32) | value2;
+
+ if (sizeof(std::size_t) >= sizeof(uint64_t))
+ return static_cast<std::size_t>(hash64);
+
+ uint64_t odd_random = 481046412LL << 32 | 1025306955LL;
+ uint32_t shift_random = 10121U << 16;
+
+ hash64 = hash64 * odd_random + shift_random;
+ std::size_t high_bits = static_cast<std::size_t>(
+ hash64 >> (8 * (sizeof(uint64_t) - sizeof(std::size_t))));
+ return high_bits;
+}
+
+// Implement hashing for pairs of up-to 64-bit integer values.
+// We use the compound integer hash method to produce a 64-bit hash code, by
+// breaking the two 64-bit inputs into 4 32-bit values:
+// http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000
+// Then we reduce our result to 32 bits if required, similar to above.
+inline std::size_t HashInts64(uint64_t value1, uint64_t value2) {
+ uint32_t short_random1 = 842304669U;
+ uint32_t short_random2 = 619063811U;
+ uint32_t short_random3 = 937041849U;
+ uint32_t short_random4 = 3309708029U;
+
+ uint32_t value1a = static_cast<uint32_t>(value1 & 0xffffffff);
+ uint32_t value1b = static_cast<uint32_t>((value1 >> 32) & 0xffffffff);
+ uint32_t value2a = static_cast<uint32_t>(value2 & 0xffffffff);
+ uint32_t value2b = static_cast<uint32_t>((value2 >> 32) & 0xffffffff);
+
+ uint64_t product1 = static_cast<uint64_t>(value1a) * short_random1;
+ uint64_t product2 = static_cast<uint64_t>(value1b) * short_random2;
+ uint64_t product3 = static_cast<uint64_t>(value2a) * short_random3;
+ uint64_t product4 = static_cast<uint64_t>(value2b) * short_random4;
+
+ uint64_t hash64 = product1 + product2 + product3 + product4;
+
+ if (sizeof(std::size_t) >= sizeof(uint64_t))
+ return static_cast<std::size_t>(hash64);
+
+ uint64_t odd_random = 1578233944LL << 32 | 194370989LL;
+ uint32_t shift_random = 20591U << 16;
+
+ hash64 = hash64 * odd_random + shift_random;
+ std::size_t high_bits = static_cast<std::size_t>(
+ hash64 >> (8 * (sizeof(uint64_t) - sizeof(std::size_t))));
+ return high_bits;
+}
+
+template<typename T1, typename T2>
+inline std::size_t HashPair(T1 value1, T2 value2) {
+ // This condition is expected to be compile-time evaluated and optimised away
+ // in release builds.
+ if (sizeof(T1) > sizeof(uint32_t) || (sizeof(T2) > sizeof(uint32_t)))
+ return HashInts64(value1, value2);
+
+ return HashInts32(value1, value2);
+}
+
} // namespace base
+namespace BASE_HASH_NAMESPACE {
+
+// Implement methods for hashing a pair of integers, so they can be used as
+// keys in STL containers.
+
+template<typename Type1, typename Type2>
+struct hash<std::pair<Type1, Type2> > {
+ std::size_t operator()(std::pair<Type1, Type2> value) const {
+ return base::HashPair(value.first, value.second);
+ }
+};
+
+} // namespace BASE_HASH_NAMESPACE
+
+#undef DEFINE_PAIR_HASH_FUNCTION_START
+#undef DEFINE_PAIR_HASH_FUNCTION_END
+
#endif // BASE_CONTAINERS_HASH_TABLES_H_
diff --git a/base/containers/scoped_ptr_hash_map.h b/base/containers/scoped_ptr_hash_map.h
index dd100c6..189c314 100644
--- a/base/containers/scoped_ptr_hash_map.h
+++ b/base/containers/scoped_ptr_hash_map.h
@@ -18,8 +18,6 @@
namespace base {
-// Deprecated. Use std::unordered_map instead. https://crbug.com/579229
-//
// This type acts like a hash_map<K, scoped_ptr<V, D> >, based on top of
// base::hash_map. The ScopedPtrHashMap has ownership of all values in the data
// structure.
diff --git a/base/hash.h b/base/hash.h
index d5dc549..ed8d9fd 100644
--- a/base/hash.h
+++ b/base/hash.h
@@ -10,7 +10,6 @@
#include <limits>
#include <string>
-#include <utility>
#include "base/base_export.h"
#include "base/logging.h"
@@ -36,86 +35,6 @@ inline uint32_t Hash(const std::string& str) {
return Hash(str.data(), str.size());
}
-// Implement hashing for pairs of at-most 32 bit integer values.
-// When size_t is 32 bits, we turn the 64-bit hash code into 32 bits by using
-// multiply-add hashing. This algorithm, as described in
-// Theorem 4.3.3 of the thesis "Über die Komplexität der Multiplikation in
-// eingeschränkten Branchingprogrammmodellen" by Woelfel, is:
-//
-// h32(x32, y32) = (h64(x32, y32) * rand_odd64 + rand16 * 2^16) % 2^64 / 2^32
-//
-// Contact danakj@chromium.org for any questions.
-inline size_t HashInts32(uint32_t value1, uint32_t value2) {
- uint64_t value1_64 = value1;
- uint64_t hash64 = (value1_64 << 32) | value2;
-
- if (sizeof(size_t) >= sizeof(uint64_t))
- return static_cast<size_t>(hash64);
-
- uint64_t odd_random = 481046412LL << 32 | 1025306955LL;
- uint32_t shift_random = 10121U << 16;
-
- hash64 = hash64 * odd_random + shift_random;
- size_t high_bits = static_cast<size_t>(
- hash64 >> (8 * (sizeof(uint64_t) - sizeof(size_t))));
- return high_bits;
-}
-
-// Implement hashing for pairs of up-to 64-bit integer values.
-// We use the compound integer hash method to produce a 64-bit hash code, by
-// breaking the two 64-bit inputs into 4 32-bit values:
-// http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECTION00832000000000000000
-// Then we reduce our result to 32 bits if required, similar to above.
-inline size_t HashInts64(uint64_t value1, uint64_t value2) {
- uint32_t short_random1 = 842304669U;
- uint32_t short_random2 = 619063811U;
- uint32_t short_random3 = 937041849U;
- uint32_t short_random4 = 3309708029U;
-
- uint32_t value1a = static_cast<uint32_t>(value1 & 0xffffffff);
- uint32_t value1b = static_cast<uint32_t>((value1 >> 32) & 0xffffffff);
- uint32_t value2a = static_cast<uint32_t>(value2 & 0xffffffff);
- uint32_t value2b = static_cast<uint32_t>((value2 >> 32) & 0xffffffff);
-
- uint64_t product1 = static_cast<uint64_t>(value1a) * short_random1;
- uint64_t product2 = static_cast<uint64_t>(value1b) * short_random2;
- uint64_t product3 = static_cast<uint64_t>(value2a) * short_random3;
- uint64_t product4 = static_cast<uint64_t>(value2b) * short_random4;
-
- uint64_t hash64 = product1 + product2 + product3 + product4;
-
- if (sizeof(size_t) >= sizeof(uint64_t))
- return static_cast<size_t>(hash64);
-
- uint64_t odd_random = 1578233944LL << 32 | 194370989LL;
- uint32_t shift_random = 20591U << 16;
-
- hash64 = hash64 * odd_random + shift_random;
- size_t high_bits = static_cast<size_t>(
- hash64 >> (8 * (sizeof(uint64_t) - sizeof(size_t))));
- return high_bits;
-}
-
-template<typename T1, typename T2>
-inline size_t HashInts(T1 value1, T2 value2) {
- // This condition is expected to be compile-time evaluated and optimised away
- // in release builds.
- if (sizeof(T1) > sizeof(uint32_t) || (sizeof(T2) > sizeof(uint32_t)))
- return HashInts64(value1, value2);
-
- return HashInts32(value1, value2);
-}
-
-// A templated hasher for pairs of integer types.
-template<typename T> struct IntPairHash;
-
-template<typename Type1, typename Type2>
-struct IntPairHash<std::pair<Type1, Type2>> {
- size_t operator()(std::pair<Type1, Type2> value) const {
- return HashInts(value.first, value.second);
- }
-};
-
} // namespace base
#endif // BASE_HASH_H_
diff --git a/base/location.h b/base/location.h
index 21e270c..d3bb23c 100644
--- a/base/location.h
+++ b/base/location.h
@@ -11,7 +11,7 @@
#include <string>
#include "base/base_export.h"
-#include "base/hash.h"
+#include "base/containers/hash_tables.h"
namespace tracked_objects {
@@ -59,7 +59,7 @@ class BASE_EXPORT Location {
// it comes from __FILE__, so no need to check the contents of the string.
// See the definition of FROM_HERE in location.h, and how it is used
// elsewhere.
- return base::HashInts(reinterpret_cast<uintptr_t>(location.file_name()),
+ return base::HashPair(reinterpret_cast<uintptr_t>(location.file_name()),
location.line_number());
}
};
diff --git a/base/strings/string16.h b/base/strings/string16.h
index af44a5c..e47669c 100644
--- a/base/strings/string16.h
+++ b/base/strings/string16.h
@@ -29,8 +29,6 @@
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
-
-#include <functional>
#include <string>
#include "base/base_export.h"
@@ -184,21 +182,6 @@ BASE_EXPORT extern void PrintTo(const string16& str, std::ostream* out);
extern template
class BASE_EXPORT std::basic_string<base::char16, base::string16_char_traits>;
-// Specialize std::hash for base::string16. Although the style guide forbids
-// this in general, it is necessary for consistency with WCHAR_T_IS_UTF16
-// platforms, where base::string16 is a type alias for std::wstring.
-namespace std {
-template<>
-struct hash<base::string16> {
- std::size_t operator()(const base::string16& s) const {
- std::size_t result = 0;
- for (base::char16 c : s)
- result = (result * 131) + c;
- return result;
- }
-};
-} // namespace std
-
#endif // WCHAR_T_IS_UTF32
#endif // BASE_STRINGS_STRING16_H_
diff --git a/base/strings/string16_unittest.cc b/base/strings/string16_unittest.cc
index 0d2ca80..4e58218 100644
--- a/base/strings/string16_unittest.cc
+++ b/base/strings/string16_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include <sstream>
-#include <unordered_set>
#include "base/strings/string16.h"
@@ -12,6 +11,8 @@
namespace base {
+#if defined(WCHAR_T_IS_UTF32)
+
// We define a custom operator<< for string16 so we can use it with logging.
// This tests that conversion.
TEST(String16Test, OutputStream) {
@@ -52,15 +53,6 @@ TEST(String16Test, OutputStream) {
}
}
-TEST(String16Test, Hash) {
- string16 str1 = ASCIIToUTF16("hello");
- string16 str2 = ASCIIToUTF16("world");
-
- std::unordered_set<string16> set;
-
- set.insert(str1);
- EXPECT_EQ(1u, set.count(str1));
- EXPECT_EQ(0u, set.count(str2));
-}
+#endif
} // namespace base
diff --git a/base/strings/string_piece.h b/base/strings/string_piece.h
index 92634b9..31e7596 100644
--- a/base/strings/string_piece.h
+++ b/base/strings/string_piece.h
@@ -439,9 +439,9 @@ BASE_EXPORT std::ostream& operator<<(std::ostream& o,
// We provide appropriate hash functions so StringPiece and StringPiece16 can
// be used as keys in hash sets and maps.
-// This hash function is copied from base/strings/string16.h. We don't use the
-// ones already defined for string and string16 directly because it would
-// require the string constructors to be called, which we don't want.
+// This hash function is copied from base/containers/hash_tables.h. We don't
+// use the ones already defined for string and string16 directly because it
+// would require the string constructors to be called, which we don't want.
#define HASH_STRING_PIECE(StringPieceType, string_piece) \
std::size_t result = 0; \
for (StringPieceType::const_iterator i = string_piece.begin(); \
diff --git a/cc/debug/picture_debug_util.cc b/cc/debug/picture_debug_util.cc
index 50ae60b..b1879af 100644
--- a/cc/debug/picture_debug_util.cc
+++ b/cc/debug/picture_debug_util.cc
@@ -6,7 +6,6 @@
#include <stddef.h>
-#include <limits>
#include <vector>
#include "base/base64.h"
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
index 8158edcf..5d51116 100644
--- a/cc/layers/delegated_renderer_layer_impl.cc
+++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -109,7 +109,16 @@ void DelegatedRendererLayerImpl::SetFrameData(
bool invalid_frame = false;
ResourceProvider::ResourceIdSet resources_in_frame;
size_t reserve_size = frame_data->resource_list.size();
+#if defined(COMPILER_MSVC)
resources_in_frame.reserve(reserve_size);
+#elif defined(COMPILER_GCC)
+ // Pre-standard hash-tables only implement resize, which behaves similarly
+ // to reserve for these keys. Resizing to 0 may also be broken (particularly
+ // on stlport).
+ // TODO(jbauman): Replace with reserve when C++11 is supported everywhere.
+ if (reserve_size)
+ resources_in_frame.resize(reserve_size);
+#endif
for (const auto& pass : render_pass_list) {
for (const auto& quad : pass->quad_list) {
for (ResourceId& resource_id : quad->resources) {
diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h
index 552643d..9ba727e 100644
--- a/cc/quads/render_pass.h
+++ b/cc/quads/render_pass.h
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/containers/hash_tables.h"
-#include "base/hash.h"
#include "base/macros.h"
#include "cc/base/cc_export.h"
#include "cc/base/list_container.h"
@@ -140,7 +139,7 @@ namespace BASE_HASH_NAMESPACE {
template <>
struct hash<cc::RenderPassId> {
size_t operator()(cc::RenderPassId key) const {
- return base::HashInts(key.layer_id, static_cast<int>(key.index));
+ return base::HashPair(key.layer_id, static_cast<int>(key.index));
}
};
} // namespace BASE_HASH_NAMESPACE
diff --git a/cc/quads/render_pass_id.cc b/cc/quads/render_pass_id.cc
index 742c191..0f53e81 100644
--- a/cc/quads/render_pass_id.cc
+++ b/cc/quads/render_pass_id.cc
@@ -2,11 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "cc/quads/render_pass_id.h"
-
#include <stddef.h>
-#include "base/hash.h"
+#include "cc/quads/render_pass_id.h"
namespace cc {
@@ -14,7 +12,7 @@ void* RenderPassId::AsTracingId() const {
static_assert(sizeof(size_t) <= sizeof(void*), // NOLINT
"size of size_t should not be greater than that of a pointer");
return reinterpret_cast<void*>(
- base::HashInts(layer_id, static_cast<int>(index)));
+ base::HashPair(layer_id, static_cast<int>(index)));
}
} // namespace cc
diff --git a/cc/quads/render_pass_id.h b/cc/quads/render_pass_id.h
index 5dff1e1..11cb777 100644
--- a/cc/quads/render_pass_id.h
+++ b/cc/quads/render_pass_id.h
@@ -9,6 +9,7 @@
#include <tuple>
+#include "base/containers/hash_tables.h"
#include "cc/base/cc_export.h"
namespace cc {
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index d60a217..9901d00 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -526,7 +526,16 @@ gfx::Rect SurfaceAggregator::PrewalkTree(SurfaceId surface_id,
ResourceProvider::ResourceIdSet referenced_resources;
size_t reserve_size = frame_data->resource_list.size();
+#if defined(COMPILER_MSVC)
referenced_resources.reserve(reserve_size);
+#elif defined(COMPILER_GCC)
+ // Pre-standard hash-tables only implement resize, which behaves similarly
+ // to reserve for these keys. Resizing to 0 may also be broken (particularly
+ // on stlport).
+ // TODO(jbauman): Replace with reserve when C++11 is supported everywhere.
+ if (reserve_size)
+ referenced_resources.resize(reserve_size);
+#endif
bool invalid_frame = false;
ResourceProvider::ResourceIdMap empty_map;
diff --git a/cc/surfaces/surface_sequence.h b/cc/surfaces/surface_sequence.h
index b4ab8ef..21decf6 100644
--- a/cc/surfaces/surface_sequence.h
+++ b/cc/surfaces/surface_sequence.h
@@ -11,7 +11,6 @@
#include <tuple>
#include "base/containers/hash_tables.h"
-#include "base/hash.h"
namespace cc {
@@ -47,7 +46,7 @@ namespace BASE_HASH_NAMESPACE {
template <>
struct hash<cc::SurfaceSequence> {
size_t operator()(cc::SurfaceSequence key) const {
- return base::HashInts(key.id_namespace, key.sequence);
+ return base::HashPair(key.id_namespace, key.sequence);
}
};
} // namespace BASE_HASH_NAMESPACE
diff --git a/cc/tiles/image_decode_controller.h b/cc/tiles/image_decode_controller.h
index f814d21..2c18212 100644
--- a/cc/tiles/image_decode_controller.h
+++ b/cc/tiles/image_decode_controller.h
@@ -8,7 +8,6 @@
#include <stdint.h>
#include "base/containers/hash_tables.h"
-#include "base/hash.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/memory/ref_counted.h"
#include "base/numerics/safe_math.h"
@@ -80,16 +79,16 @@ struct hash<cc::ImageDecodeControllerKey> {
// TODO(vmpstr): This is a mess. Maybe it's faster to just search the vector
// always (forwards or backwards to account for LRU).
uint64_t src_rect_hash =
- base::HashInts(static_cast<uint64_t>(base::HashInts(
+ base::HashPair(static_cast<uint64_t>(base::HashPair(
key.src_rect().x(), key.src_rect().y())),
- static_cast<uint64_t>(base::HashInts(
+ static_cast<uint64_t>(base::HashPair(
key.src_rect().width(), key.src_rect().height())));
uint64_t target_size_hash =
- base::HashInts(key.target_size().width(), key.target_size().height());
+ base::HashPair(key.target_size().width(), key.target_size().height());
- return base::HashInts(base::HashInts(src_rect_hash, target_size_hash),
- base::HashInts(key.image_id(), key.filter_quality()));
+ return base::HashPair(base::HashPair(src_rect_hash, target_size_hash),
+ base::HashPair(key.image_id(), key.filter_quality()));
}
};
} // namespace BASE_HASH_NAMESPACE
diff --git a/chrome/browser/devtools/devtools_file_watcher.cc b/chrome/browser/devtools/devtools_file_watcher.cc
index d966de5..bfc4906 100644
--- a/chrome/browser/devtools/devtools_file_watcher.cc
+++ b/chrome/browser/devtools/devtools_file_watcher.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/devtools/devtools_file_watcher.h"
-#include <algorithm>
#include <map>
#include <set>
diff --git a/chrome/browser/extensions/api/log_private/filter_handler.cc b/chrome/browser/extensions/api/log_private/filter_handler.cc
index 02c1306..6965932 100644
--- a/chrome/browser/extensions/api/log_private/filter_handler.cc
+++ b/chrome/browser/extensions/api/log_private/filter_handler.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/extensions/api/log_private/filter_handler.h"
-#include <algorithm>
#include <string>
#include <vector>
diff --git a/chrome/browser/google/google_brand.cc b/chrome/browser/google/google_brand.cc
index 7e07284e..5360948 100644
--- a/chrome/browser/google/google_brand.cc
+++ b/chrome/browser/google/google_brand.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/google/google_brand.h"
-#include <algorithm>
#include <string>
#include "base/macros.h"
diff --git a/chrome/browser/spellchecker/spellcheck_host_metrics.h b/chrome/browser/spellchecker/spellcheck_host_metrics.h
index 05da7ce..fe0df15 100644
--- a/chrome/browser/spellchecker/spellcheck_host_metrics.h
+++ b/chrome/browser/spellchecker/spellcheck_host_metrics.h
@@ -11,7 +11,6 @@
#include <vector>
#include "base/containers/hash_tables.h"
-#include "base/strings/string16.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h
index 4069652..a6f4510 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.h
@@ -15,7 +15,6 @@
#include "base/containers/hash_tables.h"
#include "base/containers/scoped_ptr_hash_map.h"
-#include "base/hash.h"
#include "base/macros.h"
#include "base/memory/scoped_vector.h"
#include "chrome/browser/sync_file_system/drive_backend/metadata_database_index_interface.h"
diff --git a/chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.cc b/chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.cc
index 96800d9..3bd7a34 100644
--- a/chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.cc
+++ b/chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.cc
@@ -4,8 +4,6 @@
#include "chrome/browser/task_management/providers/web_contents/web_contents_tags_manager.h"
-#include <algorithm>
-
#include "base/memory/singleton.h"
#include "chrome/browser/task_management/providers/web_contents/web_contents_task_provider.h"
diff --git a/components/favicon_base/favicon_util.cc b/components/favicon_base/favicon_util.cc
index e17ebdf..8c66920 100644
--- a/components/favicon_base/favicon_util.cc
+++ b/components/favicon_base/favicon_util.cc
@@ -6,7 +6,6 @@
#include <stddef.h>
-#include <algorithm>
#include <cmath>
#include "build/build_config.h"
diff --git a/components/mus/ws/display_manager.h b/components/mus/ws/display_manager.h
index 4cf6e4b..32f0c63 100644
--- a/components/mus/ws/display_manager.h
+++ b/components/mus/ws/display_manager.h
@@ -12,7 +12,6 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
-#include "base/strings/string16.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/mus/public/interfaces/window_tree.mojom.h"
diff --git a/components/sync_bookmarks/bookmark_model_associator.h b/components/sync_bookmarks/bookmark_model_associator.h
index f10e8d4..d5c777c 100644
--- a/components/sync_bookmarks/bookmark_model_associator.h
+++ b/components/sync_bookmarks/bookmark_model_associator.h
@@ -15,11 +15,9 @@
#include <vector>
#include "base/compiler_specific.h"
-#include "base/containers/hash_tables.h"
#include "base/hash.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/strings/string16.h"
#include "base/threading/thread_checker.h"
#include "components/sync_driver/data_type_error_handler.h"
#include "components/sync_driver/model_associator.h"
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.h b/content/browser/gpu/browser_gpu_memory_buffer_manager.h
index 94095f1..0057192 100644
--- a/content/browser/gpu/browser_gpu_memory_buffer_manager.h
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.h
@@ -12,7 +12,6 @@
#include "base/callback.h"
#include "base/containers/hash_tables.h"
-#include "base/hash.h"
#include "base/macros.h"
#include "base/trace_event/memory_dump_provider.h"
#include "content/common/content_export.h"
@@ -32,7 +31,7 @@ namespace BASE_HASH_NAMESPACE {
template <>
struct hash<content::GpuMemoryBufferConfigurationKey> {
size_t operator()(const content::GpuMemoryBufferConfigurationKey& key) const {
- return base::HashInts(static_cast<int>(key.first),
+ return base::HashPair(static_cast<int>(key.first),
static_cast<int>(key.second));
}
};
diff --git a/gpu/command_buffer/service/framebuffer_completeness_cache.h b/gpu/command_buffer/service/framebuffer_completeness_cache.h
index 932aa62..44741a4 100644
--- a/gpu/command_buffer/service/framebuffer_completeness_cache.h
+++ b/gpu/command_buffer/service/framebuffer_completeness_cache.h
@@ -5,8 +5,6 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_COMPLETENESS_CACHE_H_
#define GPU_COMMAND_BUFFER_SERVICE_FRAMEBUFFER_COMPLETENESS_CACHE_H_
-#include <string>
-
#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
diff --git a/media/blink/multibuffer.h b/media/blink/multibuffer.h
index cecca4a..6478914 100644
--- a/media/blink/multibuffer.h
+++ b/media/blink/multibuffer.h
@@ -15,7 +15,6 @@
#include "base/callback.h"
#include "base/containers/hash_tables.h"
-#include "base/hash.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -44,7 +43,15 @@ namespace BASE_HASH_NAMESPACE {
template <>
struct hash<media::MultiBufferGlobalBlockId> {
std::size_t operator()(const media::MultiBufferGlobalBlockId& key) const {
- return base::HashInts(reinterpret_cast<uintptr_t>(key.first), key.second);
+// It would be nice if we could use intptr_t instead of int64_t here, but
+// on some platforms, int64_t is declared as "long" which doesn't match
+// any of the HashPair() functions. This leads to a compile error since
+// the compiler can't decide which HashPair() function to call.
+#if defined(ARCH_CPU_64_BITS)
+ return base::HashPair(reinterpret_cast<int64_t>(key.first), key.second);
+#else
+ return base::HashPair(reinterpret_cast<int32_t>(key.first), key.second);
+#endif
}
};
diff --git a/net/base/network_change_notifier_linux.h b/net/base/network_change_notifier_linux.h
index 48bda6b..85238cf9 100644
--- a/net/base/network_change_notifier_linux.h
+++ b/net/base/network_change_notifier_linux.h
@@ -6,7 +6,6 @@
#define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_
#include "base/compiler_specific.h"
-#include "base/containers/hash_tables.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
diff --git a/net/base/port_util.cc b/net/base/port_util.cc
index 7328b5e..1867dc3 100644
--- a/net/base/port_util.cc
+++ b/net/base/port_util.cc
@@ -4,7 +4,6 @@
#include "net/base/port_util.h"
-#include <limits>
#include <set>
#include "base/lazy_instance.h"
diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc
index 025ffe9..7e80c02 100644
--- a/net/disk_cache/simple/simple_index_file.cc
+++ b/net/disk_cache/simple/simple_index_file.cc
@@ -423,7 +423,10 @@ void SimpleIndexFile::Deserialize(const char* data, int data_len,
return;
}
- entries->reserve(index_metadata.GetNumberOfEntries() + kExtraSizeForMerge);
+#if !defined(OS_WIN)
+ // TODO(gavinp): Consider using std::unordered_map.
+ entries->resize(index_metadata.GetNumberOfEntries() + kExtraSizeForMerge);
+#endif
while (entries->size() < index_metadata.GetNumberOfEntries()) {
uint64_t hash_key;
EntryMetadata entry_metadata;
diff --git a/net/server/web_socket_encoder.cc b/net/server/web_socket_encoder.cc
index d90a156..6d59713 100644
--- a/net/server/web_socket_encoder.cc
+++ b/net/server/web_socket_encoder.cc
@@ -4,7 +4,6 @@
#include "net/server/web_socket_encoder.h"
-#include <limits>
#include <utility>
#include <vector>
diff --git a/net/spdy/spdy_alt_svc_wire_format.cc b/net/spdy/spdy_alt_svc_wire_format.cc
index a50590e..ba32160 100644
--- a/net/spdy/spdy_alt_svc_wire_format.cc
+++ b/net/spdy/spdy_alt_svc_wire_format.cc
@@ -4,7 +4,6 @@
#include "net/spdy/spdy_alt_svc_wire_format.h"
-#include <algorithm>
#include <limits>
#include <string>
diff --git a/net/ssl/client_cert_store_nss.cc b/net/ssl/client_cert_store_nss.cc
index ef29b55..8a6c329 100644
--- a/net/ssl/client_cert_store_nss.cc
+++ b/net/ssl/client_cert_store_nss.cc
@@ -6,8 +6,6 @@
#include <nss.h>
#include <ssl.h>
-
-#include <algorithm>
#include <utility>
#include "base/bind.h"
diff --git a/net/tools/quic/quic_server_session_base_test.cc b/net/tools/quic/quic_server_session_base_test.cc
index efe96ec..36432aa 100644
--- a/net/tools/quic/quic_server_session_base_test.cc
+++ b/net/tools/quic/quic_server_session_base_test.cc
@@ -26,6 +26,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using __gnu_cxx::vector;
using net::test::CryptoTestUtils;
using net::test::MockConnection;
using net::test::MockConnectionHelper;
diff --git a/net/tools/quic/quic_simple_server_session_test.cc b/net/tools/quic/quic_simple_server_session_test.cc
index fe9482f..e3ed3c9 100644
--- a/net/tools/quic/quic_simple_server_session_test.cc
+++ b/net/tools/quic/quic_simple_server_session_test.cc
@@ -30,6 +30,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using __gnu_cxx::vector;
using net::test::CryptoTestUtils;
using net::test::MockConnection;
using net::test::MockConnectionHelper;
diff --git a/styleguide/c++/c++11.html b/styleguide/c++/c++11.html
index 8c3cbc0..2776be9 100644
--- a/styleguide/c++/c++11.html
+++ b/styleguide/c++/c++11.html
@@ -363,17 +363,6 @@ std::end</a></td>
</tr>
<tr>
-<td>Forwarding references</td>
-<td><code>std::forward()</code></td>
-<td>Perfectly forwards arguments (including rvalues)</td>
-<td><a href="http://en.cppreference.com/w/cpp/utility/forward"><code>std::forward</code></a></td>
-<td>
- Allowed, though usage should be rare (primarily for forwarding constructor arguments, or in carefully reviewed library code).
- <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/-O7euklhSxs/discussion">Discussion thread</a>
-</td>
-</tr>
-
-<tr>
<td>Lexicographical struct comparison</td>
<td><code>tie(a, b, c) &lt;<br>&nbsp; tie(rhs.a, rhs.b, rhs.c)</code></td>
<td>Idiom for <code>operator&lt;</code> implementation</td>
@@ -406,6 +395,17 @@ std::end</a></td>
</tr>
<tr>
+<td>Forwarding references</td>
+<td><code>std::forward()</code></td>
+<td>Perfectly forwards arguments (including rvalues)</td>
+<td><a href="http://en.cppreference.com/w/cpp/utility/forward"><code>std::forward</code></a></td>
+<td>
+ Allowed, though usage should be rare (primarily for forwarding constructor arguments, or in carefully reviewed library code).
+ <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/-O7euklhSxs/discussion">Discussion thread</a>
+</td>
+</tr>
+
+<tr>
<td>Type Traits</td>
<td>Class templates within <code>&lt;type_traits&gt;</code></td>
<td>Allows compile-time inspection of the properties of types</td>
@@ -422,17 +422,6 @@ Standard library header &lt;type_traits&gt;</a></td>
<td>Anything in <code>&lt;cmath&gt;</code> is allowed. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/P-1bFBXMeUk">Discussion thread</a></td>
</tr>
-<tr>
-<td>Unordered Associative Containers</td>
-<td><code>std::unordered_set</code>, <code>std::unordered_map</code>,
-<code>std::unordered_multiset</code>, and <code>std::unordered_multimap</code></td>
-<td>Allows efficient containers of key/value pairs</td>
-<td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unordered_map</a>
-and <a href="http://en.cppreference.com/w/cpp/container/unordered_set">std::unordered_set</a>
-</td>
-<td>Per the <a href="https://google.github.io/styleguide/cppguide.html#std_hash">Google style guide</a>, specify custom hashers instead of specializing <code>std::hash</code> for custom types. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/nCdjQqnouO4">Discussion thread</a>.</td>
-</tr>
-
</tbody>
</table>
@@ -1069,6 +1058,17 @@ Ownership and Smart Pointers</a></td>
</tr>
<tr>
+<td>Unordered Associative Containers</td>
+<td><code>std::unordered_set</code>, <code>std::unordered_map</code>,
+<code>std::unordered_multiset</code>, and <code>std::unordered_multimap</code></td>
+<td>Allows efficient containers of key/value pairs</td>
+<td><a href="http://en.cppreference.com/w/cpp/container/unordered_map">std::unordered_map</a>
+and <a href="http://en.cppreference.com/w/cpp/container/unordered_set">std::unordered_set</a>
+</td>
+<td></td>
+</tr>
+
+<tr>
<td>Variadic Copy Macro</td>
<td><code>va_copy(va_list <i>dest</i>, va_list <i>src</i>)</code></td>
<td>Makes a copy of the variadic function arguments</td>
diff --git a/ui/base/x/selection_utils.cc b/ui/base/x/selection_utils.cc
index 7b76e5f..af84c4b 100644
--- a/ui/base/x/selection_utils.cc
+++ b/ui/base/x/selection_utils.cc
@@ -6,7 +6,6 @@
#include <stdint.h>
-#include <algorithm>
#include <set>
#include "base/i18n/icu_string_conversions.h"
diff --git a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
index f85b651..aee2282 100644
--- a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
+++ b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
@@ -7,8 +7,6 @@
#include <stddef.h>
#include <xkbcommon/xkbcommon-names.h>
-#include <algorithm>
-
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
diff --git a/ui/gfx/generic_shared_memory_id.h b/ui/gfx/generic_shared_memory_id.h
index b18c869..51f553b 100644
--- a/ui/gfx/generic_shared_memory_id.h
+++ b/ui/gfx/generic_shared_memory_id.h
@@ -8,8 +8,6 @@
#include <stddef.h>
#include <stdint.h>
-#include "base/containers/hash_tables.h"
-#include "base/hash.h"
#include "base/trace_event/memory_allocator_dump.h"
#include "ui/gfx/gfx_export.h"
@@ -60,7 +58,7 @@ template <typename Second>
struct hash<std::pair<gfx::GenericSharedMemoryId, Second>> {
size_t operator()(
const std::pair<gfx::GenericSharedMemoryId, Second>& pair) const {
- return base::HashInts(pair.first.id, pair.second);
+ return base::HashPair(pair.first.id, pair.second);
}
};