Annotate benign race on SkPath::fConvexity.
authorMike Klein <mtklein@chromium.org>
Thu, 10 Nov 2016 23:09:51 +0000 (18:09 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 10 Nov 2016 23:52:52 +0000 (23:52 +0000)
We're tired of this making our TSAN bot flaky, and equally tired of trying to fix it.

BUG=skia:5776

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4691

Change-Id: Ib6005282c514a6d785fd4fffe5387cbb1caccbe1
Reviewed-on: https://skia-review.googlesource.com/4691
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
src/core/SkPath.cpp
src/core/SkTSAN.h [new file with mode: 0644]

index 8241c10f8ed5a245fa5166406e1b77a0d67b2d95..6e201bd2048400e3a197cc0b08bcb6eca9f8a635 100644 (file)
@@ -13,6 +13,7 @@
 #include "SkPathPriv.h"
 #include "SkPathRef.h"
 #include "SkRRect.h"
+#include "SkTSAN.h"
 
 ////////////////////////////////////////////////////////////////////////////
 
@@ -128,6 +129,8 @@ SkPath::SkPath()
     : fPathRef(SkPathRef::CreateEmpty()) {
     this->resetFields();
     fIsVolatile = false;
+    AnnotateBenignRaceSized(__FILE__, __LINE__, &fConvexity, sizeof(fConvexity),
+                            "We've tried a few times to make this thread safe, and failed.");
 }
 
 void SkPath::resetFields() {
diff --git a/src/core/SkTSAN.h b/src/core/SkTSAN.h
new file mode 100644 (file)
index 0000000..8e00b9f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTSAN_DEFINED
+#define SkTSAN_DEFINED
+
+#if !defined(__has_feature)
+    #define __has_feature(x) 0
+#endif
+
+#if __has_feature(thread_sanitizer)
+    extern "C" void AnnotateBenignRaceSized(const char* file, int line,
+                                            const volatile void* ptr, long size,
+                                            const char* desc);
+#else
+    static inline void AnnotateBenignRaceSized(const char* file, int line,
+                                               const volatile void* ptr, long size,
+                                               const char* desc) {}
+#endif
+
+
+#endif//SkTSAN_DEFINED