| 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 BytesConsumerTestUtil_h | 5 #ifndef BytesConsumerTestUtil_h |
| 6 #define BytesConsumerTestUtil_h | 6 #define BytesConsumerTestUtil_h |
| 7 | 7 |
| 8 #include "modules/fetch/BytesConsumer.h" | 8 #include "modules/fetch/BytesConsumer.h" |
| 9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
| 10 #include "wtf/Deque.h" | 10 #include "wtf/Deque.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 visitor->trace(m_consumer); | 97 visitor->trace(m_consumer); |
| 98 BytesConsumer::Client::trace(visitor); | 98 BytesConsumer::Client::trace(visitor); |
| 99 } | 99 } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 Member<BytesConsumer> m_consumer; | 102 Member<BytesConsumer> m_consumer; |
| 103 BytesConsumer::Result m_result = BytesConsumer::Result::ShouldWait; | 103 BytesConsumer::Result m_result = BytesConsumer::Result::ShouldWait; |
| 104 Vector<char> m_data; | 104 Vector<char> m_data; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 class TwoPhaseReader final : public GarbageCollectedFinalized<Reader>, publi
c BytesConsumer::Client { | 107 class TwoPhaseReader final : public GarbageCollectedFinalized<TwoPhaseReader
>, public BytesConsumer::Client { |
| 108 USING_GARBAGE_COLLECTED_MIXIN(TwoPhaseReader); | 108 USING_GARBAGE_COLLECTED_MIXIN(TwoPhaseReader); |
| 109 public: | 109 public: |
| 110 // |consumer| must not have a client when called. | 110 // |consumer| must not have a client when called. |
| 111 explicit TwoPhaseReader(BytesConsumer* /* consumer */); | 111 explicit TwoPhaseReader(BytesConsumer* /* consumer */); |
| 112 | 112 |
| 113 void onStateChange() override; | 113 void onStateChange() override; |
| 114 std::pair<BytesConsumer::Result, Vector<char>> run(); | 114 std::pair<BytesConsumer::Result, Vector<char>> run(); |
| 115 | 115 |
| 116 DEFINE_INLINE_TRACE() | 116 DEFINE_INLINE_TRACE() |
| 117 { | 117 { |
| 118 visitor->trace(m_consumer); | 118 visitor->trace(m_consumer); |
| 119 BytesConsumer::Client::trace(visitor); | 119 BytesConsumer::Client::trace(visitor); |
| 120 } | 120 } |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 Member<BytesConsumer> m_consumer; | 123 Member<BytesConsumer> m_consumer; |
| 124 BytesConsumer::Result m_result = BytesConsumer::Result::ShouldWait; | 124 BytesConsumer::Result m_result = BytesConsumer::Result::ShouldWait; |
| 125 Vector<char> m_data; | 125 Vector<char> m_data; |
| 126 }; | 126 }; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace blink | 129 } // namespace blink |
| 130 | 130 |
| 131 #endif // BytesConsumerTestUtil_h | 131 #endif // BytesConsumerTestUtil_h |
| OLD | NEW |