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/loader/ThreadableLoader.h" | 7 #include "core/loader/ThreadableLoader.h" |
8 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" | 8 #include "modules/fetch/BytesConsumerForDataConsumerHandle.h" |
9 #include "platform/blob/BlobData.h" | 9 #include "platform/blob/BlobData.h" |
10 #include "platform/blob/BlobRegistry.h" | 10 #include "platform/blob/BlobRegistry.h" |
11 #include "platform/blob/BlobURL.h" | 11 #include "platform/blob/BlobURL.h" |
12 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" | 12 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" |
13 #include "platform/loader/fetch/ResourceError.h" | 13 #include "platform/loader/fetch/ResourceError.h" |
14 #include "platform/loader/fetch/ResourceRequest.h" | 14 #include "platform/loader/fetch/ResourceRequest.h" |
15 #include "platform/weborigin/KURL.h" | 15 #include "platform/weborigin/KURL.h" |
16 #include "platform/weborigin/SecurityOrigin.h" | 16 #include "platform/weborigin/SecurityOrigin.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 BlobBytesConsumer::BlobBytesConsumer(ExecutionContext* executionContext, | 20 BlobBytesConsumer::BlobBytesConsumer(ExecutionContext* executionContext, |
21 PassRefPtr<BlobDataHandle> blobDataHandle, | 21 PassRefPtr<BlobDataHandle> blobDataHandle, |
22 ThreadableLoader* loader) | 22 ThreadableLoader* loader) |
23 : ContextLifecycleObserver(executionContext), | 23 : ContextLifecycleObserver(executionContext), |
24 m_blobDataHandle(blobDataHandle), | 24 m_blobDataHandle(std::move(blobDataHandle)), |
25 m_loader(loader) { | 25 m_loader(loader) { |
26 if (!m_blobDataHandle) { | 26 if (!m_blobDataHandle) { |
27 // Note that |m_loader| is non-null only in tests. | 27 // Note that |m_loader| is non-null only in tests. |
28 if (m_loader) { | 28 if (m_loader) { |
29 m_loader->cancel(); | 29 m_loader->cancel(); |
30 m_loader = nullptr; | 30 m_loader = nullptr; |
31 } | 31 } |
32 m_state = PublicState::Closed; | 32 m_state = PublicState::Closed; |
33 } | 33 } |
34 } | 34 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void BlobBytesConsumer::clear() { | 301 void BlobBytesConsumer::clear() { |
302 DCHECK_NE(m_state, PublicState::ReadableOrWaiting); | 302 DCHECK_NE(m_state, PublicState::ReadableOrWaiting); |
303 if (m_loader) { | 303 if (m_loader) { |
304 m_loader->cancel(); | 304 m_loader->cancel(); |
305 m_loader = nullptr; | 305 m_loader = nullptr; |
306 } | 306 } |
307 m_client = nullptr; | 307 m_client = nullptr; |
308 } | 308 } |
309 | 309 |
310 } // namespace blink | 310 } // namespace blink |
OLD | NEW |