blob: 23552d825d6b95669b039a0bb691e32b3e74a16f [file] [log] [blame]
// 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.
#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 {
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;
scoped_refptr<base::SingleThreadTaskRunner> delete_task_runner_;
BufferDeleter buffer_deleter_;
binder_transaction_data data_;
} // namespace binder