forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transaction_data_from_driver.h
58 lines (46 loc) · 1.83 KB
/
transaction_data_from_driver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_
#define CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_
#include <stddef.h>
#include <stdint.h>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "chromeos/binder/binder_driver_api.h"
#include "chromeos/binder/transaction_data.h"
#include "chromeos/chromeos_export.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace binder {
// TransactionData passed by the driver, whose data needs to be freed with
// BC_FREE_BUFFER command.
class CHROMEOS_EXPORT TransactionDataFromDriver : public TransactionData {
public:
typedef base::Callback<void(const void* ptr)> BufferDeleter;
explicit TransactionDataFromDriver(const BufferDeleter& buffer_deleter);
~TransactionDataFromDriver() override;
const binder_transaction_data& data() const { return data_; }
binder_transaction_data* mutable_data() { return &data_; }
// TransactionData override:
uintptr_t GetCookie() const override;
uint32_t GetCode() const override;
pid_t GetSenderPID() const override;
uid_t GetSenderEUID() const override;
bool IsOneWay() const override;
bool HasStatus() const override;
Status GetStatus() const override;
const void* GetData() const override;
size_t GetDataSize() const override;
const binder_uintptr_t* GetObjectOffsets() const override;
size_t GetNumObjectOffsets() const override;
private:
scoped_refptr<base::SingleThreadTaskRunner> delete_task_runner_;
BufferDeleter buffer_deleter_;
binder_transaction_data data_;
DISALLOW_COPY_AND_ASSIGN(TransactionDataFromDriver);
};
} // namespace binder
#endif // CHROMEOS_BINDER_TRANSACTION_DATA_FROM_DRIVER_H_