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

Issue 312683005: IDL: Support optional argument default value syntax (Closed)

Created:
6 years, 6 months ago by Jens Widell
Modified:
6 years, 6 months ago
CC:
blink-reviews, eae+blinkwatch, eric.carlson_apple.com, kinuko+worker_chromium.org, rwlbuis, arv+blink, blink-reviews-css, blink-reviews-html_chromium.org, alecflett, abarth-chromium, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-bindings_chromium.org, rune+blink, sof, dgrogan, philipj_slow, feature-media-reviews_chromium.org, ericu+idb_chromium.org, darktears, jsbell+idb_chromium.org, falken, ed+blinkwatch_opera.com, Inactive, cmumford, horo+watch_chromium.org, watchdog-blink-watchlist_google.com, apavlov+blink_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

IDL: Support optional argument default value syntax Adds support for parsing default values of different types, but only handles null default values when generating code. Replaces existing [Default=Null] optional SomeInterface arg [Default=NullString] optional DOMString arg with the now equivalent optional SomeInterface arg = null optional DOMString arg = null in IDL files, and drops support for those [Default] attributes. No changes to generated code. BUG=258153 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176200

Patch Set 1 #

Total comments: 32

Patch Set 2 : address comments and revert CG changes #

Patch Set 3 : rebased #

Total comments: 19

Patch Set 4 : address nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+293 lines, -74 lines) Patch
M Source/bindings/IDLExtendedAttributes.txt View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/scripts/idl_definitions.py View 1 2 3 3 chunks +56 lines, -0 lines 0 comments Download
M Source/bindings/scripts/v8_methods.py View 1 2 3 2 chunks +7 lines, -3 lines 0 comments Download
M Source/bindings/tests/idls/TestInterfaceConstructor2.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/tests/idls/TestInterfaceNamedConstructor.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/tests/idls/TestObject.idl View 1 2 3 chunks +11 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.cpp View 1 2 7 chunks +167 lines, -20 lines 0 comments Download
M Source/bindings/v8/V8Binding.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/css/CSSStyleDeclaration.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/css/FontFaceSet.idl View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/css/WebKitCSSMatrix.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/Comment.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/DOMError.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/DOMImplementation.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/dom/Text.idl View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/frame/ConsoleBase.idl View 1 chunk +8 lines, -8 lines 0 comments Download
M Source/core/frame/Window.idl View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M Source/core/html/HTMLAudioElement.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLDialogElement.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLInputElement.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLOptionElement.idl View 1 chunk +4 lines, -1 line 0 comments Download
M Source/core/html/HTMLSelectElement.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLTextAreaElement.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/testing/TypeConversions.idl View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/timing/Performance.idl View 2 chunks +4 lines, -4 lines 0 comments Download
M Source/core/workers/SharedWorker.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/encoding/TextDecoder.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/encoding/TextEncoder.idl View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/modules/encryptedmedia/HTMLMediaElementEncryptedMedia.idl View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/modules/encryptedmedia/MediaKeys.idl View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/indexeddb/IDBDatabase.idl View 1 chunk +3 lines, -3 lines 0 comments Download
M Source/modules/indexeddb/IDBIndex.idl View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/modules/indexeddb/IDBObjectStore.idl View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/modules/speech/SpeechSynthesisUtterance.idl View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 38 (0 generated)
Jens Widell
Here's my default value patch (which I've previously talked about but not shown anyone,) slightly ...
6 years, 6 months ago (2014-06-03 14:56:19 UTC) #1
jsbell
Just some drive-by notes for places where this could be used to let us use ...
6 years, 6 months ago (2014-06-03 18:33:15 UTC) #2
Nils Barth (inactive)
On 2014/06/03 18:33:15, jsbell wrote: > Just some drive-by notes for places where this could ...
6 years, 6 months ago (2014-06-04 04:08:06 UTC) #3
Nils Barth (inactive)
Thanks Jens! This is quite clean, makes the IDLs much cleaner, and will allow us ...
6 years, 6 months ago (2014-06-04 05:22:25 UTC) #4
Jens Widell
https://codereview.chromium.org/312683005/diff/1/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/312683005/diff/1/Source/bindings/scripts/idl_definitions.py#newcode515 Source/bindings/scripts/idl_definitions.py:515: self.value = eval(node.GetProperty('NAME')) On 2014/06/04 05:22:24, Nils Barth wrote: ...
6 years, 6 months ago (2014-06-04 06:12:19 UTC) #5
Nils Barth (inactive)
Couple followups: key point is that there is a (minor) change in generated source code, ...
6 years, 6 months ago (2014-06-04 06:33:36 UTC) #6
Nils Barth (inactive)
BTW, see earlier: Support WebIDL optional default value syntax https://codereview.chromium.org/272213005/
6 years, 6 months ago (2014-06-04 07:33:27 UTC) #7
Jens Widell
On 2014/06/04 06:33:36, Nils Barth wrote: > Couple followups: key point is that there is ...
6 years, 6 months ago (2014-06-04 09:49:16 UTC) #8
Jens Widell
On 2014/06/03 18:33:15, jsbell wrote: > Just some drive-by notes for places where this could ...
6 years, 6 months ago (2014-06-04 10:14:21 UTC) #9
Jens Widell
Patch rebased, with some minor conflicts (e.g. with jsbell's ByteString patch). Any chance this could ...
6 years, 6 months ago (2014-06-13 10:42:48 UTC) #10
haraken
This is a great improvement! https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/idl_definitions.py#newcode434 Source/bindings/scripts/idl_definitions.py:434: value = node.GetProperty('NAME') Shouldn't ...
6 years, 6 months ago (2014-06-13 13:46:53 UTC) #11
Jens Widell
https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/idl_definitions.py File Source/bindings/scripts/idl_definitions.py (right): https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/idl_definitions.py#newcode434 Source/bindings/scripts/idl_definitions.py:434: value = node.GetProperty('NAME') On 2014/06/13 13:46:52, haraken wrote: > ...
6 years, 6 months ago (2014-06-13 14:14:52 UTC) #12
haraken
https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py#newcode306 Source/bindings/scripts/v8_methods.py:306: argument.default_value and argument.default_value.is_null): On 2014/06/13 14:14:52, Jens Lindström wrote: ...
6 years, 6 months ago (2014-06-13 14:32:54 UTC) #13
Jens Widell
https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py#newcode306 Source/bindings/scripts/v8_methods.py:306: argument.default_value and argument.default_value.is_null): On 2014/06/13 14:32:53, haraken wrote: > ...
6 years, 6 months ago (2014-06-13 14:49:46 UTC) #14
haraken
LGTM. https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py#newcode306 Source/bindings/scripts/v8_methods.py:306: argument.default_value and argument.default_value.is_null): On 2014/06/13 14:49:46, Jens Lindström ...
6 years, 6 months ago (2014-06-13 14:59:04 UTC) #15
jsbell
On 2014/06/13 14:59:04, haraken wrote: > > > > > > [b] foo(optional DOMString str ...
6 years, 6 months ago (2014-06-13 16:43:45 UTC) #16
jsbell
... but I don't think that should stop us from going forward with this change. ...
6 years, 6 months ago (2014-06-13 16:53:37 UTC) #17
Nils Barth (inactive)
LGTM with a nit or two; apologies for delayed review. Thanks for grit in revising ...
6 years, 6 months ago (2014-06-16 09:18:17 UTC) #18
haraken
https://codereview.chromium.org/312683005/diff/40001/Source/core/html/HTMLSelectElement.idl File Source/core/html/HTMLSelectElement.idl (right): https://codereview.chromium.org/312683005/diff/40001/Source/core/html/HTMLSelectElement.idl#newcode41 Source/core/html/HTMLSelectElement.idl:41: [RaisesException, TypeChecking=Interface] void add(HTMLElement element, optional HTMLElement? before = ...
6 years, 6 months ago (2014-06-16 09:35:40 UTC) #19
Jens Widell
https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/312683005/diff/40001/Source/bindings/scripts/v8_methods.py#newcode306 Source/bindings/scripts/v8_methods.py:306: argument.default_value and argument.default_value.is_null): On 2014/06/16 09:18:17, Nils Barth wrote: ...
6 years, 6 months ago (2014-06-16 09:37:14 UTC) #20
Jens Widell
The CQ bit was checked by jl@opera.com
6 years, 6 months ago (2014-06-16 09:47:59 UTC) #21
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jl@opera.com/312683005/60001
6 years, 6 months ago (2014-06-16 09:48:47 UTC) #22
commit-bot: I haz the power
Change committed as 176200
6 years, 6 months ago (2014-06-16 11:47:52 UTC) #23
Jens Widell
On 2014/06/16 09:18:17, Nils Barth wrote: > Agreed; here're my thoughts: > * We should ...
6 years, 6 months ago (2014-06-16 13:47:49 UTC) #24
Stephen Chennney
A revert of this CL has been created in https://codereview.chromium.org/339683002/ by schenney@chromium.org. The reason for ...
6 years, 6 months ago (2014-06-16 16:25:19 UTC) #25
Nils Barth (inactive)
haraken, thoughts on how to pass possibly missing optional arguments, and also union types? On ...
6 years, 6 months ago (2014-06-17 01:12:01 UTC) #26
Nils Barth (inactive)
On 2014/06/16 16:25:19, Stephen Chenney wrote: > A revert of this CL has been created ...
6 years, 6 months ago (2014-06-17 01:15:46 UTC) #27
haraken
On 2014/06/17 01:12:01, Nils Barth wrote: > haraken, thoughts on how to pass possibly missing ...
6 years, 6 months ago (2014-06-17 01:55:13 UTC) #28
Nils Barth (inactive)
On 2014/06/17 01:55:13, haraken wrote: > jl@ and you are more familiar with the situation ...
6 years, 6 months ago (2014-06-17 02:20:49 UTC) #29
Jens Widell
On 2014/06/17 01:55:13, haraken wrote: > On 2014/06/17 01:12:01, Nils Barth wrote: > > haraken, ...
6 years, 6 months ago (2014-06-17 09:57:10 UTC) #30
haraken
> > We'll also need to consider how to use Nullable.h. > > > > ...
6 years, 6 months ago (2014-06-17 11:05:37 UTC) #31
Jens Widell
On 2014/06/17 11:05:37, haraken wrote: > My first impression is that introducing "Optional" is a ...
6 years, 6 months ago (2014-06-17 11:25:47 UTC) #32
haraken
> And alternative that would make it more light-weight would be if we used > ...
6 years, 6 months ago (2014-06-17 11:54:45 UTC) #33
Jens Widell
On 2014/06/17 11:54:45, haraken wrote: > Help me understand: Do we need both Nullable<T> and ...
6 years, 6 months ago (2014-06-17 12:07:33 UTC) #34
Nils Barth (inactive)
On 2014/06/17 12:07:33, Jens Lindström wrote: > On 2014/06/17 11:54:45, haraken wrote: > > Help ...
6 years, 6 months ago (2014-06-17 12:38:48 UTC) #35
haraken
Thanks for the great replay, nbarth@! > Nutshell: > Support whatever Blink actually uses, as ...
6 years, 6 months ago (2014-06-17 16:02:34 UTC) #36
Jens Widell
On 2014/06/17 16:02:34, haraken wrote: > jl@: Keeping Nils' input in mind, would you take ...
6 years, 6 months ago (2014-06-17 16:12:21 UTC) #37
Nils Barth (inactive)
6 years, 6 months ago (2014-06-18 02:35:34 UTC) #38
Message was sent while issue was closed.
On 2014/06/17 16:02:34, haraken wrote:
> Off the topic: Not related to missing/nullable/optional, we might want to use
> Nullable<T> for handling values of union types. It's not nice to use
> resultXEnabled to judge if the result has a valid value or not.

Agreed; having auxiliary boolean parameters is really ugly.
A tagged union seems like a much nicer approach, though I don't know the
details.

May just be a question of an enum for possible types, and a tagged union
structure
(more likely using pointers for interface types), like:

enum FooOrBarTag {
  FOO,
  BAR,
};

struct FooOrBar {
  FooOrBarTag tag;
  union {
    Foo* foo;
    Bar* bar;
  }
};

Powered by Google App Engine
This is Rietveld 408576698