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

Issue 2687923002: WTF: Support enums in DefaultHash and HashTraits by casting to integral types. (Closed)

Created:
3 years, 10 months ago by jbroman
Modified:
3 years, 10 months ago
Reviewers:
Yuta Kitamura
CC:
blink-reviews, blink-reviews-style_chromium.org, blink-reviews-wtf_chromium.org, chromium-reviews, lunalu1, Mikhail
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

WTF: Support enums in DefaultHash and HashTraits by casting to integral types. This has drawbacks for deleted and empty buckets, but no worse than what already exists for integral types. Whereas integers reserve 0 and -1 for the empty and deleted values, respectively, enums reserve -1 and -2 (or the max and max-1 values, for enums with unsigned underlying types). Since enumerators start at zero by default and negative enumerators are rare, this should suffice for most uses.

Patch Set 1 : revert test change #

Patch Set 2 : . #

Patch Set 3 : give enums different forbidden values than integers #

Patch Set 4 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+37 lines, -16 lines) Patch
M third_party/WebKit/Source/platform/weborigin/SchemeRegistry.cpp View 1 2 3 1 chunk +6 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/wtf/HashFunctions.h View 1 1 chunk +8 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/wtf/HashTraits.h View 1 2 4 chunks +23 lines, -7 lines 0 comments Download

Messages

Total messages: 27 (21 generated)
jbroman
Luna ran into this when she added a HashMap with an enum key. Enums are ...
3 years, 10 months ago (2017-02-09 19:45:47 UTC) #11
Yuta Kitamura
On 2017/02/09 19:45:47, jbroman wrote: > Luna ran into this when she added a HashMap ...
3 years, 10 months ago (2017-02-10 05:28:57 UTC) #14
jbroman
On 2017/02/10 at 05:28:57, yutak wrote: > On 2017/02/09 19:45:47, jbroman wrote: > > Luna ...
3 years, 10 months ago (2017-02-10 16:59:29 UTC) #18
jbroman
On 2017/02/10 at 16:59:29, jbroman wrote: > On 2017/02/10 at 05:28:57, yutak wrote: > > ...
3 years, 10 months ago (2017-02-10 18:23:45 UTC) #21
jbroman
On 2017/02/10 at 18:23:45, jbroman wrote: > On 2017/02/10 at 16:59:29, jbroman wrote: > > ...
3 years, 10 months ago (2017-02-13 15:12:33 UTC) #26
Yuta Kitamura
3 years, 10 months ago (2017-02-14 05:10:24 UTC) #27
Message was sent while issue was closed.
On 2017/02/13 15:12:33, jbroman wrote:
> Hmm. Changing the empty value to something else is risky, but not doing it
> causes problems for a common set of enums. Maybe not providing a default here
is
> best. :/

Yeah, that might explain why we don't have that today...

Powered by Google App Engine
This is Rietveld 408576698