diff options
author | davidben <davidben@chromium.org> | 2014-10-24 13:19:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-24 20:20:18 +0000 |
commit | 44d2e5c45975ab36f29035552521e41ae512c8bf (patch) | |
tree | 2bd17cfaaa7cb74c36759f81659404f7fc4d075d /cc/quads/render_pass.h | |
parent | 09ac0842aa0603f504d8877b015dc3d04a0b928f (diff) | |
download | chromium_src-44d2e5c45975ab36f29035552521e41ae512c8bf.zip chromium_src-44d2e5c45975ab36f29035552521e41ae512c8bf.tar.gz chromium_src-44d2e5c45975ab36f29035552521e41ae512c8bf.tar.bz2 |
Align base::hash_map with C++11, part 2.
MSVC's stdext::hash_map, unlike C++11's std::unordered_map and GCC's
__gnu_cxx::hash_map, requires a total order on the key. It also has a very
different syntax for supplying a default hash function.
Switch MSVC to std::unordered_map, but exposed as base::hash_map. This aligns
both the container and the default hash function. The default hash function now
differs from our GCC one in that const char * is no longer hashed as a C string.
To align GCC with C++11 semantics and the MSVC ones this CL introduces, also
provide a new hash function and swap the default hash with it. This new
function is identical to __gnu_cxx::hash, but it does not specialize const
char* and does specialize T* (which was already aligned by
https://codereview.chromium.org/630503002/).
Note: This CL changes a file in mojo/ and will need to be mirrored in the
mojo repository before the next sync.
BUG=420242
Review URL: https://codereview.chromium.org/623383002
Cr-Commit-Position: refs/heads/master@{#301185}
Diffstat (limited to 'cc/quads/render_pass.h')
-rw-r--r-- | cc/quads/render_pass.h | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h index 76536b5..2877588 100644 --- a/cc/quads/render_pass.h +++ b/cc/quads/render_pass.h @@ -133,20 +133,12 @@ class CC_EXPORT RenderPass { } // namespace cc namespace BASE_HASH_NAMESPACE { -#if defined(COMPILER_MSVC) -inline size_t hash_value(const cc::RenderPassId& key) { - return base::HashPair(key.layer_id, key.index); -} -#elif defined(COMPILER_GCC) template <> struct hash<cc::RenderPassId> { size_t operator()(cc::RenderPassId key) const { return base::HashPair(key.layer_id, key.index); } }; -#else -#error define a hash function for your compiler -#endif // COMPILER } // namespace BASE_HASH_NAMESPACE namespace cc { |