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/FormData.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 |
21 // 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 |
22 // the client own the handle is the right way. | 22 // the client own the handle is the right way. |
23 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle { | 23 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle { |
| 24 WTF_MAKE_FAST_ALLOCATED(FetchDataConsumerHandle); |
24 public: | 25 public: |
25 class Reader : public WebDataConsumerHandle::Reader { | 26 class Reader : public WebDataConsumerHandle::Reader { |
| 27 WTF_MAKE_FAST_ALLOCATED(Reader); |
26 public: | 28 public: |
27 enum BlobSizePolicy { | 29 enum BlobSizePolicy { |
28 // The returned blob must have a valid size (i.e. != kuint64max). | 30 // The returned blob must have a valid size (i.e. != kuint64max). |
29 DisallowBlobWithInvalidSize, | 31 DisallowBlobWithInvalidSize, |
30 // The returned blob can have an invalid size. | 32 // The returned blob can have an invalid size. |
31 AllowBlobWithInvalidSize | 33 AllowBlobWithInvalidSize |
32 }; | 34 }; |
33 | 35 |
34 // The following "draining" functions drain and return the data. They | 36 // The following "draining" functions drain and return the data. They |
35 // can return null when it is impossible to drain, and in such cases the | 37 // can return null when it is impossible to drain, and in such cases the |
(...skipping 27 matching lines...) Expand all Loading... |
63 // unique_ptr in both Blink and Chromium. | 65 // unique_ptr in both Blink and Chromium. |
64 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } | 66 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } |
65 | 67 |
66 private: | 68 private: |
67 Reader* obtainReaderInternal(Client*) override = 0; | 69 Reader* obtainReaderInternal(Client*) override = 0; |
68 }; | 70 }; |
69 | 71 |
70 } // namespace blink | 72 } // namespace blink |
71 | 73 |
72 #endif // FetchDataConsumerHandle_h | 74 #endif // FetchDataConsumerHandle_h |
OLD | NEW |