Chromium Code Reviews| Index: Source/modules/fetch/DataConsumerHandleUtil.h |
| diff --git a/Source/modules/fetch/DataConsumerHandleUtil.h b/Source/modules/fetch/DataConsumerHandleUtil.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d86d0a2164680d87bc2adcfaa3685d168dcbabc8 |
| --- /dev/null |
| +++ b/Source/modules/fetch/DataConsumerHandleUtil.h |
| @@ -0,0 +1,44 @@ |
| +// 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 DataConsumerHandleUtil_h |
| +#define DataConsumerHandleUtil_h |
| + |
| +#include "modules/fetch/FetchDataConsumerHandle.h" |
| +#include "public/platform/WebDataConsumerHandle.h" |
| +#include "wtf/PassOwnPtr.h" |
| +#include "wtf/WeakPtr.h" |
| + |
| +namespace blink { |
| + |
| +// Returns a handle that returns ShouldWait for read / beginRead and |
| +// UnexpectedError for endRead. |
| +PassOwnPtr<WebDataConsumerHandle> createWaitingHandle(); |
|
yhirano
2015/06/17 04:13:34
I'm afraid blink::createWaitingHandle and others a
hiroshige
2015/06/17 08:30:23
Made names longer.
|
| + |
| +// Returns a handle that returns Done for read / beginRead and |
| +// UnexpectedError for endRead. |
| +PassOwnPtr<WebDataConsumerHandle> createDoneHandle(); |
| + |
| +// Returns a handle that returns UnexpectedError for read / beginRead / |
| +// endRead. |
| +PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorHandle(); |
| + |
| +// Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle. |
| +PassOwnPtr<FetchDataConsumerHandle> createFetchHandleFromWebHandle(PassOwnPtr<WebDataConsumerHandle>); |
| + |
| +// A helper class to call Client::didGetReadable() asynchronously after |
| +// Reader creation. |
| +class NotifyOnReaderCreationHelper { |
|
yhirano
2015/06/17 04:13:34
Do you want to expose this class? Is it a problem
yhirano
2015/06/17 04:13:34
+final
hiroshige
2015/06/17 08:30:23
Done.
hiroshige
2015/06/17 08:30:23
I'd like to use this in FetchBlobConsumerHandle an
|
| +public: |
| + NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client*); |
| + |
| +private: |
| + void notify(WebDataConsumerHandle::Client*); |
| + |
| + WeakPtrFactory<NotifyOnReaderCreationHelper> m_factory; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // DataConsumerHandleUtil_h |