diff options
author | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 19:13:10 +0000 |
---|---|---|
committer | michaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-27 19:13:10 +0000 |
commit | be16cf2bcf61a6ac255c347a6ba8c65d213a5a11 (patch) | |
tree | 2b1ddc1ec5d6917f09afad312c18ec5448feb248 /base/hash_tables.h | |
parent | b9c587d5a7e5d0a6c669b4fd2fd6d09985b26a2f (diff) | |
download | chromium_src-be16cf2bcf61a6ac255c347a6ba8c65d213a5a11.zip chromium_src-be16cf2bcf61a6ac255c347a6ba8c65d213a5a11.tar.gz chromium_src-be16cf2bcf61a6ac255c347a6ba8c65d213a5a11.tar.bz2 |
Upstream android string implementation etc.
BUG=
TEST=
Review URL: http://codereview.chromium.org/7238018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/hash_tables.h')
-rw-r--r-- | base/hash_tables.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/base/hash_tables.h b/base/hash_tables.h index 8fc2835..b91d5d4 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_ |