OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ReadableStream_h | 5 #ifndef ReadableStream_h |
6 #define ReadableStream_h | 6 #define ReadableStream_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptPromiseProperty.h" | 9 #include "bindings/core/v8/ScriptPromiseProperty.h" |
10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
11 #include "bindings/core/v8/ScriptValue.h" | 11 #include "bindings/core/v8/ScriptValue.h" |
12 #include "bindings/core/v8/ScriptWrappable.h" | 12 #include "bindings/core/v8/ScriptWrappable.h" |
13 #include "bindings/core/v8/V8Binding.h" | 13 #include "bindings/core/v8/V8Binding.h" |
14 #include "core/dom/ActiveDOMObject.h" | 14 #include "core/dom/ActiveDOMObject.h" |
15 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
16 #include "wtf/Forward.h" | 16 #include "wtf/Forward.h" |
17 #include "wtf/PassRefPtr.h" | 17 #include "wtf/PassRefPtr.h" |
18 #include "wtf/RefPtr.h" | 18 #include "wtf/RefPtr.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 class DOMException; | 22 class DOMException; |
23 class ExceptionState; | 23 class ExceptionState; |
24 class ExclusiveStreamReader; | 24 class ReadableStreamReader; |
25 class UnderlyingSource; | 25 class UnderlyingSource; |
26 | 26 |
27 class ReadableStream : public GarbageCollectedFinalized<ReadableStream>, public
ScriptWrappable, public ActiveDOMObject { | 27 class ReadableStream : public GarbageCollectedFinalized<ReadableStream>, public
ScriptWrappable, public ActiveDOMObject { |
28 DEFINE_WRAPPERTYPEINFO(); | 28 DEFINE_WRAPPERTYPEINFO(); |
29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ReadableStream); | 29 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ReadableStream); |
30 public: | 30 public: |
31 enum State { | 31 enum State { |
32 Readable, | 32 Readable, |
33 Waiting, | 33 Waiting, |
34 Closed, | 34 Closed, |
(...skipping 22 matching lines...) Expand all Loading... |
57 ScriptPromise closed(ScriptState*); | 57 ScriptPromise closed(ScriptState*); |
58 | 58 |
59 virtual ScriptValue readInternal(ScriptState*, ExceptionState&) = 0; | 59 virtual ScriptValue readInternal(ScriptState*, ExceptionState&) = 0; |
60 ScriptPromise readyInternal(ScriptState*); | 60 ScriptPromise readyInternal(ScriptState*); |
61 | 61 |
62 void close(); | 62 void close(); |
63 void error(PassRefPtrWillBeRawPtr<DOMException>); | 63 void error(PassRefPtrWillBeRawPtr<DOMException>); |
64 | 64 |
65 void didSourceStart(); | 65 void didSourceStart(); |
66 | 66 |
67 // This function is not a getter. It creates an ExclusiveStreamReader and | 67 // This function is not a getter. It creates an ReadableStreamReader and |
68 // returns it. | 68 // returns it. |
69 ExclusiveStreamReader* getReader(ExceptionState&); | 69 ReadableStreamReader* getReader(ExceptionState&); |
70 // Only ExclusiveStreamReader methods should call this function. | 70 // Only ReadableStreamReader methods should call this function. |
71 void setReader(ExclusiveStreamReader*); | 71 void setReader(ReadableStreamReader*); |
72 | 72 |
73 bool isLocked() const { return m_reader; } | 73 bool isLocked() const { return m_reader; } |
74 bool isLockedTo(const ExclusiveStreamReader* reader) const { return m_reader
== reader; } | 74 bool isLockedTo(const ReadableStreamReader* reader) const { return m_reader
== reader; } |
75 | 75 |
76 bool hasPendingActivity() const override; | 76 bool hasPendingActivity() const override; |
77 void stop() override; | 77 void stop() override; |
78 DECLARE_VIRTUAL_TRACE(); | 78 DECLARE_VIRTUAL_TRACE(); |
79 | 79 |
80 // Returns the string representation of the given State. | 80 // Returns the string representation of the given State. |
81 static String stateToString(State); | 81 static String stateToString(State); |
82 | 82 |
83 protected: | 83 protected: |
84 bool enqueuePreliminaryCheck(); | 84 bool enqueuePreliminaryCheck(); |
(...skipping 15 matching lines...) Expand all Loading... |
100 Member<UnderlyingSource> m_source; | 100 Member<UnderlyingSource> m_source; |
101 bool m_isStarted; | 101 bool m_isStarted; |
102 bool m_isDraining; | 102 bool m_isDraining; |
103 bool m_isPulling; | 103 bool m_isPulling; |
104 State m_state; | 104 State m_state; |
105 | 105 |
106 Member<WaitPromise> m_ready; | 106 Member<WaitPromise> m_ready; |
107 Member<ClosedPromise> m_closed; | 107 Member<ClosedPromise> m_closed; |
108 | 108 |
109 RefPtrWillBeMember<DOMException> m_exception; | 109 RefPtrWillBeMember<DOMException> m_exception; |
110 Member<ExclusiveStreamReader> m_reader; | 110 Member<ReadableStreamReader> m_reader; |
111 }; | 111 }; |
112 | 112 |
113 } // namespace blink | 113 } // namespace blink |
114 | 114 |
115 #endif // ReadableStream_h | 115 #endif // ReadableStream_h |
OLD | NEW |