| Index: Source/core/streams/ScriptReadableStream.h
|
| diff --git a/Source/core/streams/ScriptReadableStream.h b/Source/core/streams/ScriptReadableStream.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d10a114f4a3a2e73a6a390fa58051f30cc1b56d1
|
| --- /dev/null
|
| +++ b/Source/core/streams/ScriptReadableStream.h
|
| @@ -0,0 +1,83 @@
|
| +// 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 ScriptReadableStream_h
|
| +#define ScriptReadableStream_h
|
| +
|
| +#include "bindings/core/v8/ScriptState.h"
|
| +#include "bindings/core/v8/ScriptValue.h"
|
| +#include "core/streams/ScriptQueuingStrategy.h"
|
| +#include "core/streams/ScriptUnderlyingSource.h"
|
| +#include <v8.h>
|
| +
|
| +namespace blink {
|
| +
|
| +class CORE_EXPORT ScriptReadableStream {
|
| +public:
|
| + // This is for UA-created ReadableStreams
|
| + ScriptReadableStream(ScriptState*, ScriptUnderlyingSource*, ScriptQueuingStrategy*);
|
| +
|
| + // TODO: also a constructor for converting author-created ReadableStreams, e.g. for use in the bindings for
|
| + // functions/setters that accept ReadableStream?
|
| +
|
| + // TODO: add functions to manipulate and inspect the stream from C++ beyond just the abilities of the controller.
|
| + // E.g. getting readers and reading.
|
| +
|
| + bool isObject() const
|
| + {
|
| + return m_stream.isObject();
|
| + }
|
| +
|
| + bool isNull() const
|
| + {
|
| + return m_stream.isNull();
|
| + }
|
| +
|
| + bool isUndefinedOrNull() const
|
| + {
|
| + return m_stream.isUndefined() || m_stream.isNull();
|
| + }
|
| +
|
| + ScriptValue scriptValue() const
|
| + {
|
| + return m_stream;
|
| + }
|
| +
|
| + v8::Local<v8::Value> v8Value() const
|
| + {
|
| + return m_stream.v8Value();
|
| + }
|
| +
|
| + v8::Isolate* isolate() const
|
| + {
|
| + return m_stream.isolate();
|
| + }
|
| +
|
| + bool isEmpty() const
|
| + {
|
| + return m_stream.isEmpty();
|
| + }
|
| +
|
| + void clear()
|
| + {
|
| + m_stream.clear();
|
| + }
|
| +
|
| + bool operator==(const ScriptReadableStream& value) const
|
| + {
|
| + return m_stream == value.m_stream;
|
| + }
|
| +
|
| + bool operator!=(const ScriptReadableStream& value) const
|
| + {
|
| + return !operator==(value);
|
| + }
|
| +
|
| +private:
|
| + ScriptValue m_stream;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // ScriptReadableStream_h
|
|
|