| 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 "platform/blob/BlobData.h" | 9 #include "platform/blob/BlobData.h" |
| 9 #include "public/platform/WebDataConsumerHandle.h" | 10 #include "public/platform/WebDataConsumerHandle.h" |
| 10 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
| 11 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 // This is an interface class that adds Reader's blobDataHandle() to | 16 // This is an interface class that adds Reader's blobDataHandle() to |
| 16 // WebDataConsumerHandle. | 17 // WebDataConsumerHandle. |
| 17 // This class works not very well with Oilpan: As this class is not garbage | 18 // This class works not very well with Oilpan: As this class is not garbage |
| 18 // collected while many clients or related objects may be, it is very easy | 19 // collected while many clients or related objects may be, it is very easy |
| 19 // to create a reference cycle. When an client is garbage collected, making | 20 // to create a reference cycle. When an client is garbage collected, making |
| 20 // the client own the handle is the right way. | 21 // the client own the handle is the right way. |
| 21 class FetchDataConsumerHandle : public WebDataConsumerHandle { | 22 class MODULES_EXPORT FetchDataConsumerHandle : public WebDataConsumerHandle { |
| 22 public: | 23 public: |
| 23 class Reader : public WebDataConsumerHandle::Reader { | 24 class Reader : public WebDataConsumerHandle::Reader { |
| 24 public: | 25 public: |
| 25 enum BlobSizePolicy { | 26 enum BlobSizePolicy { |
| 26 // The returned blob must have a valid size (i.e. != kuint64max). | 27 // The returned blob must have a valid size (i.e. != kuint64max). |
| 27 DisallowBlobWithInvalidSize, | 28 DisallowBlobWithInvalidSize, |
| 28 // The returned blob can have an invalid size. | 29 // The returned blob can have an invalid size. |
| 29 AllowBlobWithInvalidSize | 30 AllowBlobWithInvalidSize |
| 30 }; | 31 }; |
| 31 | 32 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 // unique_ptr in both Blink and Chromium. | 47 // unique_ptr in both Blink and Chromium. |
| 47 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } | 48 PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainRead
erInternal(client)); } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 Reader* obtainReaderInternal(Client*) override = 0; | 51 Reader* obtainReaderInternal(Client*) override = 0; |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace blink | 54 } // namespace blink |
| 54 | 55 |
| 55 #endif // FetchDataConsumerHandle_h | 56 #endif // FetchDataConsumerHandle_h |
| OLD | NEW |