From f58ef99a152b54ec2a651c94ec272e0623e80885 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Fri, 13 Jan 2023 18:30:21 +0000 Subject: [PATCH] Use std::move() for rvalues in SerialMap and SerialQueue Change-Id: Iddaf8227cb76b823107997a740eb7563268ff859 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116925 Commit-Queue: Peng Huang Reviewed-by: Austin Eng Auto-Submit: Peng Huang Kokoro: Kokoro --- src/dawn/common/SerialMap.h | 7 ++++--- src/dawn/common/SerialQueue.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dawn/common/SerialMap.h b/src/dawn/common/SerialMap.h index cd26099c5a..6ada5d997d 100644 --- a/src/dawn/common/SerialMap.h +++ b/src/dawn/common/SerialMap.h @@ -16,6 +16,7 @@ #define SRC_DAWN_COMMON_SERIALMAP_H_ #include +#include #include #include "dawn/common/SerialStorage.h" @@ -54,7 +55,7 @@ void SerialMap::Enqueue(const Value& value, Serial serial) { template void SerialMap::Enqueue(Value&& value, Serial serial) { - this->mStorage[serial].emplace_back(value); + this->mStorage[serial].emplace_back(std::move(value)); } template @@ -68,8 +69,8 @@ void SerialMap::Enqueue(const std::vector& values, Serial template void SerialMap::Enqueue(std::vector&& values, Serial serial) { DAWN_ASSERT(values.size() > 0); - for (const Value& value : values) { - Enqueue(value, serial); + for (Value& value : values) { + Enqueue(std::move(value), serial); } } diff --git a/src/dawn/common/SerialQueue.h b/src/dawn/common/SerialQueue.h index d3d4f4feb5..378952e6c9 100644 --- a/src/dawn/common/SerialQueue.h +++ b/src/dawn/common/SerialQueue.h @@ -80,7 +80,7 @@ template void SerialQueue::Enqueue(std::vector&& values, Serial serial) { DAWN_ASSERT(values.size() > 0); DAWN_ASSERT(this->Empty() || this->mStorage.back().first <= serial); - this->mStorage.emplace_back(serial, values); + this->mStorage.emplace_back(serial, std::move(values)); } #endif // SRC_DAWN_COMMON_SERIALQUEUE_H_