| 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 #include "chromeos/binder/command_broker.h" | 5 #include "chromeos/binder/command_broker.h" |
| 6 | 6 |
| 7 #include <linux/android/binder.h> | 7 #include <linux/android/binder.h> |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 8 | 10 |
| 9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 10 #include "chromeos/binder/driver.h" | 12 #include "chromeos/binder/driver.h" |
| 11 #include "chromeos/binder/transaction_data.h" | 13 #include "chromeos/binder/transaction_data.h" |
| 12 | 14 |
| 13 namespace binder { | 15 namespace binder { |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| 17 // Converts TransactionData to binder_transaction_data struct. | 19 // Converts TransactionData to binder_transaction_data struct. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 } | 37 } |
| 36 | 38 |
| 37 } // namespace | 39 } // namespace |
| 38 | 40 |
| 39 CommandBroker::CommandBroker(Driver* driver) : command_stream_(driver, this) {} | 41 CommandBroker::CommandBroker(Driver* driver) : command_stream_(driver, this) {} |
| 40 | 42 |
| 41 CommandBroker::~CommandBroker() { | 43 CommandBroker::~CommandBroker() { |
| 42 DCHECK(thread_checker_.CalledOnValidThread()); | 44 DCHECK(thread_checker_.CalledOnValidThread()); |
| 43 } | 45 } |
| 44 | 46 |
| 45 bool CommandBroker::Transact(int32 handle, | 47 bool CommandBroker::Transact(int32_t handle, |
| 46 const TransactionData& request, | 48 const TransactionData& request, |
| 47 scoped_ptr<TransactionData>* reply) { | 49 scoped_ptr<TransactionData>* reply) { |
| 48 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
| 49 // Send transaction. | 51 // Send transaction. |
| 50 binder_transaction_data tr = ConvertTransactionDataToStruct(request); | 52 binder_transaction_data tr = ConvertTransactionDataToStruct(request); |
| 51 tr.target.handle = handle; | 53 tr.target.handle = handle; |
| 52 command_stream_.AppendOutgoingCommand(BC_TRANSACTION, &tr, sizeof(tr)); | 54 command_stream_.AppendOutgoingCommand(BC_TRANSACTION, &tr, sizeof(tr)); |
| 53 if (!command_stream_.Flush()) { | 55 if (!command_stream_.Flush()) { |
| 54 LOG(ERROR) << "Failed to write"; | 56 LOG(ERROR) << "Failed to write"; |
| 55 return false; | 57 return false; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 122 } |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 ResponseType response_type = response_type_; | 125 ResponseType response_type = response_type_; |
| 124 response_type_ = RESPONSE_TYPE_NONE; | 126 response_type_ = RESPONSE_TYPE_NONE; |
| 125 *data = response_data_.Pass(); | 127 *data = response_data_.Pass(); |
| 126 return response_type; | 128 return response_type; |
| 127 } | 129 } |
| 128 | 130 |
| 129 } // namespace binder | 131 } // namespace binder |
| OLD | NEW |