Better constructors for hidl_memory. am: 3f8c416406
am: ee276fc8b6
Change-Id: If353365e6eeaea7a4c3ec1266e45a4ebbfd1ea19
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index 78e0867..2be97c2 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -208,6 +208,13 @@
}
/**
+ * Creates a hidl_memory object whose handle has the same lifetime
+ * as the handle moved into it.
+ */
+ hidl_memory(const hidl_string& name, hidl_handle&& handle, size_t size)
+ : mHandle(std::move(handle)), mSize(size), mName(name) {}
+
+ /**
* Creates a hidl_memory object, but doesn't take ownership of
* the passed in native_handle_t; callers are responsible for
* making sure the handle remains valid while this object is