Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchDataConsumerHandle.h

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
16 14
17 namespace blink { 15 namespace blink {
18 16
19 // This is an interface class that adds Reader's blobDataHandle() to 17 // This is an interface class that adds Reader's blobDataHandle() to
20 // WebDataConsumerHandle. 18 // WebDataConsumerHandle.
21 // 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
22 // 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
23 // to create a reference cycle. When an client is garbage collected, making 21 // to create a reference cycle. When an client is garbage collected, making
24 // the client own the handle is the right way. 22 // the client own the handle is the right way.
25 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle { 23 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 57
60 // Drains the data as an EncodedFormData. 58 // Drains the data as an EncodedFormData.
61 // This function returns a non-null form data when the handle is made 59 // This function returns a non-null form data when the handle is made
62 // from an EncodedFormData-convertible value. 60 // from an EncodedFormData-convertible value.
63 virtual PassRefPtr<EncodedFormData> drainAsFormData() { return nullptr; } 61 virtual PassRefPtr<EncodedFormData> drainAsFormData() { return nullptr; }
64 }; 62 };
65 63
66 // TODO(yhirano): obtainReader() is currently non-virtual override, and 64 // TODO(yhirano): obtainReader() is currently non-virtual override, and
67 // will be changed into virtual override when we can use unique_ptr in 65 // will be changed into virtual override when we can use unique_ptr in
68 // Blink. 66 // Blink.
69 std::unique_ptr<Reader> obtainReader(Client* client) { return wrapUnique(obt ainReaderInternal(client)); } 67 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead erInternal(client)); }
70 68
71 private: 69 private:
72 Reader* obtainReaderInternal(Client*) override = 0; 70 Reader* obtainReaderInternal(Client*) override = 0;
73 }; 71 };
74 72
75 } // namespace blink 73 } // namespace blink
76 74
77 #endif // FetchDataConsumerHandle_h 75 #endif // FetchDataConsumerHandle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698