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

Unified Diff: Source/core/streams/ScriptUnderlyingSource.h

Issue 1118673002: Implement ReadableStream as a V8 extra (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanups; make controller a member instead of arg Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « Source/core/streams/ScriptReadableStreamController.cpp ('k') | Source/core/streams/ScriptUnderlyingSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698