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

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: Build break fix. 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
« no previous file with comments | « Source/modules/fetch/DataConsumerHandleTestUtil.h ('k') | Source/modules/fetch/DataConsumerHandleUtil.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/modules/fetch/DataConsumerHandleTestUtil.h ('k') | Source/modules/fetch/DataConsumerHandleUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698