| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 STATIC_ONLY(ReadableStreamOperations); | 23 STATIC_ONLY(ReadableStreamOperations); |
| 24 public: | 24 public: |
| 25 // createReadableStreamWithExternalController | 25 // createReadableStreamWithExternalController |
| 26 // If the caller supplies an invalid strategy (e.g. one that returns | 26 // If the caller supplies an invalid strategy (e.g. one that returns |
| 27 // negative sizes, or doesn't have appropriate properties), this will crash. | 27 // negative sizes, or doesn't have appropriate properties), this will crash. |
| 28 static ScriptValue createReadableStream(ScriptState*, UnderlyingSourceBase*,
ScriptValue strategy); | 28 static ScriptValue createReadableStream(ScriptState*, UnderlyingSourceBase*,
ScriptValue strategy); |
| 29 | 29 |
| 30 // createBuiltInCountQueuingStrategy | 30 // createBuiltInCountQueuingStrategy |
| 31 static ScriptValue createCountQueuingStrategy(ScriptState*, size_t highWater
Mark); | 31 static ScriptValue createCountQueuingStrategy(ScriptState*, size_t highWater
Mark); |
| 32 | 32 |
| 33 // AcquireReadableStreamReader | 33 // AcquireReadableStreamDefaultReader |
| 34 // This function assumes |isReadableStream(stream)|. | 34 // This function assumes |isReadableStream(stream)|. |
| 35 // Returns an empty value and throws an error via the ExceptionState when | 35 // Returns an empty value and throws an error via the ExceptionState when |
| 36 // errored. | 36 // errored. |
| 37 static ScriptValue getReader(ScriptState*, ScriptValue stream, ExceptionStat
e&); | 37 static ScriptValue getReader(ScriptState*, ScriptValue stream, ExceptionStat
e&); |
| 38 | 38 |
| 39 // IsReadableStream | 39 // IsReadableStream |
| 40 static bool isReadableStream(ScriptState*, ScriptValue); | 40 static bool isReadableStream(ScriptState*, ScriptValue); |
| 41 | 41 |
| 42 // IsReadableStreamDisturbed | 42 // IsReadableStreamDisturbed |
| 43 // This function assumes |isReadableStream(stream)|. | 43 // This function assumes |isReadableStream(stream)|. |
| 44 static bool isDisturbed(ScriptState*, ScriptValue stream); | 44 static bool isDisturbed(ScriptState*, ScriptValue stream); |
| 45 | 45 |
| 46 // IsReadableStreamLocked | 46 // IsReadableStreamLocked |
| 47 // This function assumes |isReadableStream(stream)|. | 47 // This function assumes |isReadableStream(stream)|. |
| 48 static bool isLocked(ScriptState*, ScriptValue stream); | 48 static bool isLocked(ScriptState*, ScriptValue stream); |
| 49 | 49 |
| 50 // IsReadableStreamReadable | 50 // IsReadableStreamReadable |
| 51 // This function assumes |isReadableStream(stream)|. | 51 // This function assumes |isReadableStream(stream)|. |
| 52 static bool isReadable(ScriptState*, ScriptValue stream); | 52 static bool isReadable(ScriptState*, ScriptValue stream); |
| 53 | 53 |
| 54 // IsReadableStreamClosed | 54 // IsReadableStreamClosed |
| 55 // This function assumes |isReadableStream(stream)|. | 55 // This function assumes |isReadableStream(stream)|. |
| 56 static bool isClosed(ScriptState*, ScriptValue stream); | 56 static bool isClosed(ScriptState*, ScriptValue stream); |
| 57 | 57 |
| 58 // IsReadableStreamErrored | 58 // IsReadableStreamErrored |
| 59 // This function assumes |isReadableStream(stream)|. | 59 // This function assumes |isReadableStream(stream)|. |
| 60 static bool isErrored(ScriptState*, ScriptValue stream); | 60 static bool isErrored(ScriptState*, ScriptValue stream); |
| 61 | 61 |
| 62 // IsReadableStreamReader | 62 // IsReadableStreamDefaultReader |
| 63 static bool isReadableStreamReader(ScriptState*, ScriptValue); | 63 static bool isReadableStreamDefaultReader(ScriptState*, ScriptValue); |
| 64 | 64 |
| 65 // ReadFromReadableStreamReader | 65 // ReadableStreamDefaultReaderRead |
| 66 // This function assumes |isReadableStreamReader(reader)|. | 66 // This function assumes |isReadableStreamDefaultReader(reader)|. |
| 67 static ScriptPromise read(ScriptState*, ScriptValue reader); | 67 static ScriptPromise defaultReaderRead(ScriptState*, ScriptValue reader); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| 71 | 71 |
| 72 #endif // ReadableStreamOperations_h | 72 #endif // ReadableStreamOperations_h |
| OLD | NEW |