From 2cf1995d3d1cdca8e0ba2d8fab9a322c4096f809 Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Mon, 11 Apr 2016 11:09:37 -0700 Subject: libbinder: Replace ScopedFd with base::unique_fd unique_fd is a more canonical construct going forward. Bug: 27804373 Test: checkbuilds pass on aosp x86_64-eng Change-Id: I53eca34c0f4fd00be770a6898ff06ec2e98b9c8e --- include/binder/Parcel.h | 13 ++++++------- libs/binder/Parcel.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 7ca5d8b0f2..97a3376c81 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -187,14 +186,14 @@ public: // semantics of the smart file descriptor. A new descriptor will be // created, and will be closed when the parcel is destroyed. status_t writeUniqueFileDescriptor( - const ScopedFd& fd); + const base::unique_fd& fd); // Place a vector of file desciptors into the parcel. Each descriptor is // dup'd as in writeDupFileDescriptor status_t writeUniqueFileDescriptorVector( - const std::unique_ptr>& val); + const std::unique_ptr>& val); status_t writeUniqueFileDescriptorVector( - const std::vector& val); + const std::vector& val); // Writes a blob to the parcel. // If the blob is small, then it is stored in-place, otherwise it is @@ -325,14 +324,14 @@ public: // Retrieve a smart file descriptor from the parcel. status_t readUniqueFileDescriptor( - ScopedFd* val) const; + base::unique_fd* val) const; // Retrieve a vector of smart file descriptors from the parcel. status_t readUniqueFileDescriptorVector( - std::unique_ptr>* val) const; + std::unique_ptr>* val) const; status_t readUniqueFileDescriptorVector( - std::vector* val) const; + std::vector* val) const; // Reads a blob from the parcel. // The caller should call release() on the blob after reading its contents. diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 1ecc5cef35..6fd6ddc073 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -1184,15 +1184,15 @@ status_t Parcel::writeDupFileDescriptor(int fd) return err; } -status_t Parcel::writeUniqueFileDescriptor(const ScopedFd& fd) { +status_t Parcel::writeUniqueFileDescriptor(const base::unique_fd& fd) { return writeDupFileDescriptor(fd.get()); } -status_t Parcel::writeUniqueFileDescriptorVector(const std::vector& val) { +status_t Parcel::writeUniqueFileDescriptorVector(const std::vector& val) { return writeTypedVector(val, &Parcel::writeUniqueFileDescriptor); } -status_t Parcel::writeUniqueFileDescriptorVector(const std::unique_ptr>& val) { +status_t Parcel::writeUniqueFileDescriptorVector(const std::unique_ptr>& val) { return writeNullableTypedVector(val, &Parcel::writeUniqueFileDescriptor); } @@ -1992,7 +1992,7 @@ int Parcel::readFileDescriptor() const return BAD_TYPE; } -status_t Parcel::readUniqueFileDescriptor(ScopedFd* val) const +status_t Parcel::readUniqueFileDescriptor(base::unique_fd* val) const { int got = readFileDescriptor(); @@ -2010,11 +2010,11 @@ status_t Parcel::readUniqueFileDescriptor(ScopedFd* val) const } -status_t Parcel::readUniqueFileDescriptorVector(std::unique_ptr>* val) const { +status_t Parcel::readUniqueFileDescriptorVector(std::unique_ptr>* val) const { return readNullableTypedVector(val, &Parcel::readUniqueFileDescriptor); } -status_t Parcel::readUniqueFileDescriptorVector(std::vector* val) const { +status_t Parcel::readUniqueFileDescriptorVector(std::vector* val) const { return readTypedVector(val, &Parcel::readUniqueFileDescriptor); } -- cgit v1.2.3-59-g8ed1b