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

Issue 2810843002: bindings: Make the sequence conversion code more complaint with WebIDL. (Closed)

Created:
3 years, 8 months ago by Raphael Kubo da Costa (rakuco)
Modified:
3 years, 8 months ago
Reviewers:
haraken, bashi, jsbell, Yuki
CC:
chromium-reviews, blink-reviews-w3ctests_chromium.org, shans, rjwright, blink-reviews-animation_chromium.org, jbroman+watch_chromium.org, blink-reviews-bindings_chromium.org, darktears, blink-reviews, blink-reviews-frames_chromium.org, Eric Willigers
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

bindings: Make the sequence conversion code more complaint with WebIDL. The existing bindings still referenced WebIDL array types that were removed from the spec in 2015, and converting JS types to IDL sequences with an algorithm that expected either a JS array (in which case it just iterated over each element) or an object that adhered to an outdated protocol where a "length" property was expected. The current WebIDL sequence conversion steps are simpler and described in https://heycam.github.io/webidl/#es-sequence. In short, JS objects are converted to sequences via @@iterator and the regular iteration protocol of calling next() and checking the returned object. This works with arrays as well as any object that implements a valid Symbol.iterator property. It opens the way for custom iterators, the lack of which was causing some layout tests to fail. In other words, any iterable JS object can now be converted into a sequence<>. The downside is that the Blink-V8 communication required for calling @@iterator, invoking next() and checking objects on every iteration step is costlier than what we had before, so the "fast case" has been preserved for JS arrays (even though it is not 100% clear if this is a valid shortcut to take, it at least does not introduce any regression compared to the previous code). This change is implemented by moving all the conversion code to NativeValueTraits like we already do for WebIDL record types, and making the Python WebIDL compiler code use it instead. This allows us to get rid of: - 2 ToMemberNativeArray() overloads - 2 ToImplArray() overloads - ToV8Sequence() - ToImplSequence() - 5 deprecated NativeValueTraits specializations in addition to simplifying the Python code in v8_types.py by making it less smart. BUG=690428 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org

Patch Set 1 #

Total comments: 10

Patch Set 2 : Rebase, fix most tests and adjust to feedback #

Patch Set 3 : More test adjustments #

Patch Set 4 : Remove lambdas from the conversion code, add performance test #

Patch Set 5 : Adjust even more tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1010 lines, -841 lines) Patch
A third_party/WebKit/LayoutTests/bindings/sequence-type.html View 1 chunk +207 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/crypto/subtle/aes-cbc/generateKey-failures-expected.txt View 1 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/crypto/subtle/unwrapKey-badParameters-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/csspaint/parse-input-arguments-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/csspaint/registerPaint-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/FileAPI/blob/Blob-constructor-expected.txt View 1 1 chunk +4 lines, -6 lines 0 comments Download
D third_party/WebKit/LayoutTests/external/wpt/fetch/api/headers/headers-record-expected.txt View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-expected.txt View 2 chunks +2 lines, -9 lines 0 comments Download
M third_party/WebKit/LayoutTests/external/wpt/webmessaging/with-ports/027.html View 1 2 3 1 chunk +12 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/canvas-lineDash-input-sequence.html View 1 1 chunk +18 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/Window/window-postmessage-args.html View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt View 1 2 chunks +7 lines, -8 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/idl-union-type-unittest-expected.txt View 1 1 chunk +6 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/constructors/message-event-constructor.html View 1 2 chunks +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt View 1 2 chunks +13 lines, -13 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/init-message-event.html View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/init-message-event-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/message-event-max-ports.html View 1 1 chunk +3 lines, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/message-event-max-ports-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/message-port-multi-expected.txt View 1 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/events/resources/message-port-multi.js View 1 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/blob-constructor.html View 1 2 chunks +34 lines, -27 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/blob-constructor-expected.txt View 1 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/file-constructor.html View 1 2 chunks +14 lines, -7 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/file-constructor-expected.txt View 1 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamConstructor-expected.txt View 1 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-expected.txt View 1 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/workers/worker-context-multi-port-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/workers/worker-multi-port-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/workers/worker-onerror-09.html View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/workers/worker-onerror-09-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
D third_party/WebKit/LayoutTests/platform/linux/external/wpt/FileAPI/blob/Blob-constructor-expected.txt View 1 2 1 chunk +4 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/platform/win/external/wpt/FileAPI/blob/Blob-constructor-expected.txt View 1 1 chunk +4 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/storage/websql/execute-sql-args.js View 1 3 chunks +15 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/storage/websql/execute-sql-args-expected.txt View 1 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/files/blob-constructor-expected.txt View 1 2 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/workers/worker-onerror-09-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/webaudio/dom-exceptions-expected.txt View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/webaudio/dom-exceptions-expected.txt View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
A third_party/WebKit/PerformanceTests/Bindings/sequence-conversion-custom-iterator.html View 1 2 3 1 chunk +30 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/bindings.gni View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/DictionaryHelperForCore.cpp View 2 chunks +5 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ExceptionMessages.h View 1 1 chunk +0 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ExceptionMessages.cpp View 1 1 chunk +0 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h View 1 2 3 1 chunk +110 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp View 1 2 3 1 chunk +178 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinitionBuilder.cpp View 3 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptPromiseTest.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/ScriptValue.h View 1 chunk +10 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp View 3 chunks +8 lines, -17 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8Binding.h View 1 5 chunks +8 lines, -338 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8Binding.cpp View 1 1 chunk +17 lines, -0 lines 0 comments Download
D third_party/WebKit/Source/bindings/core/v8/V8BindingTest.cpp View 1 2 3 1 chunk +0 lines, -167 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/custom/V8MessageEventCustom.cpp View 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_methods.py View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_types.py View 1 4 chunks +7 lines, -42 lines 0 comments Download
M third_party/WebKit/Source/bindings/templates/union_container.cpp.tmpl View 1 1 chunk +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/BooleanOrElementSequence.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/ByteStringSequenceSequenceOrByteStringByteStringRecord.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/DoubleOrLongOrBooleanSequence.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/DoubleOrStringOrDoubleOrStringSequence.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/ElementSequenceOrByteStringDoubleOrStringRecord.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/LongSequenceOrEvent.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/NodeOrLongSequenceOrEventOrXMLHttpRequestOrStringOrStringByteStringOrNodeListRecord.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/StringOrStringSequence.cpp View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/StringSequenceCallbackFunctionLongSequenceArg.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionary.cpp View 1 8 chunks +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp View 1 2 3 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 22 chunks +22 lines, -22 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 2 3 4 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/BUILD.gn View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/core_idl_files.gni View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/DOMTimerTest.cpp View 1 2 chunks +4 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.h View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.cpp View 1 2 3 2 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/testing/Internals.idl View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/core/testing/SequenceTest.h View 1 chunk +49 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/testing/SequenceTest.cpp View 1 chunk +54 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/core/testing/SequenceTest.idl View 1 chunk +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/cachestorage/Cache.cpp View 3 chunks +7 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/modules/cachestorage/CacheTest.cpp View 1 2 3 3 chunks +10 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp View 3 chunks +8 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp View 1 1 chunk +7 lines, -3 lines 0 comments Download

Messages

Total messages: 14 (2 generated)
Raphael Kubo da Costa (rakuco)
PTAL. I probably still need to adjust some layout test expectations, but the actual code ...
3 years, 8 months ago (2017-04-10 17:27:58 UTC) #1
jsbell
Drive-by (since I'll probably be on tap later anyway...) I was looking at the storage/websql ...
3 years, 8 months ago (2017-04-10 21:09:24 UTC) #3
bashi
Great improvement! Generally looks good to me. I'd prefer splitting this CL into small parts. ...
3 years, 8 months ago (2017-04-11 00:34:00 UTC) #4
haraken
The overall approach looks good to me. Yeah, I'm also interested in the performance impact ...
3 years, 8 months ago (2017-04-11 01:43:54 UTC) #5
Yuki
The change looks great!! https://codereview.chromium.org/2810843002/diff/1/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h File third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h (right): https://codereview.chromium.org/2810843002/diff/1/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h#newcode300 third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImpl.h:300: if (value->IsArray()) { On 2017/04/11 ...
3 years, 8 months ago (2017-04-11 07:17:11 UTC) #6
Raphael Kubo da Costa (rakuco)
Thanks for the feedback, everyone. I've uploaded patch v2, which still contains all the code ...
3 years, 8 months ago (2017-04-12 15:38:02 UTC) #7
bashi
Still looks good to me. On 2017/04/12 15:38:02, Raphael Kubo da Costa (rakuco) wrote: > ...
3 years, 8 months ago (2017-04-13 08:03:12 UTC) #8
Raphael Kubo da Costa (rakuco)
On 2017/04/13 08:03:12, bashi wrote: > Did you check any performance regressions? Maybe we want ...
3 years, 8 months ago (2017-04-13 17:41:10 UTC) #9
Yuki
LGTM. Sorry to be late.
3 years, 8 months ago (2017-04-14 08:04:00 UTC) #10
haraken
On 2017/04/13 17:41:10, rakuco (OoO on the 17th) wrote: > On 2017/04/13 08:03:12, bashi wrote: ...
3 years, 8 months ago (2017-04-17 15:06:03 UTC) #11
Raphael Kubo da Costa (rakuco)
On 2017/04/17 15:06:03, haraken wrote: > Are you planning to split PS5 into pieces? Yes, ...
3 years, 8 months ago (2017-04-18 15:55:49 UTC) #12
Raphael Kubo da Costa (rakuco)
3 years, 8 months ago (2017-04-21 16:09:19 UTC) #14
The patches are being landed separately, so I guess it's time to close this CL.

Powered by Google App Engine
This is Rietveld 408576698