Chromium Code Reviews| Index: base/hash_tables.h |
| diff --git a/base/hash_tables.h b/base/hash_tables.h |
| index 8fc28352333e57a2547daa52e37861ae4964dbf1..ce5ac642156db062fa30805af3127bd062670210 100644 |
| --- a/base/hash_tables.h |
| +++ b/base/hash_tables.h |
| @@ -29,11 +29,20 @@ |
| #if defined(COMPILER_MSVC) |
| #include <hash_map> |
| #include <hash_set> |
| + |
| +#define BASE_HASH_NAMESPACE stdext |
| + |
| namespace base { |
| -using stdext::hash_map; |
| -using stdext::hash_set; |
| +using BASE_HASH_NAMESPACE::hash_map; |
| +using BASE_HASH_NAMESPACE::hash_set; |
| } |
| #elif defined(COMPILER_GCC) |
|
brettw
2011/06/24 23:57:04
CAn you add blank lines around this for readabilit
michaelbai
2011/06/27 16:14:09
Done.
|
| +#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 +51,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 +67,13 @@ using stdext::hash_set; |
| #endif |
| namespace base { |
|
darin (slow to review)
2011/06/24 23:41:12
i guess it would be nice to not repeat this code.
michaelbai
2011/06/24 23:45:35
I thought about it before, the whole structure in
brettw
2011/06/24 23:57:04
Do we support any other compilers? In these cases
michaelbai
2011/06/27 16:14:09
Done.
|
| -using __gnu_cxx::hash_map; |
| -using __gnu_cxx::hash_set; |
| +using BASE_HASH_NAMESPACE::hash_map; |
| +using BASE_HASH_NAMESPACE::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 +91,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 +115,7 @@ DEFINE_STRING_HASH(string16); |
| #undef DEFINE_STRING_HASH |
| -} // namespace __gnu_cxx |
| +} // namespace BASE_HASH_NAMESPACE |
| #endif // COMPILER |