OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_BINDER_COMMAND_BROKER_H_ | 5 #ifndef CHROMEOS_BINDER_COMMAND_BROKER_H_ |
6 #define CHROMEOS_BINDER_COMMAND_BROKER_H_ | 6 #define CHROMEOS_BINDER_COMMAND_BROKER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <utility> | 10 #include <utility> |
9 | 11 |
10 #include "base/basictypes.h" | |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
14 #include "chromeos/binder/command_stream.h" | 15 #include "chromeos/binder/command_stream.h" |
15 #include "chromeos/chromeos_export.h" | 16 #include "chromeos/chromeos_export.h" |
16 | 17 |
17 namespace binder { | 18 namespace binder { |
18 | 19 |
19 class Driver; | 20 class Driver; |
20 class TransactionData; | 21 class TransactionData; |
21 | 22 |
22 // Issues appropriate outgoing commands to perform required tasks, and | 23 // Issues appropriate outgoing commands to perform required tasks, and |
23 // dispatches incoming commands to appropriate objects. | 24 // dispatches incoming commands to appropriate objects. |
24 // Usually this class lives as long as the corresponding thread. | 25 // Usually this class lives as long as the corresponding thread. |
25 // TODO(hashimoto): Add code to handle incoming commands (e.g. transactions). | 26 // TODO(hashimoto): Add code to handle incoming commands (e.g. transactions). |
26 class CHROMEOS_EXPORT CommandBroker | 27 class CHROMEOS_EXPORT CommandBroker |
27 : public CommandStream::IncomingCommandHandler { | 28 : public CommandStream::IncomingCommandHandler { |
28 public: | 29 public: |
29 explicit CommandBroker(Driver* driver); | 30 explicit CommandBroker(Driver* driver); |
30 ~CommandBroker() override; | 31 ~CommandBroker() override; |
31 | 32 |
32 // Performs transaction with the remote object specified by the handle. | 33 // Performs transaction with the remote object specified by the handle. |
33 // Returns true on success. If not one-way transaction, this method blocks | 34 // Returns true on success. If not one-way transaction, this method blocks |
34 // until the target object sends a reply. | 35 // until the target object sends a reply. |
35 bool Transact(int32 handle, | 36 bool Transact(int32_t handle, |
36 const TransactionData& request, | 37 const TransactionData& request, |
37 scoped_ptr<TransactionData>* reply); | 38 scoped_ptr<TransactionData>* reply); |
38 | 39 |
39 // CommandStream::IncomingCommandHandler override: | 40 // CommandStream::IncomingCommandHandler override: |
40 void OnReply(scoped_ptr<TransactionData> data) override; | 41 void OnReply(scoped_ptr<TransactionData> data) override; |
41 void OnDeadReply() override; | 42 void OnDeadReply() override; |
42 void OnTransactionComplete() override; | 43 void OnTransactionComplete() override; |
43 void OnFailedReply() override; | 44 void OnFailedReply() override; |
44 | 45 |
45 private: | 46 private: |
(...skipping 13 matching lines...) Expand all Loading... |
59 | 60 |
60 ResponseType response_type_ = RESPONSE_TYPE_NONE; | 61 ResponseType response_type_ = RESPONSE_TYPE_NONE; |
61 scoped_ptr<TransactionData> response_data_; | 62 scoped_ptr<TransactionData> response_data_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(CommandBroker); | 64 DISALLOW_COPY_AND_ASSIGN(CommandBroker); |
64 }; | 65 }; |
65 | 66 |
66 } // namespace binder | 67 } // namespace binder |
67 | 68 |
68 #endif // CHROMEOS_BINDER_COMMAND_BROKER_H_ | 69 #endif // CHROMEOS_BINDER_COMMAND_BROKER_H_ |
OLD | NEW |