| 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 #include "modules/fetch/BytesConsumer.h" | 5 #include "modules/fetch/BytesConsumer.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContext.h" | 7 #include "core/dom/ExecutionContext.h" |
| 8 #include "core/dom/TaskRunnerHelper.h" | 8 #include "core/dom/TaskRunnerHelper.h" |
| 9 #include "modules/fetch/BlobBytesConsumer.h" | 9 #include "modules/fetch/BlobBytesConsumer.h" |
| 10 #include "platform/WebTaskRunner.h" | 10 #include "platform/WebTaskRunner.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (m_chunks.isEmpty()) { | 165 if (m_chunks.isEmpty()) { |
| 166 // This object becomes errored during the two-phase read. | 166 // This object becomes errored during the two-phase read. |
| 167 DCHECK_EQ(PublicState::Errored, getPublicState()); | 167 DCHECK_EQ(PublicState::Errored, getPublicState()); |
| 168 return Result::Ok; | 168 return Result::Ok; |
| 169 } | 169 } |
| 170 Chunk* chunk = m_chunks[0]; | 170 Chunk* chunk = m_chunks[0]; |
| 171 DCHECK_LE(m_offset + read, chunk->size()); | 171 DCHECK_LE(m_offset + read, chunk->size()); |
| 172 m_offset += read; | 172 m_offset += read; |
| 173 if (chunk->size() == m_offset) { | 173 if (chunk->size() == m_offset) { |
| 174 m_offset = 0; | 174 m_offset = 0; |
| 175 m_chunks.removeFirst(); | 175 m_chunks.pop_front(); |
| 176 } | 176 } |
| 177 if (m_chunks.isEmpty() && | 177 if (m_chunks.isEmpty() && |
| 178 m_tee->getPublicState() == PublicState::Closed) { | 178 m_tee->getPublicState() == PublicState::Closed) { |
| 179 // All data has been consumed. | 179 // All data has been consumed. |
| 180 TaskRunnerHelper::get(TaskType::Networking, m_executionContext) | 180 TaskRunnerHelper::get(TaskType::Networking, m_executionContext) |
| 181 ->postTask(BLINK_FROM_HERE, | 181 ->postTask(BLINK_FROM_HERE, |
| 182 WTF::bind(&Destination::close, wrapPersistent(this))); | 182 WTF::bind(&Destination::close, wrapPersistent(this))); |
| 183 } | 183 } |
| 184 return Result::Ok; | 184 return Result::Ok; |
| 185 } | 185 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 BytesConsumer* BytesConsumer::createErrored(const BytesConsumer::Error& error) { | 370 BytesConsumer* BytesConsumer::createErrored(const BytesConsumer::Error& error) { |
| 371 return new ErroredBytesConsumer(error); | 371 return new ErroredBytesConsumer(error); |
| 372 } | 372 } |
| 373 | 373 |
| 374 BytesConsumer* BytesConsumer::createClosed() { | 374 BytesConsumer* BytesConsumer::createClosed() { |
| 375 return new ClosedBytesConsumer(); | 375 return new ClosedBytesConsumer(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |