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
|
uint32_t fTtcIndex; // key2
|
||||||
SkTypeface* fTypeface; // value: weak ref to typeface
|
SkTypeface* fTypeface; // value: weak ref to typeface
|
||||||
|
|
||||||
DataEntry() { }
|
DataEntry() = default;
|
||||||
|
|
||||||
DataEntry(DataEntry&& that)
|
DataEntry(DataEntry&& that) { *this = std::move(that); }
|
||||||
: fDataId(that.fDataId)
|
DataEntry& operator=(DataEntry&& that) {
|
||||||
, fTtcIndex(that.fTtcIndex)
|
if (this != &that) {
|
||||||
, fTypeface(that.fTypeface)
|
fDataId = that.fDataId;
|
||||||
{
|
fTtcIndex = that.fTtcIndex;
|
||||||
SkDEBUGCODE(that.fDataId = SkFontIdentity::kInvalidDataId;)
|
fTypeface = that.fTypeface;
|
||||||
SkDEBUGCODE(that.fTtcIndex = 0xbbadbeef;)
|
|
||||||
that.fTypeface = nullptr;
|
SkDEBUGCODE(that.fDataId = SkFontIdentity::kInvalidDataId;)
|
||||||
|
SkDEBUGCODE(that.fTtcIndex = 0xbbadbeef;)
|
||||||
|
that.fTypeface = nullptr;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
~DataEntry() {
|
~DataEntry() {
|
||||||
|
Loading…
Reference in New Issue
Block a user