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

Side by Side Diff: content/child/body_consumer.h

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 CONTENT_CHILD_BODY_CONSUMER_H_
6 #define CONTENT_CHILD_BODY_CONSUMER_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <utility>
12 #include <vector>
13
14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h"
16 #include "content/common/url_loader.mojom.h"
17 #include "mojo/message_pump/handle_watcher.h"
18 #include "mojo/public/cpp/system/data_pipe.h"
19
20 namespace content {
21
22 class ResourceDispatcher;
23
24 class BodyConsumer final : public base::RefCounted<BodyConsumer> {
jam 2016/05/13 00:55:06 nit: please document this class and the methods
yhirano 2016/05/17 12:38:49 Done.
25 public:
26 BodyConsumer(int request_id,
27 ResourceDispatcher* resource_dispatcher,
28 mojo::ScopedDataPipeConsumerHandle handle);
29
30 void OnComplete(mojom::URLLoaderStatusPtr status);
31 void Cancel();
32
33 private:
34 friend class base::RefCounted<BodyConsumer>;
35 ~BodyConsumer();
36
37 class ReceivedData;
38 void Reclaim(uint32_t size);
39
40 void OnReadable(MojoResult);
41 void StartWatching();
42 void NotifyCompletionIfAppropriate();
43
44 int request_id_;
45 ResourceDispatcher* resource_dispatcher_;
46 mojo::ScopedDataPipeConsumerHandle handle_;
47 mojo::common::HandleWatcher handle_watcher_;
48 mojom::URLLoaderStatusPtr completion_status_;
49
50 bool has_received_completion_ = false;
51 bool has_been_cancelled_ = false;
52 bool has_seen_end_of_data_;
53
54 DISALLOW_COPY_AND_ASSIGN(BodyConsumer);
55 };
56
57 } // namespace content
58
59 #endif // CONTENT_CHILD_BODY_CONSUMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698