| 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/BlobBytesConsumer.h" | 5 #include "modules/fetch/BlobBytesConsumer.h" |
| 6 | 6 |
| 7 #include "core/fetch/FetchInitiatorTypeNames.h" | 7 #include "core/fetch/FetchInitiatorTypeNames.h" |
| 8 #include "core/loader/ThreadableLoader.h" | 8 #include "core/loader/ThreadableLoader.h" |
| 9 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" | 9 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" |
| 10 #include "platform/blob/BlobData.h" | 10 #include "platform/blob/BlobData.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 BytesConsumer::Error BlobBytesConsumer::getError() const { | 157 BytesConsumer::Error BlobBytesConsumer::getError() const { |
| 158 DCHECK_EQ(PublicState::Errored, m_state); | 158 DCHECK_EQ(PublicState::Errored, m_state); |
| 159 return Error("Failed to load a blob."); | 159 return Error("Failed to load a blob."); |
| 160 } | 160 } |
| 161 | 161 |
| 162 BytesConsumer::PublicState BlobBytesConsumer::getPublicState() const { | 162 BytesConsumer::PublicState BlobBytesConsumer::getPublicState() const { |
| 163 return m_state; | 163 return m_state; |
| 164 } | 164 } |
| 165 | 165 |
| 166 void BlobBytesConsumer::contextDestroyed() { | 166 void BlobBytesConsumer::contextDestroyed(ExecutionContext*) { |
| 167 if (m_state != PublicState::ReadableOrWaiting) | 167 if (m_state != PublicState::ReadableOrWaiting) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 BytesConsumer::Client* client = m_client; | 170 BytesConsumer::Client* client = m_client; |
| 171 error(); | 171 error(); |
| 172 if (client) | 172 if (client) |
| 173 client->onStateChange(); | 173 client->onStateChange(); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void BlobBytesConsumer::onStateChange() { | 176 void BlobBytesConsumer::onStateChange() { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 void BlobBytesConsumer::clear() { | 297 void BlobBytesConsumer::clear() { |
| 298 DCHECK_NE(m_state, PublicState::ReadableOrWaiting); | 298 DCHECK_NE(m_state, PublicState::ReadableOrWaiting); |
| 299 if (m_loader) { | 299 if (m_loader) { |
| 300 m_loader->cancel(); | 300 m_loader->cancel(); |
| 301 m_loader = nullptr; | 301 m_loader = nullptr; |
| 302 } | 302 } |
| 303 m_client = nullptr; | 303 m_client = nullptr; |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace blink | 306 } // namespace blink |
| OLD | NEW |