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

Unified Diff: third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h

Issue 1506023003: Response construction with a ReadableStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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: third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
diff --git a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
new file mode 100644
index 0000000000000000000000000000000000000000..9c634f73d990d6da1e947994a59f1d2c7e7f6080
--- /dev/null
+++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
@@ -0,0 +1,48 @@
+// 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 ReadableStreamDataConsumerHandle_h
+#define ReadableStreamDataConsumerHandle_h
+
+#include "modules/ModulesExport.h"
+#include "modules/fetch/FetchDataConsumerHandle.h"
+#include "wtf/Forward.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/RefPtr.h"
+#include <v8.h>
+
+namespace blink {
+
+class ScriptState;
+
+// This class is a FetchDataConsumerHandle pulling bytes from ReadableStream
+// implemented with V8 Extras.
+// The stream will be immediately locked by the handle and will never be
+// released.
+// TODO(yhirano): CURRENTLY THIS HANDLE SUPPORTS READING ONLY FROM THE THREAD ON
+// WHICH IT IS CREATED. FIX THIS.
+// TODO(yhirano): This implementation may cause leaks because the handle and
+// the reader own a strong reference to the associated ReadableStreamReader.
+// Fix it.
+class MODULES_EXPORT ReadableStreamDataConsumerHandle final : public FetchDataConsumerHandle {
+ WTF_MAKE_NONCOPYABLE(ReadableStreamDataConsumerHandle);
+public:
+ static PassOwnPtr<ReadableStreamDataConsumerHandle> create(ScriptState* scriptState, v8::Local<v8::Value> stream)
+ {
+ return adoptPtr(new ReadableStreamDataConsumerHandle(scriptState, stream));
+ }
+ ~ReadableStreamDataConsumerHandle() override;
+
+private:
+ class ReadingContext;
+ ReadableStreamDataConsumerHandle(ScriptState*, v8::Local<v8::Value> stream);
+ Reader* obtainReaderInternal(Client*) override;
+ const char* debugName() const override { return "ReadableStreamDataConsumerHandle"; }
+
+ RefPtr<ReadingContext> m_readingContext;
+};
+
+} // namespace blink
+
+#endif // ReadableStreamDataConsumerHandle_h

Powered by Google App Engine
This is Rietveld 408576698