Better constructors for hidl_memory. am: 3f8c416406 am: ee276fc8b6
am: c77f5b1a77

Change-Id: I2ecc6c8a44c862cf3e287d99c3d0f1a3c296f1af
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