OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BytesConsumer_h | 5 #ifndef BytesConsumer_h |
6 #define BytesConsumer_h | 6 #define BytesConsumer_h |
7 | 7 |
8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
9 #include "platform/blob/BlobData.h" | 9 #include "platform/blob/BlobData.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 virtual String debugName() const = 0; | 148 virtual String debugName() const = 0; |
149 | 149 |
150 // Creates two BytesConsumer both of which represent the data sequence that | 150 // Creates two BytesConsumer both of which represent the data sequence that |
151 // would be read from |src| and store them to |*dest1| and |*dest2|. | 151 // would be read from |src| and store them to |*dest1| and |*dest2|. |
152 // |src| must not have a client when called. | 152 // |src| must not have a client when called. |
153 static void tee(ExecutionContext*, | 153 static void tee(ExecutionContext*, |
154 BytesConsumer* src, | 154 BytesConsumer* src, |
155 BytesConsumer** dest1, | 155 BytesConsumer** dest1, |
156 BytesConsumer** dest2); | 156 BytesConsumer** dest2); |
157 | 157 |
| 158 // Returns a BytesConsumer whose state is Closed. |
| 159 static BytesConsumer* createClosed(); |
| 160 |
| 161 // Returns a BytesConsumer whose state is Errored. |
| 162 static BytesConsumer* createErrored(const Error&); |
| 163 |
158 DEFINE_INLINE_VIRTUAL_TRACE() {} | 164 DEFINE_INLINE_VIRTUAL_TRACE() {} |
159 | 165 |
160 protected: | 166 protected: |
161 // This InternalState directly corresponds to the states in the class | 167 // This InternalState directly corresponds to the states in the class |
162 // comments. This enum is defined here for subclasses. | 168 // comments. This enum is defined here for subclasses. |
163 enum class InternalState { | 169 enum class InternalState { |
164 Readable, | 170 Readable, |
165 Waiting, | 171 Waiting, |
166 Closed, | 172 Closed, |
167 Errored, | 173 Errored, |
(...skipping 10 matching lines...) Expand all Loading... |
178 return PublicState::Errored; | 184 return PublicState::Errored; |
179 } | 185 } |
180 NOTREACHED(); | 186 NOTREACHED(); |
181 return PublicState::ReadableOrWaiting; | 187 return PublicState::ReadableOrWaiting; |
182 } | 188 } |
183 }; | 189 }; |
184 | 190 |
185 } // namespace blink | 191 } // namespace blink |
186 | 192 |
187 #endif // BytesConsumer_h | 193 #endif // BytesConsumer_h |
OLD | NEW |