Index: Source/core/streams/ScriptUnderlyingSource.h |
diff --git a/Source/core/streams/ScriptUnderlyingSource.h b/Source/core/streams/ScriptUnderlyingSource.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9d12a4ca20803e53e8673e547984bba580ba779 |
--- /dev/null |
+++ b/Source/core/streams/ScriptUnderlyingSource.h |
@@ -0,0 +1,40 @@ |
+#ifndef ScriptUnderlyingSource_h |
+#define ScriptUnderlyingSource_h |
+ |
+#include "bindings/core/v8/ScriptPromise.h" |
+#include "bindings/core/v8/ScriptValue.h" |
+#include "bindings/core/v8/ScriptWrappable.h" |
+#include "core/streams/ScriptReadableStreamController.h" |
+ |
+namespace blink { |
+ |
+// TODO do we need ActiveDOMObject?? |
+ |
+class CORE_EXPORT ScriptUnderlyingSource : public GarbageCollectedFinalized<ScriptUnderlyingSource>, public ScriptWrappable { |
+ DEFINE_WRAPPERTYPEINFO(); |
+ |
+public: |
+ ScriptPromise start(ScriptValue stream); |
+ ScriptPromise pull(); |
+ ScriptPromise cancel(ScriptValue reason); |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+protected: |
+ virtual ScriptPromise startImpl() = 0; |
+ virtual ScriptPromise pullImpl() = 0; |
+ virtual ScriptPromise cancelImpl(ScriptValue reason) = 0; |
+ |
+ // TODO is a reference a good idea? |
+ ScriptReadableStreamController& controller() const { return *m_controller; } |
+ |
+private: |
+ // TODO should be using a smart pointer of some sort ... Member<>? Persistent<>? RefPtr<>? |
+ // ScriptReadableStreamController is not GarbageCollectedFinalized<>... if we made it so, how do we handle it |
+ // containing a ScriptValue? |
+ ScriptReadableStreamController* m_controller; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif ScriptUnderlyingSource_h |