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

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

Issue 1539803002: [Fetch API] Fix a memory leak with a Response constructed with a ReadableStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@response-constructed-with-stream
Patch Set: Created 4 years, 10 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: 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
index 1d80665ea6acae5ae936b862d2543a5c2e12cef1..cb14457954b08f08b3e9371418a483be9b76d63d 100644
--- a/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
+++ b/third_party/WebKit/Source/modules/fetch/ReadableStreamDataConsumerHandle.h
@@ -20,23 +20,24 @@ class ScriptState;
// implemented with V8 Extras.
// The stream will be immediately locked by the handle and will never be
// released.
+//
+// The ReadableStreamReader handle held in a ReadableStreamDataConsumerHandle
+// is weak. A user must guarantee that the ReadableStreamReader object is kept
+// alive appropriately.
// 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, ScriptValue stream)
+ static PassOwnPtr<ReadableStreamDataConsumerHandle> create(ScriptState* scriptState, ScriptValue streamReader)
{
- return adoptPtr(new ReadableStreamDataConsumerHandle(scriptState, stream));
+ return adoptPtr(new ReadableStreamDataConsumerHandle(scriptState, streamReader));
}
~ReadableStreamDataConsumerHandle() override;
private:
class ReadingContext;
- ReadableStreamDataConsumerHandle(ScriptState*, ScriptValue stream);
+ ReadableStreamDataConsumerHandle(ScriptState*, ScriptValue streamReader);
Reader* obtainReaderInternal(Client*) override;
const char* debugName() const override { return "ReadableStreamDataConsumerHandle"; }

Powered by Google App Engine
This is Rietveld 408576698