First cut at minibind classes.
[minibind.git] / jni / minibind / channel.h
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 MINIBIND_CHANNEL_H_
6 #define MINIBIND_CHANNEL_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "parcel.h"
13
14 namespace minibind {
15
16 class Command;
17
18 class Channel {
19 public:
20 explicit Channel(uint32_t handle);
21 ~Channel();
22
23 void QueueCommand(Command* cmd);
24
25 int TransactCommands();
26
27 Parcel* reader() { return &reader_; }
28
29 uint32_t handle() const { return handle_; }
30 const std::vector<Command*>& write_commands() const { return write_commands_; }
31
32 private:
33 uint32_t handle_;
34 int driver_;
35
36 Parcel reader_;
37
38 size_t write_commands_size_;
39 std::vector<Command*> write_commands_;
40 };
41
42 } // namespace minibind
43
44 #endif // MINIBIND_CHANNEL_H_