| 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..7b4cafa584c66a1bd8c58506bcd01a517782a8d0
|
| --- /dev/null
|
| +++ b/Source/modules/fetch/DataConsumerHandleUtil.h
|
| @@ -0,0 +1,46 @@
|
| +// 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> createWaitingDataConsumerHandle();
|
| +
|
| +// Returns a handle that returns Done for read / beginRead and
|
| +// UnexpectedError for endRead.
|
| +PassOwnPtr<WebDataConsumerHandle> createDoneDataConsumerHandle();
|
| +
|
| +// Returns a handle that returns UnexpectedError for read / beginRead /
|
| +// endRead.
|
| +PassOwnPtr<WebDataConsumerHandle> createUnexpectedErrorDataConsumerHandle();
|
| +
|
| +// Returns a FetchDataConsumerHandle that wraps WebDataConsumerHandle.
|
| +PassOwnPtr<FetchDataConsumerHandle> createFetchDataConsumerHandleFromWebHandle(PassOwnPtr<WebDataConsumerHandle>);
|
| +
|
| +// A helper class to call Client::didGetReadable() asynchronously after
|
| +// Reader creation.
|
| +// NotifyOnReaderCreationHelper must be owned by a reader and
|
| +// |client| must be the client of the reader.
|
| +class NotifyOnReaderCreationHelper final {
|
| +public:
|
| + NotifyOnReaderCreationHelper(WebDataConsumerHandle::Client* /* client */);
|
| +
|
| +private:
|
| + void notify(WebDataConsumerHandle::Client*);
|
| +
|
| + WeakPtrFactory<NotifyOnReaderCreationHelper> m_factory;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // DataConsumerHandleUtil_h
|
|
|