summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2018-10-08 18:13:39 +0900
committerJiyong Park <jiyong@google.com>2018-10-10 11:45:54 +0900
commit08c2ddb3dbe12f1d2b9200d6d6f4bd9d19df2062 (patch)
tree1171609b808bdf3f9fa1de2a48c54f037774a30d
parent562d525c2ab1dfc12d05694175634f047242a2d7 (diff)
downloadnative-08c2ddb3dbe12f1d2b9200d6d6f4bd9d19df2062.tar.gz
ParcelFileDescriptor is movable
Add a move constructor to ParcelFileDescriptor. This is required to be able to something like vector<ParcelFileDescriptor> fds; fds.push_back(ParcelFileDescriptor(std::move(unique_fd(open("some_file"))))); Bug: 115607973 Test: system/tools/aidl/runtests.sh Change-Id: If8186500b528984c3718310c37694a3936905dfb
-rw-r--r--libs/binder/include/binder/ParcelFileDescriptor.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/libs/binder/include/binder/ParcelFileDescriptor.h b/libs/binder/include/binder/ParcelFileDescriptor.h
index 455462b18f..ad950affc5 100644
--- a/libs/binder/include/binder/ParcelFileDescriptor.h
+++ b/libs/binder/include/binder/ParcelFileDescriptor.h
@@ -31,6 +31,7 @@ class ParcelFileDescriptor : public android::Parcelable {
public:
ParcelFileDescriptor();
explicit ParcelFileDescriptor(android::base::unique_fd fd);
+ explicit ParcelFileDescriptor(ParcelFileDescriptor&& other) : mFd(std::move(other.mFd)) { }
~ParcelFileDescriptor() override;
int get() const { return mFd.get(); }