OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "config.h" | 5 #include "config.h" |
6 #include "modules/fetch/FetchBlobDataConsumerHandle.h" | 6 #include "modules/fetch/FetchBlobDataConsumerHandle.h" |
7 | 7 |
8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/fetch/FetchInitiatorTypeNames.h" | 9 #include "core/fetch/FetchInitiatorTypeNames.h" |
10 #include "core/loader/ThreadableLoaderClient.h" | 10 #include "core/loader/ThreadableLoaderClient.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 if (!m_readerContext->m_blobDataHandleForDrain) | 218 if (!m_readerContext->m_blobDataHandleForDrain) |
219 return nullptr; | 219 return nullptr; |
220 if (blobSizePolicy == DisallowBlobWithInvalidSize && m_readerContext
->m_blobDataHandleForDrain->size() == kuint64max) | 220 if (blobSizePolicy == DisallowBlobWithInvalidSize && m_readerContext
->m_blobDataHandleForDrain->size() == kuint64max) |
221 return nullptr; | 221 return nullptr; |
222 RefPtr<BlobDataHandle> blobDataHandle = m_readerContext->m_blobDataH
andleForDrain; | 222 RefPtr<BlobDataHandle> blobDataHandle = m_readerContext->m_blobDataH
andleForDrain; |
223 m_readerContext->setDrained(); | 223 m_readerContext->setDrained(); |
224 m_readerContext->clearBlobDataHandleForDrain(); | 224 m_readerContext->clearBlobDataHandleForDrain(); |
225 return blobDataHandle.release(); | 225 return blobDataHandle.release(); |
226 } | 226 } |
227 | 227 |
228 PassRefPtr<FormData> drainAsFormData() override | 228 PassRefPtr<EncodedFormData> drainAsFormData() override |
229 { | 229 { |
230 RefPtr<BlobDataHandle> handle = drainAsBlobDataHandle(AllowBlobWithI
nvalidSize); | 230 RefPtr<BlobDataHandle> handle = drainAsBlobDataHandle(AllowBlobWithI
nvalidSize); |
231 if (!handle) | 231 if (!handle) |
232 return nullptr; | 232 return nullptr; |
233 RefPtr<FormData> formData = FormData::create(); | 233 RefPtr<EncodedFormData> formData = EncodedFormData::create(); |
234 formData->appendBlob(handle->uuid(), handle); | 234 formData->appendBlob(handle->uuid(), handle); |
235 return formData.release(); | 235 return formData.release(); |
236 } | 236 } |
237 | 237 |
238 private: | 238 private: |
239 RefPtr<ReaderContext> m_readerContext; | 239 RefPtr<ReaderContext> m_readerContext; |
240 OwnPtr<WebDataConsumerHandle::Reader> m_reader; | 240 OwnPtr<WebDataConsumerHandle::Reader> m_reader; |
241 NotifyOnReaderCreationHelper m_notifier; | 241 NotifyOnReaderCreationHelper m_notifier; |
242 }; | 242 }; |
243 | 243 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 | 305 |
306 return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHa
ndle, new DefaultLoaderFactory)); | 306 return adoptPtr(new FetchBlobDataConsumerHandle(executionContext, blobDataHa
ndle, new DefaultLoaderFactory)); |
307 } | 307 } |
308 | 308 |
309 FetchDataConsumerHandle::Reader* FetchBlobDataConsumerHandle::obtainReaderIntern
al(Client* client) | 309 FetchDataConsumerHandle::Reader* FetchBlobDataConsumerHandle::obtainReaderIntern
al(Client* client) |
310 { | 310 { |
311 return m_readerContext->obtainReader(client).leakPtr(); | 311 return m_readerContext->obtainReader(client).leakPtr(); |
312 } | 312 } |
313 | 313 |
314 } // namespace blink | 314 } // namespace blink |
OLD | NEW |