OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ReadableStreamOperations_h |
| 6 #define ReadableStreamOperations_h |
| 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include <v8.h> |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class ExceptionState; |
| 15 class ScriptState; |
| 16 |
| 17 // This class has various methods for ReadableStream[Reader] implemented with |
| 18 // V8 Extras. |
| 19 // All methods should be called in an appropriate V8 context. All v8 handle |
| 20 // arguments must not be empty. |
| 21 class CORE_EXPORT ReadableStreamOperations { |
| 22 STATIC_ONLY(ReadableStreamOperations); |
| 23 public: |
| 24 // AcquireReadableStreamReader |
| 25 // This function assumes |isReadableStream(stream)|. |
| 26 // Returns an empty value and throws an error via the ExceptionState when |
| 27 // errored. |
| 28 static ScriptValue getReader(ScriptState*, v8::Local<v8::Value> stream, Exce
ptionState&); |
| 29 |
| 30 // IsReadableStream |
| 31 static bool isReadableStream(ScriptState*, v8::Local<v8::Value>); |
| 32 |
| 33 // IsReadableStreamDisturbed |
| 34 // This function assumes |isReadableStream(stream)|. |
| 35 static bool isDisturbed(ScriptState*, v8::Local<v8::Value> stream); |
| 36 |
| 37 // IsReadableStreamLocked |
| 38 // This function assumes |isReadableStream(stream)|. |
| 39 static bool isLocked(ScriptState*, v8::Local<v8::Value> stream); |
| 40 |
| 41 // IsReadableStreamReader |
| 42 static bool isReadableStreamReader(ScriptState*, v8::Local<v8::Value>); |
| 43 |
| 44 // ReadFromReadableStreamReader |
| 45 // This function assumes |isReadableStreamReader(reader)|. |
| 46 static ScriptPromise read(ScriptState*, v8::Local<v8::Value> reader); |
| 47 }; |
| 48 |
| 49 } // namespace blink |
| 50 |
| 51 #endif // ReadableStreamOperations_h |
OLD | NEW |