Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: Source/core/streams/ScriptReadableStream.h

Issue 1118673002: Implement ReadableStream as a V8 extra (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Cleanups; make controller a member instead of arg Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 ScriptReadableStream_h
6 #define ScriptReadableStream_h
7
8 #include "bindings/core/v8/ScriptState.h"
9 #include "bindings/core/v8/ScriptValue.h"
10 #include "core/streams/ScriptQueuingStrategy.h"
11 #include "core/streams/ScriptUnderlyingSource.h"
12 #include <v8.h>
13
14 namespace blink {
15
16 class CORE_EXPORT ScriptReadableStream {
17 public:
18 // This is for UA-created ReadableStreams
19 ScriptReadableStream(ScriptState*, ScriptUnderlyingSource*, ScriptQueuingStr ategy*);
20
21 // TODO: also a constructor for converting author-created ReadableStreams, e .g. for use in the bindings for
22 // functions/setters that accept ReadableStream?
23
24 // TODO: add functions to manipulate and inspect the stream from C++ beyond just the abilities of the controller.
25 // E.g. getting readers and reading.
26
27 bool isObject() const
28 {
29 return m_stream.isObject();
30 }
31
32 bool isNull() const
33 {
34 return m_stream.isNull();
35 }
36
37 bool isUndefinedOrNull() const
38 {
39 return m_stream.isUndefined() || m_stream.isNull();
40 }
41
42 ScriptValue scriptValue() const
43 {
44 return m_stream;
45 }
46
47 v8::Local<v8::Value> v8Value() const
48 {
49 return m_stream.v8Value();
50 }
51
52 v8::Isolate* isolate() const
53 {
54 return m_stream.isolate();
55 }
56
57 bool isEmpty() const
58 {
59 return m_stream.isEmpty();
60 }
61
62 void clear()
63 {
64 m_stream.clear();
65 }
66
67 bool operator==(const ScriptReadableStream& value) const
68 {
69 return m_stream == value.m_stream;
70 }
71
72 bool operator!=(const ScriptReadableStream& value) const
73 {
74 return !operator==(value);
75 }
76
77 private:
78 ScriptValue m_stream;
79 };
80
81 } // namespace blink
82
83 #endif // ScriptReadableStream_h
OLDNEW
« no previous file with comments | « Source/core/streams/ScriptQueuingStrategy.idl ('k') | Source/core/streams/ScriptReadableStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698