Bug 163188 - Update generated bindings code so that dictionary structures no longer need explicit constructors
Summary: Update generated bindings code so that dictionary structures no longer need e...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 163624
  Show dependency treegraph
 
Reported: 2016-10-09 16:53 PDT by Chris Dumez
Modified: 2016-10-18 14:58 PDT (History)
3 users (show)

See Also:


Attachments
Patch (45.24 KB, patch)
2016-10-09 17:15 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (45.62 KB, patch)
2016-10-09 17:46 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-10-09 16:53:32 PDT
Update generated bindings code so that dictionary structures no longer need constructors.
Comment 1 Chris Dumez 2016-10-09 17:15:09 PDT
Created attachment 291054 [details]
Patch
Comment 2 Darin Adler 2016-10-09 17:39:24 PDT
Comment on attachment 291054 [details]
Patch

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

Now that I see your change written out, I don’t see any downside to this.

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1144
> +    $result .= "    return result;\n";

We want WTFMove(result) here, otherwise we end up copying the result to make the Optional<> version. Saves work and reference count churn when there are data members that have non-trivial constructors.

> Source/WebCore/dom/ClipboardEvent.h:37
>      struct Init : public EventInit {

No need for the "public" here.

> Source/WebCore/dom/CustomEvent.h:44
>      struct Init : public EventInit {

No need for the "public" here.

> Source/WebCore/dom/EventModifierInit.h:32
>  struct EventModifierInit : public UIEventInit {

No need for the "public" here.

> Source/WebCore/editing/Editor.cpp:884
>      RefPtr<DataTransfer> dataTransfer = DataTransfer::createForCopyAndPaste(policy);

This should be auto.

> Source/WebCore/editing/Editor.cpp:889
> +    init.clipboardData = dataTransfer.get();

This should just be standard assignment. I don’t think a call to .get() would be needed here; RefPtr = RefPtr should compile and RefPtr = Ref should also compile with no get call.
Comment 3 Chris Dumez 2016-10-09 17:44:10 PDT
(In reply to comment #2)
> Comment on attachment 291054 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=291054&action=review
> 
> Now that I see your change written out, I don’t see any downside to this.

Well, the downside is that we'll have to pass non-nullable wrapper type as raw pointers for now. Thankfully, this is not common in dictionaries (only 1 instance in WebKit).
Comment 4 Chris Dumez 2016-10-09 17:46:52 PDT
Created attachment 291055 [details]
Patch
Comment 5 Chris Dumez 2016-10-09 18:18:40 PDT
Comment on attachment 291055 [details]
Patch

Clearing flags on attachment: 291055

Committed r206974: <http://trac.webkit.org/changeset/206974>
Comment 6 Chris Dumez 2016-10-09 18:18:45 PDT
All reviewed patches have been landed.  Closing bug.