Chromium Code Reviews| 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..26f0abd15fcbb17e4854cf5b17ce5d3b98844931 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/bindings/core/v8/ReadableStreamOperations.h |
| @@ -0,0 +1,50 @@ |
| +// 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 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 { |
|
domenic
2015/12/02 17:53:03
Why a class full of public methods instead of a na
yhirano
2015/12/03 11:18:29
I'm hearing opinions on blink-dev.
|
| + STATIC_ONLY(ReadableStreamOperations); |
| +public: |
| + // AcquireReadableStreamReader |
| + // This function assumes |isReadableStream(stream)|. |
| + // Returns an empty value and throws an error (in the V8 context) when |
|
domenic
2015/12/02 17:53:03
Should this be handled using an ExceptionState& in
yhirano
2015/12/03 11:18:29
Done.
|
| + // errored. |
| + static ScriptValue getReader(ScriptState*, v8::Local<v8::Value> stream); |
| + |
| + // 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 |