Bug 161185 - Add the ability to override the implementation name of IDL enums and dictionaries
Summary: Add the ability to override the implementation name of IDL enums and dictiona...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-24 23:21 PDT by Sam Weinig
Modified: 2016-09-07 18:08 PDT (History)
6 users (show)

See Also:


Attachments
Patch (14.75 KB, patch)
2016-08-25 11:06 PDT, Sam Weinig
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2016-08-24 23:21:45 PDT
Add the ability to override the implementation name of IDL enums and dictionaries
Comment 1 Sam Weinig 2016-08-25 11:06:07 PDT
Created attachment 286985 [details]
Patch
Comment 2 Sam Weinig 2016-08-25 11:37:53 PDT
Committed revision 204978.
Comment 3 Chris Dumez 2016-08-25 11:51:27 PDT
Comment on attachment 286985 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=286985&action=review

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:810
> +    if ($codeGenerator->HasEnumImplementationNameOverride($name)) {

Isn't this a bit overkill? Why don't we just check the ImplementedAs extended attribute here?
Then we wouldn't need to update CodeGenerator.pm at all, right?

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:929
> +    if ($codeGenerator->HasDictionaryImplementationNameOverride($name)) {

Isn't this a bit overkill? Why don't we just check the ImplementedAs extended attribute here?
Then we wouldn't need to update CodeGenerator.pm at all, right?
Comment 4 Darin Adler 2016-08-27 17:09:38 PDT
I’m kind of sad we needed this. I liked the idea of doing it all just by putting "using" in the various classes.
Comment 5 Chris Dumez 2016-09-06 13:33:08 PDT
(In reply to comment #4)
> I’m kind of sad we needed this. I liked the idea of doing it all just by
> putting "using" in the various classes.

FYI, Simon tried this for DOMWindow::ScrollToOptions / Element::ScrollToOptions and got the following linking error:
duplicate symbol __ZN7WebCore17convertDictionaryINS_15ScrollToOptionsEEEN3WTF8OptionalIT_EERN3JSC9ExecStateENS6_7JSValueE in: OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/x86_64/JSDOMWindow.o  OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/x86_64/JSElement.o
Comment 6 Darin Adler 2016-09-06 15:41:40 PDT
(In reply to comment #5)
> FYI, Simon tried this for DOMWindow::ScrollToOptions /
> Element::ScrollToOptions and got the following linking error:
> duplicate symbol
> __ZN7WebCore17convertDictionaryINS_15ScrollToOptionsEEEN3WTF8OptionalIT_EERN3
> JSC9ExecStateENS6_7JSValueE in:
> OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/
> x86_64/JSDOMWindow.o 
> OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/
> x86_64/JSElement.o

Very interesting. We need to consider how to work around this. One trick might be to mark the functions inline even if they don’t actually get inlined. Or make them templates even though they don’t need to be. But maybe there’s a better solution.
Comment 7 Chris Dumez 2016-09-06 15:45:57 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > FYI, Simon tried this for DOMWindow::ScrollToOptions /
> > Element::ScrollToOptions and got the following linking error:
> > duplicate symbol
> > __ZN7WebCore17convertDictionaryINS_15ScrollToOptionsEEEN3WTF8OptionalIT_EERN3
> > JSC9ExecStateENS6_7JSValueE in:
> > OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/
> > x86_64/JSDOMWindow.o 
> > OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/
> > x86_64/JSElement.o
> 
> Very interesting. We need to consider how to work around this. One trick
> might be to mark the functions inline even if they don’t actually get
> inlined. Or make them templates even though they don’t need to be. But maybe
> there’s a better solution.

I think that if we enabled sharing of dictionaries between IDL files, some of the trouble would go away. Right now, ScrollToOptions is duplicated in DOMWindow.idl and Element.idl that the parsing code is generated twice.
Comment 8 Sam Weinig 2016-09-07 18:08:53 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > FYI, Simon tried this for DOMWindow::ScrollToOptions /
> > > Element::ScrollToOptions and got the following linking error:
> > > duplicate symbol
> > > __ZN7WebCore17convertDictionaryINS_15ScrollToOptionsEEEN3WTF8OptionalIT_EERN3
> > > JSC9ExecStateENS6_7JSValueE in:
> > > OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/
> > > x86_64/JSDOMWindow.o 
> > > OpenSource/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/
> > > x86_64/JSElement.o
> > 
> > Very interesting. We need to consider how to work around this. One trick
> > might be to mark the functions inline even if they don’t actually get
> > inlined. Or make them templates even though they don’t need to be. But maybe
> > there’s a better solution.
> 
> I think that if we enabled sharing of dictionaries between IDL files, some
> of the trouble would go away. Right now, ScrollToOptions is duplicated in
> DOMWindow.idl and Element.idl that the parsing code is generated twice.

What is the plan for that? Should we pull all dictionaries / enumerations out into their own idl files and have them generate their own .h/cpp files? If we do that, how will the code generator know that a type is a dictionary and not an interface type? Should we generate a type mapping for all types up front? Do it lazily? So many questions.