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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BodyStreamBuffer_h 5 #ifndef BodyStreamBuffer_h
6 #define BodyStreamBuffer_h 6 #define BodyStreamBuffer_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptValue.h" 9 #include "bindings/core/v8/ScriptValue.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
11 #include "core/streams/ReadableByteStream.h" 11 #include "core/streams/ReadableByteStream.h"
12 #include "core/streams/ReadableByteStreamReader.h" 12 #include "core/streams/ReadableByteStreamReader.h"
13 #include "core/streams/UnderlyingSource.h" 13 #include "core/streams/UnderlyingSource.h"
14 #include "core/streams/UnderlyingSourceBase.h" 14 #include "core/streams/UnderlyingSourceBase.h"
15 #include "modules/ModulesExport.h" 15 #include "modules/ModulesExport.h"
16 #include "modules/fetch/FetchDataConsumerHandle.h" 16 #include "modules/fetch/FetchDataConsumerHandle.h"
17 #include "modules/fetch/FetchDataLoader.h" 17 #include "modules/fetch/FetchDataLoader.h"
18 #include "platform/heap/Handle.h" 18 #include "platform/heap/Handle.h"
19 #include "public/platform/WebDataConsumerHandle.h" 19 #include "public/platform/WebDataConsumerHandle.h"
20 #include "wtf/OwnPtr.h" 20 #include <memory>
21 #include "wtf/PassOwnPtr.h"
22 21
23 namespace blink { 22 namespace blink {
24 23
25 class EncodedFormData; 24 class EncodedFormData;
26 class ScriptState; 25 class ScriptState;
27 26
28 class MODULES_EXPORT BodyStreamBuffer final : public UnderlyingSourceBase, publi c UnderlyingSource, public WebDataConsumerHandle::Client { 27 class MODULES_EXPORT BodyStreamBuffer final : public UnderlyingSourceBase, publi c UnderlyingSource, public WebDataConsumerHandle::Client {
29 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer); 28 WTF_MAKE_NONCOPYABLE(BodyStreamBuffer);
30 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer); 29 USING_GARBAGE_COLLECTED_MIXIN(BodyStreamBuffer);
31 public: 30 public:
32 // Needed because we have to release |m_reader| promptly. 31 // Needed because we have to release |m_reader| promptly.
33 EAGERLY_FINALIZE(); 32 EAGERLY_FINALIZE();
34 // |handle| cannot be null and cannot be locked. 33 // |handle| cannot be null and cannot be locked.
35 BodyStreamBuffer(ScriptState*, PassOwnPtr<FetchDataConsumerHandle> /* handle */); 34 BodyStreamBuffer(ScriptState*, std::unique_ptr<FetchDataConsumerHandle> /* h andle */);
36 // |ReadableStreamOperations::isReadableStream(stream)| must hold. 35 // |ReadableStreamOperations::isReadableStream(stream)| must hold.
37 BodyStreamBuffer(ScriptState*, ScriptValue stream); 36 BodyStreamBuffer(ScriptState*, ScriptValue stream);
38 37
39 ScriptValue stream(); 38 ScriptValue stream();
40 39
41 // Callable only when neither locked nor disturbed. 40 // Callable only when neither locked nor disturbed.
42 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re ader::BlobSizePolicy); 41 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(FetchDataConsumerHandle::Re ader::BlobSizePolicy);
43 PassRefPtr<EncodedFormData> drainAsFormData(); 42 PassRefPtr<EncodedFormData> drainAsFormData();
44 void startLoading(FetchDataLoader*, FetchDataLoader::Client* /* client */); 43 void startLoading(FetchDataLoader*, FetchDataLoader::Client* /* client */);
45 void tee(BodyStreamBuffer**, BodyStreamBuffer**); 44 void tee(BodyStreamBuffer**, BodyStreamBuffer**);
(...skipping 28 matching lines...) Expand all
74 } 73 }
75 74
76 private: 75 private:
77 class LoaderClient; 76 class LoaderClient;
78 77
79 void close(); 78 void close();
80 void error(); 79 void error();
81 void processData(); 80 void processData();
82 void endLoading(); 81 void endLoading();
83 void stopLoading(); 82 void stopLoading();
84 PassOwnPtr<FetchDataConsumerHandle> releaseHandle(); 83 std::unique_ptr<FetchDataConsumerHandle> releaseHandle();
85 84
86 RefPtr<ScriptState> m_scriptState; 85 RefPtr<ScriptState> m_scriptState;
87 OwnPtr<FetchDataConsumerHandle> m_handle; 86 std::unique_ptr<FetchDataConsumerHandle> m_handle;
88 OwnPtr<FetchDataConsumerHandle::Reader> m_reader; 87 std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader;
89 Member<ReadableByteStream> m_stream; 88 Member<ReadableByteStream> m_stream;
90 // We need this member to keep it alive while loading. 89 // We need this member to keep it alive while loading.
91 Member<FetchDataLoader> m_loader; 90 Member<FetchDataLoader> m_loader;
92 bool m_streamNeedsMore = false; 91 bool m_streamNeedsMore = false;
93 bool m_madeFromReadableStream; 92 bool m_madeFromReadableStream;
94 }; 93 };
95 94
96 } // namespace blink 95 } // namespace blink
97 96
98 #endif // BodyStreamBuffer_h 97 #endif // BodyStreamBuffer_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Body.cpp ('k') | third_party/WebKit/Source/modules/fetch/BodyStreamBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698