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 ReadableStreamImpl_h | 5 #ifndef ReadableStreamImpl_h |
6 #define ReadableStreamImpl_h | 6 #define ReadableStreamImpl_h |
7 | 7 |
8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 141 |
142 void resolveAllPendingReadsAsDone() override | 142 void resolveAllPendingReadsAsDone() override |
143 { | 143 { |
144 for (auto& resolver : m_pendingReads) { | 144 for (auto& resolver : m_pendingReads) { |
145 ScriptState::Scope scope(resolver->scriptState()); | 145 ScriptState::Scope scope(resolver->scriptState()); |
146 resolver->resolve(v8IteratorResultDone(resolver->scriptState())); | 146 resolver->resolve(v8IteratorResultDone(resolver->scriptState())); |
147 } | 147 } |
148 m_pendingReads.clear(); | 148 m_pendingReads.clear(); |
149 } | 149 } |
150 | 150 |
151 void rejectAllPendingReads(PassRefPtrWillBeRawPtr<DOMException> r) override | 151 void rejectAllPendingReads(DOMException* reason) override |
152 { | 152 { |
153 RefPtrWillBeRawPtr<DOMException> reason = r; | |
154 for (auto& resolver : m_pendingReads) | 153 for (auto& resolver : m_pendingReads) |
155 resolver->reject(reason); | 154 resolver->reject(reason); |
156 m_pendingReads.clear(); | 155 m_pendingReads.clear(); |
157 } | 156 } |
158 | 157 |
159 bool shouldApplyBackpressure() override | 158 bool shouldApplyBackpressure() override |
160 { | 159 { |
161 return m_strategy->shouldApplyBackpressure(m_totalQueueSize, this); | 160 return m_strategy->shouldApplyBackpressure(m_totalQueueSize, this); |
162 } | 161 } |
163 bool hasPendingReads() const override { return !m_pendingReads.isEmpty(); } | 162 bool hasPendingReads() const override { return !m_pendingReads.isEmpty(); } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 ASSERT(queue.isEmpty()); | 217 ASSERT(queue.isEmpty()); |
219 | 218 |
220 queue.swap(m_queue); | 219 queue.swap(m_queue); |
221 m_totalQueueSize = 0; | 220 m_totalQueueSize = 0; |
222 readInternalPostAction(); | 221 readInternalPostAction(); |
223 } | 222 } |
224 | 223 |
225 } // namespace blink | 224 } // namespace blink |
226 | 225 |
227 #endif // ReadableStreamImpl_h | 226 #endif // ReadableStreamImpl_h |
OLD | NEW |