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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.h

Issue 1492763002: Add a utility class to call stream methods implemented with v8 extras. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-extra-switch
Patch Set: Created 5 years 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 | « no previous file | third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.h b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.h
new file mode 100644
index 0000000000000000000000000000000000000000..b456fb9eeea0b460dccc51535727290e2cbf9935
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.h
@@ -0,0 +1,51 @@
+// 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 ReadableStreamOperations_h
+#define ReadableStreamOperations_h
+
+#include "bindings/core/v8/ScriptPromise.h"
+#include "bindings/core/v8/ScriptValue.h"
+#include <v8.h>
+
+namespace blink {
+
+class ExceptionState;
+class ScriptState;
+
+// This class has various methods for ReadableStream[Reader] implemented with
+// V8 Extras.
+// All methods should be called in an appropriate V8 context. All v8 handle
+// arguments must not be empty.
+class CORE_EXPORT ReadableStreamOperations {
+ STATIC_ONLY(ReadableStreamOperations);
+public:
+ // AcquireReadableStreamReader
+ // This function assumes |isReadableStream(stream)|.
+ // Returns an empty value and throws an error via the ExceptionState when
+ // errored.
+ static ScriptValue getReader(ScriptState*, v8::Local<v8::Value> stream, ExceptionState&);
+
+ // IsReadableStream
+ static bool isReadableStream(ScriptState*, v8::Local<v8::Value>);
+
+ // IsReadableStreamDisturbed
+ // This function assumes |isReadableStream(stream)|.
+ static bool isDisturbed(ScriptState*, v8::Local<v8::Value> stream);
+
+ // IsReadableStreamLocked
+ // This function assumes |isReadableStream(stream)|.
+ static bool isLocked(ScriptState*, v8::Local<v8::Value> stream);
+
+ // IsReadableStreamReader
+ static bool isReadableStreamReader(ScriptState*, v8::Local<v8::Value>);
+
+ // ReadFromReadableStreamReader
+ // This function assumes |isReadableStreamReader(reader)|.
+ static ScriptPromise read(ScriptState*, v8::Local<v8::Value> reader);
+};
+
+} // namespace blink
+
+#endif // ReadableStreamOperations_h
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698