Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: Source/modules/fetch/DataConsumerHandleUtil.h

Issue 1176243004: Add FetchDataConsumerHandle and utility functions/classes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698