New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 696858 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Mar 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Mojo: Support enums as map keys in WTF

Project Member Reported by tibell@chromium.org, Feb 28 2017

Issue description

Currently you cannot use enums as map keys in mojom if you're compiling for blink e.g. this will fail:

interface Iface {
  enum MyEnum {
    MY_VAL,
  };
  MyMethod(map<MyEnum, uint8> entries);
};

The reason is that we use WTF::HashMap in blink and there's no DefaultHash instance for Mojo enums.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Mar 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3bb4fdb452973721bd26d6adbcf00c9adacede4b

commit 3bb4fdb452973721bd26d6adbcf00c9adacede4b
Author: tibell <tibell@chromium.org>
Date: Mon Mar 06 00:49:39 2017

Mojo: Support enums as map keys in WTF

Since WTF::HashMap requires two special tombstone values ("empty" and "deleted")
we pick two values unlikely to be used in an enum and add a static check if they
ever are used.

Also fix hashing for StructPtr, which was broken during a clean-up.

BUG= 696858 

Review-Url: https://codereview.chromium.org/2715153004
Cr-Commit-Position: refs/heads/master@{#454805}

[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/cpp/bindings/struct_ptr.h
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/cpp/bindings/tests/BUILD.gn
[add] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/cpp/bindings/tests/map_unittest.cc
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc
[add] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/cpp/bindings/tests/wtf_map_unittest.cc
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/interfaces/bindings/tests/test_wtf_types.mojom
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/tools/bindings/blink_bindings_configuration.gni
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
[modify] https://crrev.com/3bb4fdb452973721bd26d6adbcf00c9adacede4b/mojo/public/tools/bindings/pylib/mojom/generate/module.py

Status: Fixed (was: Started)

Sign in to add a comment