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/EncodedFormData.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 #include "wtf/PtrUtil.h" |
| 15 #include <memory> |
14 | 16 |
15 namespace blink { | 17 namespace blink { |
16 | 18 |
17 // This is an interface class that adds Reader's blobDataHandle() to | 19 // This is an interface class that adds Reader's blobDataHandle() to |
18 // WebDataConsumerHandle. | 20 // WebDataConsumerHandle. |
19 // This class works not very well with Oilpan: As this class is not garbage | 21 // 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 | 22 // collected while many clients or related objects may be, it is very easy |
21 // to create a reference cycle. When an client is garbage collected, making | 23 // to create a reference cycle. When an client is garbage collected, making |
22 // the client own the handle is the right way. | 24 // the client own the handle is the right way. |
23 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle { | 25 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 59 |
58 // Drains the data as an EncodedFormData. | 60 // Drains the data as an EncodedFormData. |
59 // This function returns a non-null form data when the handle is made | 61 // This function returns a non-null form data when the handle is made |
60 // from an EncodedFormData-convertible value. | 62 // from an EncodedFormData-convertible value. |
61 virtual PassRefPtr<EncodedFormData> drainAsFormData() { return nullptr;
} | 63 virtual PassRefPtr<EncodedFormData> drainAsFormData() { return nullptr;
} |
62 }; | 64 }; |
63 | 65 |
64 // TODO(yhirano): obtainReader() is currently non-virtual override, and | 66 // TODO(yhirano): obtainReader() is currently non-virtual override, and |
65 // will be changed into virtual override when we can use unique_ptr in | 67 // will be changed into virtual override when we can use unique_ptr in |
66 // Blink. | 68 // Blink. |
67 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } | 69 std::unique_ptr<Reader> obtainReader(Client* client) { return wrapUnique(obt
ainReaderInternal(client)); } |
68 | 70 |
69 private: | 71 private: |
70 Reader* obtainReaderInternal(Client*) override = 0; | 72 Reader* obtainReaderInternal(Client*) override = 0; |
71 }; | 73 }; |
72 | 74 |
73 } // namespace blink | 75 } // namespace blink |
74 | 76 |
75 #endif // FetchDataConsumerHandle_h | 77 #endif // FetchDataConsumerHandle_h |
OLD | NEW |