Force SkPath::getConvexity() cache for thread safety.
I happened to stumble on this in a run of TSAN: https://luci-milo.appspot.com/swarming/task/30fffe9497dc6310/steps/dm/0/stdout BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2300003003 Review-Url: https://codereview.chromium.org/2300003003
This commit is contained in:
parent
07f0446e9a
commit
d0634eeb56
@ -43,7 +43,10 @@ static D* pod(T* op, size_t offset = 0) {
|
|||||||
|
|
||||||
// Pre-cache lazy non-threadsafe fields on SkPath and/or SkMatrix.
|
// Pre-cache lazy non-threadsafe fields on SkPath and/or SkMatrix.
|
||||||
static void make_threadsafe(SkPath* path, SkMatrix* matrix) {
|
static void make_threadsafe(SkPath* path, SkMatrix* matrix) {
|
||||||
if (path) { path->updateBoundsCache(); }
|
if (path) {
|
||||||
|
path->updateBoundsCache();
|
||||||
|
(void)path->getConvexity();
|
||||||
|
}
|
||||||
if (matrix) { (void)matrix->getType(); }
|
if (matrix) { (void)matrix->getType(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
namespace SkRecords {
|
namespace SkRecords {
|
||||||
PreCachedPath::PreCachedPath(const SkPath& path) : SkPath(path) {
|
PreCachedPath::PreCachedPath(const SkPath& path) : SkPath(path) {
|
||||||
this->updateBoundsCache();
|
this->updateBoundsCache();
|
||||||
|
(void)this->getConvexity();
|
||||||
#if 0 // Disabled to see if we ever really race on this. It costs time, chromium:496982.
|
#if 0 // Disabled to see if we ever really race on this. It costs time, chromium:496982.
|
||||||
SkPathPriv::FirstDirection junk;
|
SkPathPriv::FirstDirection junk;
|
||||||
(void)SkPathPriv::CheapComputeFirstDirection(*this, &junk);
|
(void)SkPathPriv::CheapComputeFirstDirection(*this, &junk);
|
||||||
|
Loading…
Reference in New Issue
Block a user