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

Unified Diff: Source/core/streams/ScriptReadableStream.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
« no previous file with comments | « Source/core/streams/ScriptQueuingStrategy.idl ('k') | Source/core/streams/ScriptReadableStream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/streams/ScriptReadableStream.h
diff --git a/Source/core/streams/ScriptReadableStream.h b/Source/core/streams/ScriptReadableStream.h
new file mode 100644
index 0000000000000000000000000000000000000000..d10a114f4a3a2e73a6a390fa58051f30cc1b56d1
--- /dev/null
+++ b/Source/core/streams/ScriptReadableStream.h
@@ -0,0 +1,83 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ScriptReadableStream_h
+#define ScriptReadableStream_h
+
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include "core/streams/ScriptQueuingStrategy.h"
+#include "core/streams/ScriptUnderlyingSource.h"
+#include <v8.h>
+
+namespace blink {
+
+class CORE_EXPORT ScriptReadableStream {
+public:
+ // This is for UA-created ReadableStreams
+ ScriptReadableStream(ScriptState*, ScriptUnderlyingSource*, ScriptQueuingStrategy*);
+
+ // TODO: also a constructor for converting author-created ReadableStreams, e.g. for use in the bindings for
+ // functions/setters that accept ReadableStream?
+
+ // TODO: add functions to manipulate and inspect the stream from C++ beyond just the abilities of the controller.
+ // E.g. getting readers and reading.
+
+ bool isObject() const
+ {
+ return m_stream.isObject();
+ }
+
+ bool isNull() const
+ {
+ return m_stream.isNull();
+ }
+
+ bool isUndefinedOrNull() const
+ {
+ return m_stream.isUndefined() || m_stream.isNull();
+ }
+
+ ScriptValue scriptValue() const
+ {
+ return m_stream;
+ }
+
+ v8::Local<v8::Value> v8Value() const
+ {
+ return m_stream.v8Value();
+ }
+
+ v8::Isolate* isolate() const
+ {
+ return m_stream.isolate();
+ }
+
+ bool isEmpty() const
+ {
+ return m_stream.isEmpty();
+ }
+
+ void clear()
+ {
+ m_stream.clear();
+ }
+
+ bool operator==(const ScriptReadableStream& value) const
+ {
+ return m_stream == value.m_stream;
+ }
+
+ bool operator!=(const ScriptReadableStream& value) const
+ {
+ return !operator==(value);
+ }
+
+private:
+ ScriptValue m_stream;
+};
+
+} // namespace blink
+
+#endif // ScriptReadableStream_h
« no previous file with comments | « Source/core/streams/ScriptQueuingStrategy.idl ('k') | Source/core/streams/ScriptReadableStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698