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 ScriptState; | |
15 | |
16 // This class has various methods for ReadableStream[Reader] implemented with | |
17 // V8 Extras. | |
18 // All methods should be called in an appropriate V8 context. All v8 handle | |
19 // arguments must not be empty. | |
20 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.
| |
21 STATIC_ONLY(ReadableStreamOperations); | |
22 public: | |
23 // AcquireReadableStreamReader | |
24 // This function assumes |isReadableStream(stream)|. | |
25 // 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.
| |
26 // errored. | |
27 static ScriptValue getReader(ScriptState*, v8::Local<v8::Value> stream); | |
28 | |
29 // IsReadableStream | |
30 static bool isReadableStream(ScriptState*, v8::Local<v8::Value>); | |
31 | |
32 // IsReadableStreamDisturbed | |
33 // This function assumes |isReadableStream(stream)|. | |
34 static bool isDisturbed(ScriptState*, v8::Local<v8::Value> stream); | |
35 | |
36 // IsReadableStreamLocked | |
37 // This function assumes |isReadableStream(stream)|. | |
38 static bool isLocked(ScriptState*, v8::Local<v8::Value> stream); | |
39 | |
40 // IsReadableStreamReader | |
41 static bool isReadableStreamReader(ScriptState*, v8::Local<v8::Value>); | |
42 | |
43 // ReadFromReadableStreamReader | |
44 // This function assumes |isReadableStreamReader(reader)|. | |
45 static ScriptPromise read(ScriptState*, v8::Local<v8::Value> reader); | |
46 }; | |
47 | |
48 } // namespace blink | |
49 | |
50 #endif // ReadableStreamOperations_h | |
OLD | NEW |