Pre-cache local matrix type in shader constructor.
authormtklein <mtklein@chromium.org>
Mon, 1 Dec 2014 20:06:24 +0000 (12:06 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 1 Dec 2014 20:06:24 +0000 (12:06 -0800)
TSAN points out we race when choosing our blitter without this.

BUG=437511

Review URL: https://codereview.chromium.org/773563002

src/core/SkShader.cpp

index 816d6fd..9c2fc2f 100644 (file)
@@ -44,6 +44,8 @@ SkShader::SkShader(const SkMatrix* localMatrix) {
     } else {
         fLocalMatrix.reset();
     }
+    // Pre-cache so future calls to fLocalMatrix.getType() are threadsafe.
+    (void)fLocalMatrix.getType();
 }
 
 SkShader::~SkShader() {