BufferSource should behave as an union
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Oct 2016 20:36:12 +0000 (20:36 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Oct 2016 20:36:12 +0000 (20:36 +0000)
commit7c179dd2b2ff1a32eec6927ae60e9e7c80dbe1ad
tree3717db4499b380948e4c55696300b4b1b5c19ba6
parent82e24f43698e40dde27aafe8d915cb9df8817646
BufferSource should behave as an union
https://bugs.webkit.org/show_bug.cgi?id=164056

Patch by Zan Dobersek <zdobersek@igalia.com> on 2016-10-27
Reviewed by Chris Dumez.

WebIDL typedefs BufferSource as (ArrayBufferView or ArrayBuffer).
To follow that definition, IDLBufferSource is now type-aliased
to IDLUnion<IDLInterface<ArrayBufferView>, IDLInterface<ArrayBuffer>>.

Converter<IDLBufferSource> template specialization can now be
removed since the default specialization for IDLUnion will be
used.

C++ implementations still work through a BufferSource object.
That class now has an implicit constructor that consumes the
Variant object. The data() and length() methods on the class
now iterate the variant to find an existing object that can
provide a pointer to the data or the length of it.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBuffer):
* bindings/generic/IDLTypes.h:
* bindings/js/BufferSource.h:
(WebCore::BufferSource::BufferSource):
(WebCore::BufferSource::data):
(WebCore::BufferSource::length):
* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLBufferSource>::convert): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208002 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediasource/SourceBuffer.cpp
Source/WebCore/bindings/generic/IDLTypes.h
Source/WebCore/bindings/js/BufferSource.h
Source/WebCore/bindings/js/JSDOMConvert.h