Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Issue 612323010: Align base::hash_map with C++11. (Closed)

Created:
6 years, 2 months ago by davidben
Modified:
6 years, 2 months ago
Reviewers:
CC:
chromium-reviews, cbentzel+watch_chromium.org, tzik, tfarina, jam, nhiroki, darin-cc_chromium.org, mmenke, mkwst+moarreviews-renderer_chromium.org, cc-bugs_chromium.org, erikwright+watch_chromium.org, kinuko+fileapi, jshin+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Align base::hash_map with C++11. The MSVC ones have considerably different requirements than the C++11 ones and the __gnu_cxx ones we use. Notably, they require a global ordering on the key. Expose std::unordered_map as base::hash_map instead. For non-MSVC, the API is much closer, but the default hash function is off; T* doesn't have a hash by pointer value, and const char* hashes by C string (despite comparing by pointer value). Swap the default hash with one intended to match the C++11 semantics. BUG=none

Patch Set 1 #

Patch Set 2 : Use parameter names from the spec. #

Patch Set 3 : Oops #

Patch Set 4 : CanonicalCookieHasher #

Patch Set 5 : Align both against unordered_map. #

Patch Set 6 : Try a different tack for C++ insanity #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -375 lines) Patch
M base/containers/hash_tables.h View 1 2 3 4 5 6 chunks +89 lines, -24 lines 0 comments Download
M base/containers/hash_tables_unittest.cc View 1 2 3 4 2 chunks +14 lines, -0 lines 0 comments Download
M base/containers/small_map_unittest.cc View 1 2 3 4 5 1 chunk +2 lines, -3 lines 1 comment Download
M base/debug/trace_event_impl.h View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M base/files/file_path.h View 2 chunks +0 lines, -9 lines 0 comments Download
M base/memory/discardable_memory_manager.h View 1 2 3 4 1 chunk +0 lines, -12 lines 0 comments Download
M base/strings/string_piece.h View 2 chunks +0 lines, -12 lines 0 comments Download
M cc/quads/render_pass.h View 1 chunk +0 lines, -8 lines 0 comments Download
M cc/resources/prioritized_resource_manager.h View 1 2 3 4 1 chunk +0 lines, -10 lines 0 comments Download
M cc/surfaces/surface_id.h View 1 chunk +0 lines, -8 lines 0 comments Download
M cc/trees/layer_sorter.h View 1 2 3 4 1 chunk +0 lines, -13 lines 0 comments Download
M cc/trees/layer_tree_impl.h View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M chrome/browser/browsing_data/canonical_cookie_hash.h View 1 2 3 2 chunks +0 lines, -41 lines 0 comments Download
M chrome/browser/download/chrome_download_manager_delegate.h View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M chrome/browser/profiles/profile.h View 1 2 3 4 1 chunk +0 lines, -13 lines 0 comments Download
M chrome/browser/safe_browsing/protocol_manager.h View 1 2 3 4 1 chunk +0 lines, -13 lines 0 comments Download
M chrome/browser/sync_file_system/drive_backend/metadata_database_index.h View 1 chunk +0 lines, -7 lines 0 comments Download
M content/browser/manifest/manifest_manager_host.h View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M content/child/npapi/np_channel_base.h View 1 2 3 4 1 chunk +0 lines, -29 lines 0 comments Download
M content/common/gpu/gpu_memory_manager_unittest.cc View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M content/common/host_shared_bitmap_manager.h View 1 chunk +0 lines, -6 lines 0 comments Download
M content/public/browser/browser_context.h View 1 2 3 4 1 chunk +0 lines, -13 lines 0 comments Download
M content/renderer/pepper/v8_var_converter.cc View 1 2 3 4 1 chunk +0 lines, -5 lines 1 comment Download
M gpu/command_buffer/service/async_pixel_transfer_manager.h View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M net/dns/dns_hosts.h View 1 2 2 chunks +0 lines, -9 lines 0 comments Download
M net/quic/quic_ack_notifier_manager.h View 1 2 3 4 1 chunk +0 lines, -11 lines 0 comments Download
M tools/gn/label.h View 2 chunks +0 lines, -9 lines 0 comments Download
M tools/gn/label_ptr.h View 1 chunk +0 lines, -7 lines 0 comments Download
M tools/gn/output_file.h View 1 chunk +0 lines, -6 lines 0 comments Download
M tools/gn/source_dir.h View 1 chunk +0 lines, -6 lines 0 comments Download
M tools/gn/source_file.h View 1 chunk +0 lines, -6 lines 0 comments Download
M tools/gn/target.h View 1 2 3 4 1 chunk +0 lines, -16 lines 0 comments Download
M tools/gn/unique_vector.h View 2 chunks +0 lines, -13 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
davidben
[Not sending this out for review yet. Just hitting publish to make the comment visible.] ...
6 years, 2 months ago (2014-10-02 22:38:50 UTC) #1
davidben
6 years, 2 months ago (2014-10-02 22:53:59 UTC) #2
[another publish-only comment]

https://codereview.chromium.org/612323010/diff/100001/content/renderer/pepper...
File content/renderer/pepper/v8_var_converter.cc (left):

https://codereview.chromium.org/612323010/diff/100001/content/renderer/pepper...
content/renderer/pepper/v8_var_converter.cc:50: bool operator<(const
HashedHandle& h) const { return hash() < h.hash(); }
I left the other operator<'s in place because it wasn't immediately clear
whether a std::map of them would have made sense in each case...

...except this one. This one looks pretty clearly nonsense. Unless
GetIdentityHash() is secretly GetIdentityUniqueValue(), we weren't handling hash
collisions on MSVC's hash_map. It doesn't use operator==.

Powered by Google App Engine
This is Rietveld 408576698