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:
parent
45f5b031b3
commit
738c271b4a
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user