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

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

Issue 2046203003: [Fetch API] Introduce BytesConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BytesConsumerForDataConsumerHandle_h
6 #define BytesConsumerForDataConsumerHandle_h
7
8 #include "modules/ModulesExport.h"
9 #include "modules/fetch/BytesConsumer.h"
10 #include "modules/fetch/FetchFormDataConsumerHandle.h"
11 #include "platform/heap/Handle.h"
12 #include "public/platform/WebDataConsumerHandle.h"
13 #include "wtf/PassRefPtr.h"
14 #include "wtf/text/WTFString.h"
15
16 #include <memory>
17
18 namespace blink {
19
20 class MODULES_EXPORT BytesConsumerForDataConsumerHandle : public BytesConsumer, public WebDataConsumerHandle::Client {
hiroshige 2016/07/26 06:48:12 Add |final|.
yhirano 2016/07/27 13:19:52 Done.
21 EAGERLY_FINALIZE();
22 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW();
23 public:
24 explicit BytesConsumerForDataConsumerHandle(std::unique_ptr<FetchDataConsume rHandle>);
25 ~BytesConsumerForDataConsumerHandle() override;
26
27 Result read(char* buffer, size_t /* size */, size_t* readSize) override;
28 Result beginRead(const char** buffer, size_t* available) override;
29 PassRefPtr<BlobDataHandle> drainAsBlobDataHandle(BlobSizePolicy) override;
30 PassRefPtr<EncodedFormData> drainAsFormData() override;
31 Result endRead(size_t readSize) override;
32 void setClient(BytesConsumer::Client*) override;
33 void clearClient() override;
34
35 void cancel() override;
36 PublicState getPublicState() const override;
37 Error getError() const override { return m_error; }
hiroshige 2016/07/26 06:48:12 How about inserting DCHECK(m_state == InternalStat
yhirano 2016/07/27 13:19:52 Done.
38 String debugName() const override { return "BytesConsumerForDataConsumerHand le"; }
39
40 // WebDataConsumerHandle::Client
41 void didGetReadable() override;
42
43 DECLARE_TRACE();
44
45 private:
46 void close();
47 void error();
48
49 std::unique_ptr<FetchDataConsumerHandle::Reader> m_reader;
50 Member<BytesConsumer::Client> m_client;
51 InternalState m_state = InternalState::Waiting;
52 Error m_error;
53 };
54
55 } // namespace blink
56
57 #endif // BytesConsumerForDataConsumerHandle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698