Bug 158254 - Bindings generator: Improve support for sharing enums between idl files
Summary: Bindings generator: Improve support for sharing enums between idl files
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 143211
  Show dependency treegraph
 
Reported: 2016-06-01 01:37 PDT by Adam Bergkvist
Modified: 2016-06-01 01:38 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Bergkvist 2016-06-01 01:37:47 PDT
This can be done in two steps:

1. Define the enum in each idl file, but support sharing the underlying C++ enum. This does not currently work due to duplication of generated enum conversion functions.

2. Allow "importing" an idl enum in an other idl file. This would probably require some work, but would minimize the need for mirrored enums that needs to be synced.

Example where this could be useful:

RTCPeerConnection.idl:

    [StrictTypeChecking, RaisesException] RTCRtpTransceiver addTransceiver(MediaStreamTrack track, optional RTCRtpTransceiverInit init);
    [StrictTypeChecking, RaisesException] RTCRtpTransceiver addTransceiver(DOMString kind, optional RTCRtpTransceiverInit init);

    enum RTCRtpTransceiverDirection { "sendrecv", "sendonly", "recvonly", "inactive" };

    dictionary RTCRtpTransceiverInit {
        RTCRtpTransceiverDirection direction = "sendrecv";
    };

RTCRtpTransceiver.idl:

    readonly attribute RTCRtpTransceiverDirection direction;
    void setDirection(RTCRtpTransceiverDirection direction);

    enum RTCRtpTransceiverDirection { "sendrecv", "sendonly", "recvonly", "inactive" };