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

Side by Side Diff: mojo/data_pipe_utils/data_pipe_drainer.h

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « mojo/data_pipe_utils/BUILD.gn ('k') | mojo/data_pipe_utils/data_pipe_drainer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_DATA_PIPE_UTILS_DATA_PIPE_DRAINER_H_
6 #define MOJO_DATA_PIPE_UTILS_DATA_PIPE_DRAINER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "mojo/message_pump/handle_watcher.h"
11 #include "mojo/public/cpp/system/data_pipe.h"
12
13 namespace mojo {
14 namespace common {
15
16 class DataPipeDrainer {
17 public:
18 class Client {
19 public:
20 virtual void OnDataAvailable(const void* data, size_t num_bytes) = 0;
21 virtual void OnDataComplete() = 0;
22
23 protected:
24 virtual ~Client() {}
25 };
26
27 DataPipeDrainer(Client*, mojo::ScopedDataPipeConsumerHandle source);
28 ~DataPipeDrainer();
29
30 private:
31 void ReadData();
32 void WaitForData();
33 void WaitComplete(MojoResult result);
34
35 Client* client_;
36 mojo::ScopedDataPipeConsumerHandle source_;
37 mojo::common::HandleWatcher handle_watcher_;
38
39 base::WeakPtrFactory<DataPipeDrainer> weak_factory_;
40
41 DISALLOW_COPY_AND_ASSIGN(DataPipeDrainer);
42 };
43
44 } // namespace common
45 } // namespace mojo
46
47 #endif // MOJO_DATA_PIPE_UTILS_DATA_PIPE_DRAINER_H_
OLDNEW
« no previous file with comments | « mojo/data_pipe_utils/BUILD.gn ('k') | mojo/data_pipe_utils/data_pipe_drainer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698