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_TRANSACTION_DATA_FROM_DRIVER_H_ | 5 #ifndef CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_ |
6 #define CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_ | 6 #define CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_ |
7 | 7 |
| 8 #include <linux/android/binder.h> |
| 9 #include <stddef.h> |
| 10 #include <stdint.h> |
8 #include <unistd.h> | 11 #include <unistd.h> |
9 #include <linux/android/binder.h> | |
10 | 12 |
11 #include "base/callback.h" | 13 #include "base/callback.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
14 #include "chromeos/binder/transaction_data.h" | 16 #include "chromeos/binder/transaction_data.h" |
15 #include "chromeos/chromeos_export.h" | 17 #include "chromeos/chromeos_export.h" |
16 | 18 |
17 namespace base { | 19 namespace base { |
18 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
19 } | 21 } |
20 | 22 |
21 namespace binder { | 23 namespace binder { |
22 | 24 |
23 // TransactionData passed by the driver, whose data needs to be freed with | 25 // TransactionData passed by the driver, whose data needs to be freed with |
24 // BC_FREE_BUFFER command. | 26 // BC_FREE_BUFFER command. |
25 class CHROMEOS_EXPORT TransactionDataFromDriver : public TransactionData { | 27 class CHROMEOS_EXPORT TransactionDataFromDriver : public TransactionData { |
26 public: | 28 public: |
27 typedef base::Callback<void(const void* ptr)> BufferDeleter; | 29 typedef base::Callback<void(const void* ptr)> BufferDeleter; |
28 explicit TransactionDataFromDriver(const BufferDeleter& buffer_deleter); | 30 explicit TransactionDataFromDriver(const BufferDeleter& buffer_deleter); |
29 ~TransactionDataFromDriver() override; | 31 ~TransactionDataFromDriver() override; |
30 | 32 |
31 const binder_transaction_data& data() const { return data_; } | 33 const binder_transaction_data& data() const { return data_; } |
32 binder_transaction_data* mutable_data() { return &data_; } | 34 binder_transaction_data* mutable_data() { return &data_; } |
33 | 35 |
34 // TransactionData override: | 36 // TransactionData override: |
35 uintptr_t GetCookie() const override; | 37 uintptr_t GetCookie() const override; |
36 uint32 GetCode() const override; | 38 uint32_t GetCode() const override; |
37 pid_t GetSenderPID() const override; | 39 pid_t GetSenderPID() const override; |
38 uid_t GetSenderEUID() const override; | 40 uid_t GetSenderEUID() const override; |
39 bool IsOneWay() const override; | 41 bool IsOneWay() const override; |
40 bool HasStatus() const override; | 42 bool HasStatus() const override; |
41 Status GetStatus() const override; | 43 Status GetStatus() const override; |
42 const void* GetData() const override; | 44 const void* GetData() const override; |
43 size_t GetDataSize() const override; | 45 size_t GetDataSize() const override; |
44 const uintptr_t* GetObjectOffsets() const override; | 46 const uintptr_t* GetObjectOffsets() const override; |
45 size_t GetNumObjectOffsets() const override; | 47 size_t GetNumObjectOffsets() const override; |
46 | 48 |
47 private: | 49 private: |
48 scoped_refptr<base::SingleThreadTaskRunner> delete_task_runner_; | 50 scoped_refptr<base::SingleThreadTaskRunner> delete_task_runner_; |
49 BufferDeleter buffer_deleter_; | 51 BufferDeleter buffer_deleter_; |
50 binder_transaction_data data_; | 52 binder_transaction_data data_; |
51 | 53 |
52 DISALLOW_COPY_AND_ASSIGN(TransactionDataFromDriver); | 54 DISALLOW_COPY_AND_ASSIGN(TransactionDataFromDriver); |
53 }; | 55 }; |
54 | 56 |
55 } // namespace binder | 57 } // namespace binder |
56 | 58 |
57 #endif // CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_ | 59 #endif // CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_ |
OLD | NEW |