[Streams API] Create CountQueuingStrategy object as per spec
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 16:35:43 +0000 (16:35 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Aug 2015 16:35:43 +0000 (16:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146594

Reviewed by Geoffrey Garen.

Source/WebCore:

CountQueuingStrategy is a class part of the Streams API that can be found at
https://streams.spec.whatwg.org/#cqs-class. We had it as js at the tests but the spec says we have to provide it
natively. The class is implemented in this patch by creating its corresponding IDL with the size method using
the [CustomBinding] attribute, that does not create any bindings against the object allowing us full control to
do what the spec requires (just returning 1 without any cast check). The constructor sets the highWaterMark
property taking it from the argument.

Covered by current tests
(LayoutTests/streams/reference-implementation/count-queuing-strategy.html and
LayoutTests/streams/reference-implementation/brand-checks.html).

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* PlatformMac.cmake:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp: Build infrastructure.
* Modules/streams/CountQueuingStrategy.h: Added.
(WebCore::CountQueuingStrategy::~CountQueuingStrategy): Created empty.
(WebCore::CountQueuingStrategy::size): Returns 1.
* Modules/streams/CountQueuingStrategy.idl: Added.
* bindings/js/JSCountQueuingStrategyCustom.cpp: Added.
(WebCore::jsCountQueuingStrategyPrototypeFunctionSize): Calls WebCore::CountQueuingStrategy::size.
(WebCore::constructJSCountQueuingStrategy): Constructs the strategy, copies the highWaterMark from the argument
and returns it.
* bindings/js/JSDOMBinding.h:
(WebCore::getPropertyFromObject): Moved from ReadableJSStream.cpp.
(WebCore::setPropertyToObject): Added to create a property into an object.
* bindings/js/ReadableJSStream.cpp:
(WebCore::getPropertyFromObject): Deleted.

LayoutTests:

* js/dom/global-constructors-attributes-expected.txt:
* platform/efl/js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/ios-sim-deprecated/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt: Updated expectations with
CountQueuingStrategy constructor.
* streams/reference-implementation/brand-checks.html:
* streams/reference-implementation/count-queuing-strategy.html: Removed reference to count-queuing-strategy.js.
* streams/reference-implementation/resources/count-queuing-strategy.js: Removed.
(CountQueuingStrategy): Deleted.
(CountQueuingStrategy.prototype.size): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188127 268f45cc-cd09-0410-ab3c-d52691b4dbfc

26 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/ios-sim-deprecated/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt
LayoutTests/streams/reference-implementation/brand-checks.html
LayoutTests/streams/reference-implementation/count-queuing-strategy.html
LayoutTests/streams/reference-implementation/resources/count-queuing-strategy.js [deleted file]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/streams/CountQueuingStrategy.h [new file with mode: 0644]
Source/WebCore/Modules/streams/CountQueuingStrategy.idl [new file with mode: 0644]
Source/WebCore/PlatformMac.cmake
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSCountQueuingStrategyCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/ReadableJSStream.cpp

index 7922919..14655dc 100644 (file)
@@ -1,3 +1,25 @@
+2015-08-07  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
+        [Streams API] Create CountQueuingStrategy object as per spec
+        https://bugs.webkit.org/show_bug.cgi?id=146594
+
+        Reviewed by Geoffrey Garen.
+
+        * js/dom/global-constructors-attributes-expected.txt:
+        * platform/efl/js/dom/global-constructors-attributes-expected.txt:
+        * platform/gtk/js/dom/global-constructors-attributes-expected.txt:
+        * platform/ios-sim-deprecated/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
+        * platform/mac/js/dom/global-constructors-attributes-expected.txt:
+        * platform/win/js/dom/global-constructors-attributes-expected.txt: Updated expectations with
+        CountQueuingStrategy constructor.
+        * streams/reference-implementation/brand-checks.html:
+        * streams/reference-implementation/count-queuing-strategy.html: Removed reference to count-queuing-strategy.js.
+        * streams/reference-implementation/resources/count-queuing-strategy.js: Removed.
+        (CountQueuingStrategy): Deleted.
+        (CountQueuingStrategy.prototype.size): Deleted.
+
 2015-08-07  Doug Russell  <d_russell@apple.com>
 
         AX: Bug 147737 is causing test failures in Mavericks WK1
index 487ffcd..daf147f 100644 (file)
@@ -223,6 +223,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index fb9f764..17f9dfe 100644 (file)
@@ -228,6 +228,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index b0d810f..2c990f0 100644 (file)
@@ -228,6 +228,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index d8a2ee2..5ae20c5 100644 (file)
@@ -208,6 +208,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index 38b82de..f528158 100644 (file)
@@ -223,6 +223,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index 9353530..b8b3b4a 100644 (file)
@@ -223,6 +223,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index fb48f77..b2f4bd3 100644 (file)
@@ -223,6 +223,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('ge
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'ConvolverNode').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index 1895671..a217c6b 100644 (file)
@@ -163,6 +163,11 @@ PASS Object.getOwnPropertyDescriptor(global, 'CompositionEvent').hasOwnProperty(
 PASS Object.getOwnPropertyDescriptor(global, 'CompositionEvent').hasOwnProperty('set') is false
 PASS Object.getOwnPropertyDescriptor(global, 'CompositionEvent').enumerable is false
 PASS Object.getOwnPropertyDescriptor(global, 'CompositionEvent').configurable is true
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').value is CountQueuingStrategy
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('get') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').hasOwnProperty('set') is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').enumerable is false
+PASS Object.getOwnPropertyDescriptor(global, 'CountQueuingStrategy').configurable is true
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').value is Counter
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('get') is false
 PASS Object.getOwnPropertyDescriptor(global, 'Counter').hasOwnProperty('set') is false
index 197b8a6..1a57af7 100644 (file)
@@ -2,7 +2,6 @@
 <script src='../../resources/testharness.js'></script>
 <script src='../../resources/testharnessreport.js'></script>
 <script src='resources/streams-utils.js'></script>
-<script src='resources/count-queuing-strategy.js'></script>
 <script src='resources/byte-length-queuing-strategy.js'></script>
 <script>
 var ReadableStreamReader;
index f027376..12d5d10 100644 (file)
@@ -2,7 +2,6 @@
 <script src='../../resources/testharness.js'></script>
 <script src='../../resources/testharnessreport.js'></script>
 <script src='resources/streams-utils.js'></script>
-<script src='resources/count-queuing-strategy.js'></script>
 <script>
 test(function() {
     new CountQueuingStrategy({ highWaterMark: 4 });
diff --git a/LayoutTests/streams/reference-implementation/resources/count-queuing-strategy.js b/LayoutTests/streams/reference-implementation/resources/count-queuing-strategy.js
deleted file mode 100644 (file)
index 5fc21f2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// FIXME: Remove this file when implemented in WebCore.
-
-function CountQueuingStrategy({ highWaterMark }) {
-    createDataProperty(this, 'highWaterMark', highWaterMark);
-}
-
-CountQueuingStrategy.prototype = {
-    size: function(chunk) {
-        return 1;
-    }
-}
index 5773087..edc46e8 100644 (file)
@@ -289,6 +289,7 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/speech/SpeechSynthesisUtterance.idl
     Modules/speech/SpeechSynthesisVoice.idl
 
+    Modules/streams/CountQueuingStrategy.idl
     Modules/streams/ReadableStream.idl
     Modules/streams/ReadableStreamController.idl
     Modules/streams/ReadableStreamReader.idl
@@ -1088,6 +1089,7 @@ set(WebCore_SOURCES
     bindings/js/JSCanvasRenderingContextCustom.cpp
     bindings/js/JSCharacterDataCustom.cpp
     bindings/js/JSCommandLineAPIHostCustom.cpp
+    bindings/js/JSCountQueuingStrategyCustom.cpp
     bindings/js/JSCryptoAlgorithmBuilder.cpp
     bindings/js/JSCryptoAlgorithmDictionary.cpp
     bindings/js/JSCryptoCustom.cpp
index 86bb376..1800259 100644 (file)
@@ -1,3 +1,43 @@
+2015-08-07  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
+        [Streams API] Create CountQueuingStrategy object as per spec
+        https://bugs.webkit.org/show_bug.cgi?id=146594
+
+        Reviewed by Geoffrey Garen.
+
+        CountQueuingStrategy is a class part of the Streams API that can be found at
+        https://streams.spec.whatwg.org/#cqs-class. We had it as js at the tests but the spec says we have to provide it
+        natively. The class is implemented in this patch by creating its corresponding IDL with the size method using
+        the [CustomBinding] attribute, that does not create any bindings against the object allowing us full control to
+        do what the spec requires (just returning 1 without any cast check). The constructor sets the highWaterMark
+        property taking it from the argument.
+
+        Covered by current tests
+        (LayoutTests/streams/reference-implementation/count-queuing-strategy.html and
+        LayoutTests/streams/reference-implementation/brand-checks.html).
+
+        * CMakeLists.txt:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * PlatformMac.cmake:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp: Build infrastructure.
+        * Modules/streams/CountQueuingStrategy.h: Added.
+        (WebCore::CountQueuingStrategy::~CountQueuingStrategy): Created empty.
+        (WebCore::CountQueuingStrategy::size): Returns 1.
+        * Modules/streams/CountQueuingStrategy.idl: Added.
+        * bindings/js/JSCountQueuingStrategyCustom.cpp: Added.
+        (WebCore::jsCountQueuingStrategyPrototypeFunctionSize): Calls WebCore::CountQueuingStrategy::size.
+        (WebCore::constructJSCountQueuingStrategy): Constructs the strategy, copies the highWaterMark from the argument
+        and returns it.
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::getPropertyFromObject): Moved from ReadableJSStream.cpp.
+        (WebCore::setPropertyToObject): Added to create a property into an object.
+        * bindings/js/ReadableJSStream.cpp:
+        (WebCore::getPropertyFromObject): Deleted.
+
 2015-08-07  Brady Eidson  <beidson@apple.com>
 
         Move concrete KeyedDecoder/Encoder implementations to WebCore.
index 4bf1194..1e89b91 100644 (file)
@@ -41,6 +41,9 @@
 #include "JSCanvasPattern.cpp"
 #include "JSCanvasRenderingContext.cpp"
 #include "JSCanvasRenderingContext2D.cpp"
+#if ENABLE(STREAMS_API)
+#include "JSCountQueuingStrategy.cpp"
+#endif
 #if ENABLE(WEBGL)
 #include "JSEXTBlendMinMax.cpp"
 #include "JSEXTFragDepth.cpp"
index 00e7880..a3b9e9e 100644 (file)
@@ -174,6 +174,7 @@ NON_SVG_BINDING_IDLS = \
     $(WebCore)/Modules/speech/SpeechSynthesisEvent.idl \
     $(WebCore)/Modules/speech/SpeechSynthesisUtterance.idl \
     $(WebCore)/Modules/speech/SpeechSynthesisVoice.idl \
+    $(WebCore)/Modules/streams/CountQueuingStrategy.idl \
     $(WebCore)/Modules/streams/ReadableStream.idl \
     $(WebCore)/Modules/streams/ReadableStreamController.idl \
     $(WebCore)/Modules/streams/ReadableStreamReader.idl \
diff --git a/Source/WebCore/Modules/streams/CountQueuingStrategy.h b/Source/WebCore/Modules/streams/CountQueuingStrategy.h
new file mode 100644 (file)
index 0000000..67be1c8
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2015 Canon Inc.
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be 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.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON 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 CANON INC. AND 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.
+ */
+
+#ifndef CountQueuingStrategy_h
+#define CountQueuingStrategy_h
+
+#if ENABLE(STREAMS_API)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+// CountQueuingStrategy implements a strategy for streams that counts chunks one by one according to the spec. See
+// https://streams.spec.whatwg.org/#cqs-class
+class CountQueuingStrategy : public RefCounted<CountQueuingStrategy> {
+public:
+    virtual ~CountQueuingStrategy() { }
+
+    inline static int size() { return 1; }
+};
+
+}
+
+#endif
+
+#endif // CountQueuingStrategy_h
diff --git a/Source/WebCore/Modules/streams/CountQueuingStrategy.idl b/Source/WebCore/Modules/streams/CountQueuingStrategy.idl
new file mode 100644 (file)
index 0000000..234dda9
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 Canon Inc.
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be 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.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON 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 CANON INC. AND 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.
+ */
+
+[
+    CustomConstructor(any properties),
+    Conditional=STREAMS_API,
+] interface CountQueuingStrategy {
+    [CustomBinding] double size();
+};
index 861e7e9..d28e5d7 100644 (file)
@@ -537,6 +537,7 @@ list(REMOVE_ITEM WebCore_SOURCES
     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMCommandLineAPIHost.mm
     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMConvolverNode.mm
     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMCoordinates.mm
+    ${DERIVED_SOURCES_WEBCORE_DIR}/DOMCountQueuingStrategy.mm
     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMCrypto.mm
     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMCryptoKey.mm
     ${DERIVED_SOURCES_WEBCORE_DIR}/DOMCustomEvent.mm
index d44984c..9f11996 100644 (file)
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCountQueuingStrategy.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCrypto.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\bindings\js\JSCountQueuingStrategyCustom.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\bindings\js\DOMWrapperWorld.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCompositionEvent.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCoordinates.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCounter.h" />
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCountQueuingStrategy.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCrypto.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCSSCharsetRule.h" />
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCSSFontFaceLoadEvent.h" />
     <ClInclude Include="..\Modules\notifications\NotificationClient.h" />
     <ClInclude Include="..\Modules\notifications\WorkerGlobalScopeNotifications.h" />
     <ClInclude Include="..\Modules\plugins\PluginReplacement.h" />
+    <ClInclude Include="..\Modules\streams\CountQueuingStrategy.h" />
     <ClInclude Include="..\Modules\streams\ReadableStream.h" />
     <ClInclude Include="..\Modules\streams\ReadableStreamController.h" />
     <ClInclude Include="..\Modules\streams\ReadableStreamReader.h" />
index 4acdde1..7021468 100644 (file)
     <ClCompile Include="..\bindings\js\JSCommandLineAPIHostCustom.cpp">
       <Filter>bindings\js</Filter>
     </ClCompile>
+    <ClCompile Include="..\bindings\js\JSCountQueuingStrategyCustom.cpp">
+      <Filter>bindings\js</Filter>
+    </ClCompile>
     <ClCompile Include="..\bindings\js\JSCSSRuleCustom.cpp">
       <Filter>bindings\js</Filter>
     </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCounter.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
+    <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCountQueuingStrategy.cpp">
+      <Filter>DerivedSources</Filter>
+    </ClCompile>
     <ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCrypto.cpp">
       <Filter>DerivedSources</Filter>
     </ClCompile>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCounter.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
+    <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCountQueuingStrategy.h">
+      <Filter>DerivedSources</Filter>
+    </ClInclude>
     <ClInclude Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\$(ProjectName)\DerivedSources\JSCrypto.h">
       <Filter>DerivedSources</Filter>
     </ClInclude>
     <ClInclude Include="..\platform\graphics\FontCascadeFonts.h">
       <Filter>platform\graphics</Filter>
     </ClInclude>
+    <ClInclude Include="..\Modules\streams\CountQueuingStrategy.h">
+      <Filter>Modules\streams</Filter>
+    </ClInclude>
     <ClInclude Include="..\Modules\streams\ReadableStream.h">
       <Filter>Modules\streams</Filter>
     </ClInclude>
index 807e763..46a22b0 100644 (file)
                1479FAF4109AE37500DED655 /* RenderRubyText.h in Headers */ = {isa = PBXBuildFile; fileRef = 1479FAEC109AE37500DED655 /* RenderRubyText.h */; };
                148AFDA50AF58360008CC700 /* ExceptionHandlers.h in Headers */ = {isa = PBXBuildFile; fileRef = 148AFDA30AF58360008CC700 /* ExceptionHandlers.h */; settings = {ATTRIBUTES = (Private, ); }; };
                148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */ = {isa = PBXBuildFile; fileRef = 148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */; };
+               148B4FF81B69042100C954E4 /* JSCountQueuingStrategyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 148B4FF71B69042100C954E4 /* JSCountQueuingStrategyCustom.cpp */; };
+               148B4FFE1B6904AA00C954E4 /* CountQueuingStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 148B4FFD1B6904AA00C954E4 /* CountQueuingStrategy.h */; };
                14947FFD12F80CD200A0F631 /* DocumentOrderedMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14947FFB12F80CD200A0F631 /* DocumentOrderedMap.cpp */; };
                14947FFE12F80CD200A0F631 /* DocumentOrderedMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 14947FFC12F80CD200A0F631 /* DocumentOrderedMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14993BE50B2F2B1C0050497F /* FocusController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14993BE30B2F2B1C0050497F /* FocusController.cpp */; };
                14D824080AF93AEB0004F057 /* ChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D824060AF93AEB0004F057 /* ChromeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14DC0D3709FED073007B0235 /* JSNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DC0D3509FED073007B0235 /* JSNode.cpp */; };
                14DC0D3809FED073007B0235 /* JSNode.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 14DC0D3609FED073007B0235 /* JSNode.h */; settings = {ATTRIBUTES = (); }; };
+               14DCF3B21B6BE2080062D4C2 /* JSCountQueuingStrategy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DCF3B01B6BE2080062D4C2 /* JSCountQueuingStrategy.cpp */; };
+               14DCF3B31B6BE2080062D4C2 /* JSCountQueuingStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DCF3B11B6BE2080062D4C2 /* JSCountQueuingStrategy.h */; };
                14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14E8378309F85D1C00B85AE4 /* JSEvent.cpp */; };
                14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 14E8378D09F85D4F00B85AE4 /* JSEvent.h */; };
                14FFE31D0AE1963300136BF5 /* HTMLFrameElementBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 14FFE31B0AE1963300136BF5 /* HTMLFrameElementBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                14813BF309EDF88E00F757E1 /* IDLParser.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = IDLParser.pm; path = scripts/IDLParser.pm; sourceTree = "<group>"; };
                148AFDA30AF58360008CC700 /* ExceptionHandlers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ExceptionHandlers.h; sourceTree = "<group>"; };
                148AFDA40AF58360008CC700 /* ExceptionHandlers.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ExceptionHandlers.mm; sourceTree = "<group>"; };
+               148B4FF71B69042100C954E4 /* JSCountQueuingStrategyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCountQueuingStrategyCustom.cpp; path = bindings/js/JSCountQueuingStrategyCustom.cpp; sourceTree = "<group>"; };
+               148B4FFD1B6904AA00C954E4 /* CountQueuingStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CountQueuingStrategy.h; path = Modules/streams/CountQueuingStrategy.h; sourceTree = "<group>"; };
+               148B4FFF1B6904C500C954E4 /* CountQueuingStrategy.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CountQueuingStrategy.idl; path = Modules/streams/CountQueuingStrategy.idl; sourceTree = "<group>"; };
                14947FFB12F80CD200A0F631 /* DocumentOrderedMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentOrderedMap.cpp; sourceTree = "<group>"; };
                14947FFC12F80CD200A0F631 /* DocumentOrderedMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentOrderedMap.h; sourceTree = "<group>"; };
                14993BE30B2F2B1C0050497F /* FocusController.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FocusController.cpp; sourceTree = "<group>"; };
                14DC0D0B09FECFA4007B0235 /* Node.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Node.idl; sourceTree = "<group>"; };
                14DC0D3509FED073007B0235 /* JSNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNode.cpp; sourceTree = "<group>"; };
                14DC0D3609FED073007B0235 /* JSNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNode.h; sourceTree = "<group>"; };
+               14DCF3B01B6BE2080062D4C2 /* JSCountQueuingStrategy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCountQueuingStrategy.cpp; path = JSCountQueuingStrategy.cpp; sourceTree = "<group>"; };
+               14DCF3B11B6BE2080062D4C2 /* JSCountQueuingStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSCountQueuingStrategy.h; path = JSCountQueuingStrategy.h; sourceTree = "<group>"; };
                14E836D209F8512000B85AE4 /* Event.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Event.idl; sourceTree = "<group>"; };
                14E8378309F85D1C00B85AE4 /* JSEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSEvent.cpp; sourceTree = "<group>"; };
                14E8378D09F85D4F00B85AE4 /* JSEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEvent.h; sourceTree = "<group>"; };
                0867D691FE84028FC02AAC07 /* WebKit */ = {
                        isa = PBXGroup;
                        children = (
+                               148B4FFF1B6904C500C954E4 /* CountQueuingStrategy.idl */,
+                               148B4FFD1B6904AA00C954E4 /* CountQueuingStrategy.h */,
+                               148B4FF71B69042100C954E4 /* JSCountQueuingStrategyCustom.cpp */,
                                65C97AF208EA908800ACD273 /* config.h */,
                                EDEC98020AED7E170059137F /* WebCorePrefix.h */,
                                9307061309E0CA8200B17FE4 /* DerivedSources.make */,
                656580EC09D12B20000E61D7 /* Derived Sources */ = {
                        isa = PBXGroup;
                        children = (
+                               14DCF3B01B6BE2080062D4C2 /* JSCountQueuingStrategy.cpp */,
+                               14DCF3B11B6BE2080062D4C2 /* JSCountQueuingStrategy.h */,
                                656581AC09D14EE6000E61D7 /* CharsetData.cpp */,
                                E406F3FB1198307D009D59D6 /* ColorData.cpp */,
                                6565814409D13043000E61D7 /* CSSGrammar.cpp */,
                                977B3876122883E900B81FF8 /* HTMLScriptRunnerHost.h in Headers */,
                                A81369D8097374F600D74463 /* HTMLSelectElement.h in Headers */,
                                E44613A80CD6331000FADA75 /* HTMLSourceElement.h in Headers */,
+                               148B4FFE1B6904AA00C954E4 /* CountQueuingStrategy.h in Headers */,
                                977E2DCE12F0E28300C13379 /* HTMLSourceTracker.h in Headers */,
                                978AD67514130A8D00C7CAE3 /* HTMLSpanElement.h in Headers */,
                                536D5A20193E18E900CE4CAB /* HTMLSrcsetParser.h in Headers */,
                                A79BADA2161E7F3F00C2E652 /* RuleFeature.h in Headers */,
                                A79BADA4161E7F3F00C2E652 /* RuleSet.h in Headers */,
                                2D76BB821945632400CFD29A /* RunLoopObserver.h in Headers */,
+                               14DCF3B31B6BE2080062D4C2 /* JSCountQueuingStrategy.h in Headers */,
                                1A569D1F0D7E2B82007C3983 /* runtime_array.h in Headers */,
                                1A569D210D7E2B82007C3983 /* runtime_method.h in Headers */,
                                1A569D230D7E2B82007C3983 /* runtime_object.h in Headers */,
                                A11E8C061B1E28FA0003A7C7 /* moveCursor.png in Resources */,
                                A11E8C071B1E28FE0003A7C7 /* northEastSouthWestResizeCursor.png in Resources */,
                                A11E8C081B1E29020003A7C7 /* northSouthResizeCursor.png in Resources */,
+                               148B50001B6904C500C954E4 /* CountQueuingStrategy.idl in Resources */,
                                A11E8C091B1E29070003A7C7 /* northWestSouthEastResizeCursor.png in Resources */,
                                BE8C753110681324001E93F5 /* SpellingDot.png in Resources */,
                                01E6C2E41194B2820050821C /* SpellingDot@2x.png in Resources */,
                                5C9A7A751AA0F6EA00958ACF /* DFABytecodeCompiler.cpp in Sources */,
                                5C9A7A761AA0F6ED00958ACF /* DFABytecodeInterpreter.cpp in Sources */,
                                26A517FD1AB92238006335DF /* DFAMinimizer.cpp in Sources */,
+                               14DCF3B21B6BE2080062D4C2 /* JSCountQueuingStrategy.cpp in Sources */,
                                CD37B39815C1B971006DC898 /* DiagnosticLoggingKeys.cpp in Sources */,
                                CECADFC6153778FF00E37068 /* DictationAlternative.cpp in Sources */,
                                CECADFC8153778FF00E37068 /* DictationCommand.cpp in Sources */,
                                536D5A21193E18EE00CE4CAB /* HTMLSrcsetParser.cpp in Sources */,
                                A871DC260A15205700B12A68 /* HTMLStyleElement.cpp in Sources */,
                                310D71951B335C9D009C7B73 /* ThemeCocoa.cpp in Sources */,
+                               148B4FF81B69042100C954E4 /* JSCountQueuingStrategyCustom.cpp in Sources */,
                                D3D4E972130C7CFE007BA540 /* HTMLSummaryElement.cpp in Sources */,
                                A871DB320A150BD600B12A68 /* HTMLTableCaptionElement.cpp in Sources */,
                                A871DB2E0A150BD600B12A68 /* HTMLTableCellElement.cpp in Sources */,
index 476b6b0..f30d65d 100644 (file)
@@ -35,6 +35,9 @@
 #include "JSAudioTrackListCustom.cpp"
 #include "JSBlobCustom.cpp"
 #include "JSCDATASectionCustom.cpp"
+#if ENABLE(STREAMS_API)
+#include "JSCountQueuingStrategyCustom.cpp"
+#endif
 #include "JSCSSRuleCustom.cpp"
 #include "JSCSSRuleListCustom.cpp"
 #include "JSCSSStyleDeclarationCustom.cpp"
diff --git a/Source/WebCore/bindings/js/JSCountQueuingStrategyCustom.cpp b/Source/WebCore/bindings/js/JSCountQueuingStrategyCustom.cpp
new file mode 100644 (file)
index 0000000..46731a9
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 Canon Inc.
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be 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.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON 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 CANON INC. AND 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.
+ */
+
+#include "config.h"
+
+#if ENABLE(STREAMS_API)
+#include "JSCountQueuingStrategy.h"
+
+#include "JSDOMBinding.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+EncodedJSValue JSC_HOST_CALL jsCountQueuingStrategyPrototypeFunctionSize(ExecState*)
+{
+    return JSValue::encode(jsNumber(CountQueuingStrategy::size()));
+}
+
+EncodedJSValue JSC_HOST_CALL constructJSCountQueuingStrategy(ExecState* exec)
+{
+    JSValue value = exec->argument(0);
+    if (value.isNull() || value.isUndefined())
+        return throwVMError(exec, createTypeError(exec, ASCIILiteral("constructor argument cannot be null or undefined")));
+
+    Ref<CountQueuingStrategy> countQueuingStrategy = adoptRef(*new CountQueuingStrategy());
+    JSValue jsCountQueuingStrategy = CREATE_DOM_WRAPPER(jsCast<DOMConstructorObject*>(exec->callee())->globalObject(), CountQueuingStrategy, countQueuingStrategy.ptr());
+
+    if (!value.isObject())
+        return JSValue::encode(jsCountQueuingStrategy);
+
+    JSObject* argumentObject = value.getObject();
+    JSValue jsHighWaterMark = getPropertyFromObject(*exec, *argumentObject, "highWaterMark");
+    if (exec->hadException())
+        return JSValue::encode(jsUndefined());
+    setPropertyToObject(*exec, *jsCountQueuingStrategy.getObject(), "highWaterMark", jsHighWaterMark);
+
+    return JSValue::encode(jsCountQueuingStrategy);
+}
+
+} // namespace WebCore
+
+#endif
index 7575194..3215f78 100644 (file)
@@ -632,6 +632,17 @@ public:
     static bool shouldAllowAccessToDOMWindow(JSC::ExecState*, DOMWindow&, SecurityReportingOption = ReportSecurityError);
     static bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*, SecurityReportingOption = ReportSecurityError);
 };
+
+inline JSC::JSValue getPropertyFromObject(JSC::ExecState& exec, JSC::JSObject& object, const char* identifier)
+{
+    return object.get(&exec, JSC::Identifier::fromString(&exec, identifier));
+}
+
+inline void setPropertyToObject(JSC::ExecState& exec, JSC::JSObject& object, const char* name, JSC::JSValue value)
+{
+    JSC::PutPropertySlot propertySlot(&object);
+    JSC::JSObject::put(&object, &exec, JSC::Identifier::fromString(&exec, name), value, propertySlot);
+}
     
 } // namespace WebCore
 
index 79b666c..406658a 100644 (file)
@@ -51,11 +51,6 @@ using namespace JSC;
 
 namespace WebCore {
 
-static inline JSValue getPropertyFromObject(ExecState& exec, JSObject& object, const char* identifier)
-{
-    return object.get(&exec, Identifier::fromString(&exec, identifier));
-}
-
 static inline JSValue callFunction(ExecState& exec, JSValue jsFunction, JSValue thisValue, const ArgList& arguments)
 {
     CallData callData;