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

Side by Side Diff: Source/modules/fetch/CompositeDataConsumerHandle.h

Issue 1162043007: Introduce CompositeDataConsumerHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 CompositeDataConsumerHandle_h
6 #define CompositeDataConsumerHandle_h
7
8 #include "public/platform/WebDataConsumerHandle.h"
9 #include "wtf/OwnPtr.h"
10 #include "wtf/PassOwnPtr.h"
11 #include "wtf/RefPtr.h"
12
13 namespace blink {
14
15 // This is a utility class to construct a composite data consumer handle. It
16 // owns a web data consumer handle and delegates methods. A user can update
17 // the handle by using |update| method.
18 class CompositeDataConsumerHandle final : public WebDataConsumerHandle {
19 public:
20 // |handle| must not be locked.
hiroshige 2015/06/09 05:37:16 Also |handle| must be non-null (according to the c
yhirano 2015/06/09 06:30:52 Done, though I'm not sure if we should always writ
21 static PassOwnPtr<CompositeDataConsumerHandle> create(PassOwnPtr<WebDataCons umerHandle> handle)
22 {
23 return adoptPtr(new CompositeDataConsumerHandle(handle));
24 }
25 ~CompositeDataConsumerHandle() override;
26
27 // This function should be called on the thread on which this object
28 // was created. |handle| must not be locked.
hiroshige 2015/06/09 05:37:16 ditto.
yhirano 2015/06/09 06:30:52 Done.
29 void update(PassOwnPtr<WebDataConsumerHandle> /* handle */);
30
31 // Utility static methods each of which provides a "basic block" of
32 // a CompositeDataConsumerHandle. For example, a user can create
33 // a CompositeDataConsumerHandle with a "waiting" handle to provide
34 // WebDataConsumerHandle APIs while waiting for another handle. When that
35 // handle arrives, the user will use |update| to replace the "waiting"
36 // handle with the arrived one.
37 //
38 // Returns a handle that returns ShouldWait for read / beginRead / endRead
hiroshige 2015/06/09 05:37:16 Actually this returns UnexpectedError for endRead.
yhirano 2015/06/09 06:30:52 Done.
39 // operations.
40 static PassOwnPtr<WebDataConsumerHandle> createWaitingHandle();
41
42 // Returns a handle that returns Done for read / beginRead / endRead
hiroshige 2015/06/09 05:37:16 ditto.
yhirano 2015/06/09 06:30:52 Done.
43 // operations.
44 static PassOwnPtr<WebDataConsumerHandle> createDoneHandle();
45
46 private:
47 class Context;
48 class ReaderImpl;
49 Reader* obtainReaderInternal(Client*) override;
50
51 explicit CompositeDataConsumerHandle(PassOwnPtr<WebDataConsumerHandle>);
hiroshige 2015/06/09 05:37:16 The handle must be non-null?
yhirano 2015/06/09 06:30:52 I don't want to write comments because this is a p
52
53 RefPtr<Context> m_context;
54 };
55
56 } // namespace blink
57
58 #endif // CompositeDataConsumerHandle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698