Chromium Code Reviews| Index: base/hash_tables.h |
| diff --git a/base/hash_tables.h b/base/hash_tables.h |
| index 8fc28352333e57a2547daa52e37861ae4964dbf1..b397b7118ec335c9104e8ed2a91fbfb617611ed7 100644 |
| --- a/base/hash_tables.h |
| +++ b/base/hash_tables.h |
| @@ -34,6 +34,12 @@ using stdext::hash_map; |
| using stdext::hash_set; |
| } |
| #elif defined(COMPILER_GCC) |
| +#if defined(OS_ANDROID) |
| +#define HASH_NAMESPACE std |
|
darin (slow to review)
2011/06/24 16:46:05
since this is a global #define, you should probabl
michaelbai
2011/06/24 18:51:30
Done.
|
| +#else |
| +#define 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 +48,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 |
| @@ -52,12 +64,13 @@ using stdext::hash_set; |
| #endif |
| namespace base { |
| -using __gnu_cxx::hash_map; |
| -using __gnu_cxx::hash_set; |
| +using HASH_NAMESPACE::hash_map; |
| +using HASH_NAMESPACE::hash_set; |
| } // namespace base |
| -namespace __gnu_cxx { |
| +namespace 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 +88,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,7 +112,7 @@ DEFINE_STRING_HASH(string16); |
| #undef DEFINE_STRING_HASH |
| -} // namespace __gnu_cxx |
| +} // namespace HASH_NAMESPACE |
| #endif // COMPILER |