Add some move constructors and assignment operators to CameraMetadata.
This avoids unnecessary copying of camera metadata which can get
expensive in cases of large camera metadata blobs.
Bug: 71727540
Test: GCA (sanity)
Test: Add CallStack::logStack() in CameraMetadata's move asignment
operator -> see that it gets called for every insertResultLocked.
Change-Id: I6c75c7ce5267126916c865b028e5f7c7f50b763b
Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
diff --git a/camera/CaptureResult.cpp b/camera/CaptureResult.cpp
index 1d8e8c4..9cbfdb0 100644
--- a/camera/CaptureResult.cpp
+++ b/camera/CaptureResult.cpp
@@ -117,6 +117,12 @@
mMetadata(), mResultExtras() {
}
+CaptureResult::CaptureResult(CaptureResult &&otherResult) {
+ mMetadata = std::move(otherResult.mMetadata);
+ mResultExtras = otherResult.mResultExtras;
+ mPhysicalMetadatas = std::move(otherResult.mPhysicalMetadatas);
+}
+
CaptureResult::CaptureResult(const CaptureResult &otherResult) {
mResultExtras = otherResult.mResultExtras;
mMetadata = otherResult.mMetadata;