Update DataEntry struct to properly support move semantics.

Previously, DataEntry supported only move-construction but not move-
assignment.

Change-Id: I1dc1b2bc90a3dfe4cd74d4a6c2986b7d777f84d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306156
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2020-07-27 17:47:18 -04:00 committed by Skia Commit-Bot
parent 45f5b031b3
commit 738c271b4a

View File

@ -68,16 +68,20 @@ private:
uint32_t fTtcIndex; // key2
SkTypeface* fTypeface; // value: weak ref to typeface
DataEntry() { }
DataEntry() = default;
DataEntry(DataEntry&& that)
: fDataId(that.fDataId)
, fTtcIndex(that.fTtcIndex)
, fTypeface(that.fTypeface)
{
SkDEBUGCODE(that.fDataId = SkFontIdentity::kInvalidDataId;)
SkDEBUGCODE(that.fTtcIndex = 0xbbadbeef;)
that.fTypeface = nullptr;
DataEntry(DataEntry&& that) { *this = std::move(that); }
DataEntry& operator=(DataEntry&& that) {
if (this != &that) {
fDataId = that.fDataId;
fTtcIndex = that.fTtcIndex;
fTypeface = that.fTypeface;
SkDEBUGCODE(that.fDataId = SkFontIdentity::kInvalidDataId;)
SkDEBUGCODE(that.fTtcIndex = 0xbbadbeef;)
that.fTypeface = nullptr;
}
return *this;
}
~DataEntry() {