| 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 #ifndef FetchDataConsumerHandle_h | 5 #ifndef FetchDataConsumerHandle_h |
| 6 #define FetchDataConsumerHandle_h | 6 #define FetchDataConsumerHandle_h |
| 7 | 7 |
| 8 #include "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
| 9 #include "platform/blob/BlobData.h" | 9 #include "platform/blob/BlobData.h" |
| 10 #include "platform/network/FormData.h" | 10 #include "platform/network/EncodedFormData.h" |
| 11 #include "public/platform/WebDataConsumerHandle.h" | 11 #include "public/platform/WebDataConsumerHandle.h" |
| 12 #include "wtf/Forward.h" | 12 #include "wtf/Forward.h" |
| 13 #include "wtf/PassRefPtr.h" | 13 #include "wtf/PassRefPtr.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 // This is an interface class that adds Reader's blobDataHandle() to | 17 // This is an interface class that adds Reader's blobDataHandle() to |
| 18 // WebDataConsumerHandle. | 18 // WebDataConsumerHandle. |
| 19 // This class works not very well with Oilpan: As this class is not garbage | 19 // This class works not very well with Oilpan: As this class is not garbage |
| 20 // collected while many clients or related objects may be, it is very easy | 20 // collected while many clients or related objects may be, it is very easy |
| (...skipping 26 matching lines...) Expand all Loading... |
| 47 // is regarded as read. | 47 // is regarded as read. |
| 48 | 48 |
| 49 // Drains the data as a BlobDataHandle. | 49 // Drains the data as a BlobDataHandle. |
| 50 // The returned non-null blob handle contains bytes that would be read | 50 // The returned non-null blob handle contains bytes that would be read |
| 51 // through WebDataConsumerHandle::Reader APIs without calling this | 51 // through WebDataConsumerHandle::Reader APIs without calling this |
| 52 // function. | 52 // function. |
| 53 // When |policy| is DisallowBlobWithInvalidSize, this function doesn't | 53 // When |policy| is DisallowBlobWithInvalidSize, this function doesn't |
| 54 // return a non-null blob handle with unspecified size. | 54 // return a non-null blob handle with unspecified size. |
| 55 virtual PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(BlobSizePolicy
= DisallowBlobWithInvalidSize) { return nullptr; } | 55 virtual PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(BlobSizePolicy
= DisallowBlobWithInvalidSize) { return nullptr; } |
| 56 | 56 |
| 57 // Drains the data as a FormData. | 57 // Drains the data as an EncodedFormData. |
| 58 // This function returns a non-null form data when the handle is made | 58 // This function returns a non-null form data when the handle is made |
| 59 // from a FormData-convertible value. | 59 // from an EncodedFormData-convertible value. |
| 60 virtual PassRefPtr<FormData> drainAsFormData() { return nullptr; } | 60 virtual PassRefPtr<EncodedFormData> drainAsFormData() { return nullptr;
} |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // TODO(yhirano): obtainReader() is currently non-virtual override, and | 63 // TODO(yhirano): obtainReader() is currently non-virtual override, and |
| 64 // will be changed into virtual override when we can use scoped_ptr / | 64 // will be changed into virtual override when we can use scoped_ptr / |
| 65 // unique_ptr in both Blink and Chromium. | 65 // unique_ptr in both Blink and Chromium. |
| 66 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } | 66 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 Reader* obtainReaderInternal(Client*) override = 0; | 69 Reader* obtainReaderInternal(Client*) override = 0; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace blink | 72 } // namespace blink |
| 73 | 73 |
| 74 #endif // FetchDataConsumerHandle_h | 74 #endif // FetchDataConsumerHandle_h |
| OLD | NEW |