<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207462] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207462">207462</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2016-10-18 06:15:40 -0700 (Tue, 18 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebIDL] Support BufferSource
https://bugs.webkit.org/show_bug.cgi?id=163541

Reviewed by Youenn Fablet.

Add support for the BufferSource typedef in WebIDL. The implementation
adds the necessary handling for this type in the generator scripts and
the specialization of the Converter&lt;&gt; template for the IDLBufferSource
struct that enables exposing ArrayBuffer or ArrayBufferView objects by
having WebCore::BufferSource objects pointing to their data.

The SourceBuffer interface in the MSE module has the appendBuffer()
operation modified to accept a BufferSource parameter, instead of
overloading it for ArrayBuffer and ArrayBufferView parameters.

The bindings generator tests cover BufferSource as both an operation
parameter and as a dictionary member.

* Modules/mediasource/SourceBuffer.cpp:
(WebCore::SourceBuffer::appendBuffer):
(WebCore::SourceBuffer::appendBufferInternal):
* Modules/mediasource/SourceBuffer.h:
* Modules/mediasource/SourceBuffer.idl:
* WebCore.xcodeproj/project.pbxproj:
* bindings/generic/IDLTypes.h:
* bindings/js/BufferSource.h: Added.
* bindings/js/JSDOMConvert.h:
(WebCore::Converter&lt;IDLBufferSource&gt;::convert):
* bindings/scripts/CodeGenerator.pm:
(SkipIncludeHeader):
(IsWrapperType):
* bindings/scripts/CodeGeneratorJS.pm:
(AddClassForwardIfNeeded):
(GetBaseIDLType):
(IsHandledByDOMConvert):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convertDictionary&lt;TestObj::Dictionary&gt;):
(WebCore::jsTestObjPrototypeFunctionBufferSourceParameter):
(WebCore::jsTestObjPrototypeFunctionBufferSourceParameterCaller):
* bindings/scripts/test/TestObj.idl:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceSourceBuffercpp">trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceSourceBufferh">trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesmediasourceSourceBufferidl">trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsgenericIDLTypesh">trunk/Source/WebCore/bindings/generic/IDLTypes.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsBufferSourceh">trunk/Source/WebCore/bindings/js/BufferSource.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/ChangeLog        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-10-18  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        [WebIDL] Support BufferSource
+        https://bugs.webkit.org/show_bug.cgi?id=163541
+
+        Reviewed by Youenn Fablet.
+
+        Add support for the BufferSource typedef in WebIDL. The implementation
+        adds the necessary handling for this type in the generator scripts and
+        the specialization of the Converter&lt;&gt; template for the IDLBufferSource
+        struct that enables exposing ArrayBuffer or ArrayBufferView objects by
+        having WebCore::BufferSource objects pointing to their data.
+
+        The SourceBuffer interface in the MSE module has the appendBuffer()
+        operation modified to accept a BufferSource parameter, instead of
+        overloading it for ArrayBuffer and ArrayBufferView parameters.
+
+        The bindings generator tests cover BufferSource as both an operation
+        parameter and as a dictionary member.
+
+        * Modules/mediasource/SourceBuffer.cpp:
+        (WebCore::SourceBuffer::appendBuffer):
+        (WebCore::SourceBuffer::appendBufferInternal):
+        * Modules/mediasource/SourceBuffer.h:
+        * Modules/mediasource/SourceBuffer.idl:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/generic/IDLTypes.h:
+        * bindings/js/BufferSource.h: Added.
+        * bindings/js/JSDOMConvert.h:
+        (WebCore::Converter&lt;IDLBufferSource&gt;::convert):
+        * bindings/scripts/CodeGenerator.pm:
+        (SkipIncludeHeader):
+        (IsWrapperType):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (AddClassForwardIfNeeded):
+        (GetBaseIDLType):
+        (IsHandledByDOMConvert):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::convertDictionary&lt;TestObj::Dictionary&gt;):
+        (WebCore::jsTestObjPrototypeFunctionBufferSourceParameter):
+        (WebCore::jsTestObjPrototypeFunctionBufferSourceParameterCaller):
+        * bindings/scripts/test/TestObj.idl:
+
</ins><span class="cx"> 2016-10-18  Javier Fernandez  &lt;jfernandez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [css-grid] Different width of grid container between initial load and refresh
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceSourceBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.cpp        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #if ENABLE(MEDIA_SOURCE)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;AudioTrackList.h&quot;
</span><ins>+#include &quot;BufferSource.h&quot;
</ins><span class="cx"> #include &quot;Event.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="lines">@@ -231,17 +232,11 @@
</span><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-ExceptionOr&lt;void&gt; SourceBuffer::appendBuffer(ArrayBuffer&amp; data)
</del><ins>+ExceptionOr&lt;void&gt; SourceBuffer::appendBuffer(const BufferSource&amp; data)
</ins><span class="cx"> {
</span><del>-    return appendBufferInternal(static_cast&lt;unsigned char*&gt;(data.data()), data.byteLength());
</del><ins>+    return appendBufferInternal(static_cast&lt;const unsigned char*&gt;(data.data), data.length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;void&gt; SourceBuffer::appendBuffer(ArrayBufferView&amp; data)
-{
-    return appendBufferInternal(static_cast&lt;unsigned char*&gt;(data.baseAddress()), data.byteLength());
-}
-
</del><span class="cx"> void SourceBuffer::resetParserState()
</span><span class="cx"> {
</span><span class="cx">     // Section 3.5.2 Reset Parser State algorithm steps.
</span><span class="lines">@@ -496,7 +491,7 @@
</span><span class="cx">     m_asyncEventQueue.enqueueEvent(WTFMove(event));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr&lt;void&gt; SourceBuffer::appendBufferInternal(unsigned char* data, unsigned size)
</del><ins>+ExceptionOr&lt;void&gt; SourceBuffer::appendBufferInternal(const unsigned char* data, unsigned size)
</ins><span class="cx"> {
</span><span class="cx">     // Section 3.2 appendBuffer()
</span><span class="cx">     // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#widl-SourceBuffer-appendBuffer-void-ArrayBufferView-data
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceSourceBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.h        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class AudioTrackList;
</span><ins>+class BufferSource;
</ins><span class="cx"> class MediaSource;
</span><span class="cx"> class PlatformTimeRanges;
</span><span class="cx"> class TextTrackList;
</span><span class="lines">@@ -74,8 +75,7 @@
</span><span class="cx">     double appendWindowEnd() const;
</span><span class="cx">     ExceptionOr&lt;void&gt; setAppendWindowEnd(double);
</span><span class="cx"> 
</span><del>-    ExceptionOr&lt;void&gt; appendBuffer(ArrayBuffer&amp;);
-    ExceptionOr&lt;void&gt; appendBuffer(ArrayBufferView&amp;);
</del><ins>+    ExceptionOr&lt;void&gt; appendBuffer(const BufferSource&amp;);
</ins><span class="cx">     ExceptionOr&lt;void&gt; abort();
</span><span class="cx">     ExceptionOr&lt;void&gt; remove(double start, double end);
</span><span class="cx">     ExceptionOr&lt;void&gt; remove(const MediaTime&amp;, const MediaTime&amp;);
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">     bool isRemoved() const;
</span><span class="cx">     void scheduleEvent(const AtomicString&amp; eventName);
</span><span class="cx"> 
</span><del>-    ExceptionOr&lt;void&gt; appendBufferInternal(unsigned char*, unsigned);
</del><ins>+    ExceptionOr&lt;void&gt; appendBufferInternal(const unsigned char*, unsigned);
</ins><span class="cx">     void appendBufferTimerFired();
</span><span class="cx">     void resetParserState();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediasourceSourceBufferidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/Modules/mediasource/SourceBuffer.idl        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -57,8 +57,7 @@
</span><span class="cx">     [SetterMayThrowException] attribute unrestricted double appendWindowEnd;
</span><span class="cx"> 
</span><span class="cx">     // Append segment data.
</span><del>-    [MayThrowException] void appendBuffer(ArrayBuffer data);
-    [MayThrowException] void appendBuffer(ArrayBufferView data);
</del><ins>+    [MayThrowException] void appendBuffer(BufferSource data);
</ins><span class="cx"> 
</span><span class="cx">     // Abort the current segment append sequence.
</span><span class="cx">     [MayThrowException] void abort();
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -1256,6 +1256,7 @@
</span><span class="cx">                 2DE70023192FE82A00B0975C /* DisplayRefreshMonitorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */; };
</span><span class="cx">                 2DF512CD1D873E47001D6780 /* ReplaceRangeWithTextCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DF512CB1D873E47001D6780 /* ReplaceRangeWithTextCommand.cpp */; };
</span><span class="cx">                 2DF512CE1D873E47001D6780 /* ReplaceRangeWithTextCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DF512CC1D873E47001D6780 /* ReplaceRangeWithTextCommand.h */; };
</span><ins>+                2DFA488F1DB541D000362B99 /* BufferSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DFA488E1DB541C200362B99 /* BufferSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 2E0888D41148848A00AF4265 /* JSDOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */; };
</span><span class="cx">                 2E0888D51148848A00AF4265 /* JSDOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0888D31148848A00AF4265 /* JSDOMFormData.h */; };
</span><span class="cx">                 2E19516B1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2E19516A1B6598D200DF6EEF /* WheelEventDeltaFilter.cpp */; };
</span><span class="lines">@@ -5974,6 +5975,7 @@
</span><span class="cx">                 E125F83A1824104800D84CD9 /* CryptoAlgorithmAesCbcParamsDeprecated.h in Headers */ = {isa = PBXBuildFile; fileRef = E125F8391824104800D84CD9 /* CryptoAlgorithmAesCbcParamsDeprecated.h */; };
</span><span class="cx">                 E125F83D182411E700D84CD9 /* JSCryptoOperationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E125F83B182411E700D84CD9 /* JSCryptoOperationData.cpp */; };
</span><span class="cx">                 E125F83E182411E700D84CD9 /* JSCryptoOperationData.h in Headers */ = {isa = PBXBuildFile; fileRef = E125F83C182411E700D84CD9 /* JSCryptoOperationData.h */; };
</span><ins>+
</ins><span class="cx">                 E125F8411824253A00D84CD9 /* CryptoAlgorithmAES_CBC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E125F83F1824253A00D84CD9 /* CryptoAlgorithmAES_CBC.cpp */; };
</span><span class="cx">                 E125F8421824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h in Headers */ = {isa = PBXBuildFile; fileRef = E125F8401824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h */; };
</span><span class="cx">                 E125F845182425C900D84CD9 /* CryptoAlgorithmAES_CBCMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E125F843182425C900D84CD9 /* CryptoAlgorithmAES_CBCMac.cpp */; };
</span><span class="lines">@@ -8235,6 +8237,7 @@
</span><span class="cx">                 2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DF512CB1D873E47001D6780 /* ReplaceRangeWithTextCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceRangeWithTextCommand.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DF512CC1D873E47001D6780 /* ReplaceRangeWithTextCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceRangeWithTextCommand.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2DFA488E1DB541C200362B99 /* BufferSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BufferSource.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2E0888C3114883A900AF4265 /* DOMFormData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFormData.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2E0888D21148848A00AF4265 /* JSDOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFormData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2E0888D31148848A00AF4265 /* JSDOMFormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMFormData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -21415,6 +21418,7 @@
</span><span class="cx">                                 14DFB33F0A7DF7630018F769 /* Derived Sources */,
</span><span class="cx">                                 49B3760A15C6C6840059131D /* ArrayValue.cpp */,
</span><span class="cx">                                 49B3760B15C6C6840059131D /* ArrayValue.h */,
</span><ins>+                                2DFA488E1DB541C200362B99 /* BufferSource.h */,
</ins><span class="cx">                                 BCD533630ED6848900887468 /* CachedScriptSourceProvider.h */,
</span><span class="cx">                                 93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */,
</span><span class="cx">                                 312D67B01535691F00563D0D /* Dictionary.cpp */,
</span><span class="lines">@@ -26798,6 +26802,7 @@
</span><span class="cx">                                 0FC4E40D187F82E10045882C /* ScrollingCoordinatorIOS.h in Headers */,
</span><span class="cx">                                 9391A991162746CB00297330 /* ScrollingCoordinatorMac.h in Headers */,
</span><span class="cx">                                 93C38BFF164473C700091EB2 /* ScrollingStateFixedNode.h in Headers */,
</span><ins>+                                2DFA488F1DB541D000362B99 /* BufferSource.h in Headers */,
</ins><span class="cx">                                 0FEA3E7B191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h in Headers */,
</span><span class="cx">                                 931CBD0D161A44E900E4C874 /* ScrollingStateNode.h in Headers */,
</span><span class="cx">                                 0FEA3E84191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class BufferSource;
</ins><span class="cx"> template &lt;typename Value&gt; class DOMPromise;
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt;
</span><span class="lines">@@ -118,6 +119,7 @@
</span><span class="cx">     using TypeList = brigand::list&lt;Ts...&gt;;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+struct IDLBufferSource : IDLType&lt;BufferSource&gt; { };
</ins><span class="cx"> 
</span><span class="cx"> // Helper predicates
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsBufferSourceh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/js/BufferSource.h (0 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/BufferSource.h                                (rev 0)
+++ trunk/Source/WebCore/bindings/js/BufferSource.h        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+/*
+ * Copyright (C) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+class BufferSource {
+public:
+    const uint8_t* data;
+    size_t length;
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;BufferSource.h&quot;
</ins><span class="cx"> #include &quot;IDLTypes.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -638,4 +639,25 @@
</span><span class="cx">     return { length, WTFMove(result) };
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// MARK: -
+// MARK: BufferSource type
+
+template&lt;&gt; struct Converter&lt;IDLBufferSource&gt; : DefaultConverter&lt;IDLBufferSource&gt; {
+    using ReturnType = BufferSource;
+
+    static ReturnType convert(JSC::ExecState&amp; state, JSC::JSValue value)
+    {
+        JSC::VM&amp; vm = state.vm();
+        auto scope = DECLARE_THROW_SCOPE(vm);
+
+        if (JSC::ArrayBuffer* buffer = JSC::toArrayBuffer(value))
+            return { static_cast&lt;uint8_t*&gt;(buffer-&gt;data()), buffer-&gt;byteLength() };
+        if (RefPtr&lt;JSC::ArrayBufferView&gt; bufferView = toArrayBufferView(value))
+            return { static_cast&lt;uint8_t*&gt;(bufferView-&gt;baseAddress()), bufferView-&gt;byteLength() };
+
+        throwTypeError(&amp;state, scope, ASCIILiteral(&quot;Only ArrayBuffer and ArrayBufferView objects can be passed as BufferSource arguments&quot;));
+        return { nullptr, 0 };
+    }
+};
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -371,6 +371,7 @@
</span><span class="cx">     return 1 if $object-&gt;IsPrimitiveType($type);
</span><span class="cx">     return 1 if $object-&gt;IsTypedArrayType($type);
</span><span class="cx">     return 1 if $type eq &quot;Array&quot;;
</span><ins>+    return 1 if $type eq &quot;BufferSource&quot;;
</ins><span class="cx">     return 1 if $type eq &quot;DOMString&quot; or $type eq &quot;USVString&quot;;
</span><span class="cx">     return 1 if $type eq &quot;DOMTimeStamp&quot;;
</span><span class="cx">     return 1 if $type eq &quot;SVGNumber&quot;;
</span><span class="lines">@@ -866,6 +867,7 @@
</span><span class="cx"> 
</span><span class="cx">     return 0 if !$object-&gt;IsRefPtrType($type);
</span><span class="cx">     return 0 if $object-&gt;IsTypedArrayType($type);
</span><ins>+    return 0 if $type eq &quot;BufferSource&quot;;
</ins><span class="cx">     return 0 if $type eq &quot;UNION&quot;;
</span><span class="cx">     return 0 if $webCoreTypeHash{$type};
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -319,7 +319,9 @@
</span><span class="cx"> 
</span><span class="cx">     # SVGAnimatedLength/Number/etc. are not classes so they can't be forward declared as classes.
</span><span class="cx">     return if $codeGenerator-&gt;IsSVGAnimatedType($interfaceName);
</span><ins>+
</ins><span class="cx">     return if $codeGenerator-&gt;IsTypedArrayType($interfaceName);
</span><ins>+    return if $interfaceName eq &quot;BufferSource&quot;;
</ins><span class="cx"> 
</span><span class="cx">     push(@headerContent, &quot;class $interfaceName;\n\n&quot;);
</span><span class="cx"> }
</span><span class="lines">@@ -4993,6 +4995,7 @@
</span><span class="cx">     return &quot;IDLSequence&lt;&quot; . GetIDLType($interface, @{$idlType-&gt;subtypes}[0]) . &quot;&gt;&quot; if $codeGenerator-&gt;IsSequenceType($idlType-&gt;name);
</span><span class="cx">     return &quot;IDLFrozenArray&lt;&quot; . GetIDLType($interface, @{$idlType-&gt;subtypes}[0]) . &quot;&gt;&quot; if $codeGenerator-&gt;IsFrozenArrayType($idlType-&gt;name);
</span><span class="cx">     return &quot;IDLUnion&lt;&quot; . join(&quot;, &quot;, GetIDLUnionMemberTypes($interface, $idlType)) . &quot;&gt;&quot; if $idlType-&gt;isUnion;
</span><ins>+    return &quot;IDLBufferSource&quot; if $idlType-&gt;name eq &quot;BufferSource&quot;;
</ins><span class="cx">     return &quot;IDLInterface&lt;&quot; . $idlType-&gt;name . &quot;&gt;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5114,6 +5117,7 @@
</span><span class="cx">     my $idlType = shift;
</span><span class="cx"> 
</span><span class="cx">     return 1 if $idlType-&gt;isUnion;
</span><ins>+    return 1 if $idlType-&gt;name eq &quot;BufferSource&quot;;
</ins><span class="cx">     return 1 if $idlType-&gt;name eq &quot;any&quot;;
</span><span class="cx">     return 1 if $idlType-&gt;name eq &quot;boolean&quot;;
</span><span class="cx">     return 1 if $codeGenerator-&gt;IsIntegerType($idlType-&gt;name);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -503,6 +503,11 @@
</span><span class="cx">         result.booleanWithoutDefault = convert&lt;IDLBoolean&gt;(state, booleanWithoutDefaultValue);
</span><span class="cx">         RETURN_IF_EXCEPTION(throwScope, Nullopt);
</span><span class="cx">     }
</span><ins>+    JSValue bufferSourceValueValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;bufferSourceValue&quot;));
+    if (!bufferSourceValueValue.isUndefined()) {
+        result.bufferSourceValue = convert&lt;IDLBufferSource&gt;(state, bufferSourceValueValue);
+        RETURN_IF_EXCEPTION(throwScope, Nullopt);
+    }
</ins><span class="cx">     JSValue dictionaryMemberValue = isNullOrUndefined ? jsUndefined() : object-&gt;get(&amp;state, Identifier::fromString(&amp;state, &quot;dictionaryMember&quot;));
</span><span class="cx">     if (!dictionaryMemberValue.isUndefined()) {
</span><span class="cx">         auto dictionaryMemberOptional = convert&lt;IDLDictionary&lt;TestObj::DictionaryThatShouldTolerateNull&gt;&gt;(state, dictionaryMemberValue);
</span><span class="lines">@@ -993,6 +998,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSingleConditionalOverload(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAttachShadowRoot(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameter(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionBufferSourceParameter(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionToString(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionToJSON(JSC::ExecState*);
</span><span class="cx"> 
</span><span class="lines">@@ -1604,6 +1610,7 @@
</span><span class="cx">     { &quot;singleConditionalOverload&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionSingleConditionalOverload), (intptr_t) (1) } },
</span><span class="cx">     { &quot;attachShadowRoot&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionAttachShadowRoot), (intptr_t) (1) } },
</span><span class="cx">     { &quot;operationWithExternalDictionaryParameter&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameter), (intptr_t) (1) } },
</span><ins>+    { &quot;bufferSourceParameter&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionBufferSourceParameter), (intptr_t) (1) } },
</ins><span class="cx">     { &quot;toString&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionToString), (intptr_t) (0) } },
</span><span class="cx">     { &quot;toJSON&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionToJSON), (intptr_t) (0) } },
</span><span class="cx"> #if ENABLE(Condition1)
</span><span class="lines">@@ -7729,6 +7736,26 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionBufferSourceParameterCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&amp;);
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionBufferSourceParameter(ExecState* state)
+{
+    return BindingCaller&lt;JSTestObj&gt;::callOperation&lt;jsTestObjPrototypeFunctionBufferSourceParameterCaller&gt;(state, &quot;bufferSourceParameter&quot;);
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionBufferSourceParameterCaller(JSC::ExecState* state, JSTestObj* castedThis, JSC::ThrowScope&amp; throwScope)
+{
+    UNUSED_PARAM(state);
+    UNUSED_PARAM(throwScope);
+    auto&amp; impl = castedThis-&gt;wrapped();
+    if (UNLIKELY(state-&gt;argumentCount() &lt; 1))
+        return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
+    auto data = convert&lt;IDLBufferSource&gt;(*state, state-&gt;uncheckedArgument(0));
+    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+    impl.bufferSourceParameter(WTFMove(data));
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionToStringCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&amp;);
</span><span class="cx"> 
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionToString(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (207461 => 207462)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-18 12:51:33 UTC (rev 207461)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-10-18 13:15:40 UTC (rev 207462)
</span><span class="lines">@@ -415,6 +415,8 @@
</span><span class="cx">     stringifier attribute USVString stringifierAttribute;
</span><span class="cx"> 
</span><span class="cx">     serializer = {create, readOnlyStringAttr, enumAttr, longAttr};
</span><ins>+
+    void bufferSourceParameter(BufferSource data);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // The following comment should not generate any code.
</span><span class="lines">@@ -460,6 +462,7 @@
</span><span class="cx">     TestDictionaryThatShouldTolerateNull dictionaryMember;
</span><span class="cx">     (long or Node) unionMember;
</span><span class="cx">     (long or Node)? nullableUnionMember = null;
</span><ins>+    BufferSource bufferSourceValue;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> dictionary TestDictionaryThatShouldNotTolerateNull {
</span></span></pre>
</div>
</div>

</body>
</html>