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