Index: base/hash_tables.h |
diff --git a/base/hash_tables.h b/base/hash_tables.h |
index 8fc28352333e57a2547daa52e37861ae4964dbf1..b91d5d48bb6f4db333760087986de34e5bde84eb 100644 |
--- a/base/hash_tables.h |
+++ b/base/hash_tables.h |
@@ -29,11 +29,16 @@ |
#if defined(COMPILER_MSVC) |
#include <hash_map> |
#include <hash_set> |
-namespace base { |
-using stdext::hash_map; |
-using stdext::hash_set; |
-} |
+ |
+#define BASE_HASH_NAMESPACE stdext |
+ |
#elif defined(COMPILER_GCC) |
+#if defined(OS_ANDROID) |
+#define BASE_HASH_NAMESPACE std |
+#else |
+#define BASE_HASH_NAMESPACE __gnu_cxx |
+#endif |
+ |
// 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>. |
@@ -42,8 +47,14 @@ using stdext::hash_set; |
#undef __DEPRECATED |
#endif |
+#if defined(OS_ANDROID) |
+#include <hash_map> |
+#include <hash_set> |
+#else |
#include <ext/hash_map> |
#include <ext/hash_set> |
+#endif |
+ |
#include <string> |
#ifdef CHROME_OLD__DEPRECATED |
@@ -51,13 +62,9 @@ using stdext::hash_set; |
#undef CHROME_OLD__DEPRECATED |
#endif |
-namespace base { |
-using __gnu_cxx::hash_map; |
-using __gnu_cxx::hash_set; |
-} // namespace base |
- |
-namespace __gnu_cxx { |
+namespace BASE_HASH_NAMESPACE { |
+#if !defined(OS_ANDROID) |
// 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 |
@@ -75,6 +82,7 @@ DEFINE_TRIVIAL_HASH(long long); |
DEFINE_TRIVIAL_HASH(unsigned long long); |
#undef DEFINE_TRIVIAL_HASH |
+#endif // !defined(OS_ANDROID) |
// 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 |
@@ -98,8 +106,15 @@ DEFINE_STRING_HASH(string16); |
#undef DEFINE_STRING_HASH |
-} // namespace __gnu_cxx |
+} // namespace BASE_HASH_NAMESPACE |
+#else // COMPILER |
+#error define BASE_HASH_NAMESPACE for your compiler |
#endif // COMPILER |
+namespace base { |
+using BASE_HASH_NAMESPACE::hash_map; |
+using BASE_HASH_NAMESPACE::hash_set; |
+} |
+ |
#endif // BASE_HASH_TABLES_H_ |