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" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return blob_data_handle_.Release(); | 130 return blob_data_handle_.Release(); |
131 } | 131 } |
132 | 132 |
133 PassRefPtr<EncodedFormData> BlobBytesConsumer::DrainAsFormData() { | 133 PassRefPtr<EncodedFormData> BlobBytesConsumer::DrainAsFormData() { |
134 RefPtr<BlobDataHandle> handle = | 134 RefPtr<BlobDataHandle> handle = |
135 DrainAsBlobDataHandle(BlobSizePolicy::kAllowBlobWithInvalidSize); | 135 DrainAsBlobDataHandle(BlobSizePolicy::kAllowBlobWithInvalidSize); |
136 if (!handle) | 136 if (!handle) |
137 return nullptr; | 137 return nullptr; |
138 RefPtr<EncodedFormData> form_data = EncodedFormData::Create(); | 138 RefPtr<EncodedFormData> form_data = EncodedFormData::Create(); |
139 form_data->AppendBlob(handle->Uuid(), handle); | 139 form_data->AppendBlob(handle->Uuid(), handle); |
140 return form_data.Release(); | 140 return form_data; |
141 } | 141 } |
142 | 142 |
143 void BlobBytesConsumer::SetClient(BytesConsumer::Client* client) { | 143 void BlobBytesConsumer::SetClient(BytesConsumer::Client* client) { |
144 DCHECK(!client_); | 144 DCHECK(!client_); |
145 DCHECK(client); | 145 DCHECK(client); |
146 client_ = client; | 146 client_ = client; |
147 } | 147 } |
148 | 148 |
149 void BlobBytesConsumer::ClearClient() { | 149 void BlobBytesConsumer::ClearClient() { |
150 client_ = nullptr; | 150 client_ = nullptr; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 void BlobBytesConsumer::Clear() { | 309 void BlobBytesConsumer::Clear() { |
310 DCHECK_NE(state_, PublicState::kReadableOrWaiting); | 310 DCHECK_NE(state_, PublicState::kReadableOrWaiting); |
311 if (loader_) { | 311 if (loader_) { |
312 loader_->Cancel(); | 312 loader_->Cancel(); |
313 loader_ = nullptr; | 313 loader_ = nullptr; |
314 } | 314 } |
315 client_ = nullptr; | 315 client_ = nullptr; |
316 } | 316 } |
317 | 317 |
318 } // namespace blink | 318 } // namespace blink |
OLD | NEW |