Chromium Code Reviews| Index: Source/modules/fetch/FetchDataConsumerHandle.h |
| diff --git a/Source/modules/fetch/FetchDataConsumerHandle.h b/Source/modules/fetch/FetchDataConsumerHandle.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..066e1099e389f94e13bded8579748dc42ba2d411 |
| --- /dev/null |
| +++ b/Source/modules/fetch/FetchDataConsumerHandle.h |
| @@ -0,0 +1,43 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef FetchDataConsumerHandle_h |
| +#define FetchDataConsumerHandle_h |
| + |
| +#include "public/platform/WebDataConsumerHandle.h" |
| +#include "wtf/Forward.h" |
| +#include "wtf/PassRefPtr.h" |
| + |
| +namespace blink { |
| + |
| +class BlobDataHandle; |
| + |
| +// This is an interface class that adds Reader's blobDataHandle() to |
| +// WebDataConsumerHandle. |
| +// This class works not very well with Oilpan: As this class is not garbage |
| +// collected while many clients or related objects may be, it is very easy |
| +// to create a reference cycle. When an client is garbage collected, making |
| +// the client own the handle is the right way. |
| +class FetchDataConsumerHandle : public WebDataConsumerHandle { |
| +public: |
| + class Reader : public WebDataConsumerHandle::Reader { |
| + public: |
| + // Returns a blob handle representing the body data. This function can |
| + // returns null when the object doesn't have such a handle. Calling |
| + // this function drains the body data. |
| + // This function is defined for performance. If this function returns a |
| + // non-null handle, the bytes that will be read from the handle must be |
| + // idential to the bytes that will be read |
| + // throughWebDataConsumerHandle APIs without calling this function. |
|
yhirano
2015/06/17 04:13:34
space after "through"
hiroshige
2015/06/17 08:30:23
Done.
|
| + virtual PassRefPtr<BlobDataHandle> blobDataHandle() = 0; |
|
yhirano
2015/06/17 04:13:35
As this function is not a getter, a name that does
hiroshige
2015/06/17 08:30:23
Hmm. Do you have suggestions for the name?
(|obtai
yhirano
2015/06/17 09:10:16
take / obtain / acquire?
hiroshige
2015/06/17 09:25:26
Done in Patch Set 9.
|
| + }; |
| + PassOwnPtr<Reader> obtainReader(Client* client) { return adoptPtr(obtainReaderInternal(client)); } |
|
yhirano
2015/06/17 04:13:35
Please say that obtainReader is non-virtual overri
hiroshige
2015/06/17 08:30:23
Done.
|
| + |
| +private: |
| + Reader* obtainReaderInternal(Client*) override = 0; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // FetchDataConsumerHandle_h |