aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-07-08 06:48:17 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-08 06:48:17 -0700
commit4ae94ffce5ecf1b71cb5e295b68bf4ec9e697443 (patch)
tree6c734cf27a2f033bfb5f512420860fd035d0bbfa /tools
parent3afef1f75f710b8f183113cdc5188416f7d01f28 (diff)
Remove ability for Release code to call getRefCnt() or getWeakRefCnt().
These getRefCnt() methods are not thread safe, so Skia code should not be calling them. unique() is fine. SkDEBUG code (SkASSERTs) can still call getRefCnt() / getWeakRefCnt(). This adds tools/RefCntIs.{h,cpp}, which lets tests make their assertions in both debug and release modes. BUG=skia:2726 R=senorblanco@chromium.org, mtklein@google.com, reed@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/378643003
Diffstat (limited to 'tools')
-rw-r--r--tools/RefCntIs.cpp9
-rw-r--r--tools/RefCntIs.h13
-rw-r--r--tools/tsan.supp3
3 files changed, 22 insertions, 3 deletions
diff --git a/tools/RefCntIs.cpp b/tools/RefCntIs.cpp
new file mode 100644
index 0000000000..48154b045c
--- /dev/null
+++ b/tools/RefCntIs.cpp
@@ -0,0 +1,9 @@
+#include "RefCntIs.h"
+
+bool RefCntIs(const SkRefCntBase& obj, int32_t n) {
+ return obj.fRefCnt == n;
+}
+
+bool WeakRefCntIs(const SkWeakRefCnt& obj, int32_t n) {
+ return obj.fWeakCnt == n;
+}
diff --git a/tools/RefCntIs.h b/tools/RefCntIs.h
new file mode 100644
index 0000000000..86d3cc3e12
--- /dev/null
+++ b/tools/RefCntIs.h
@@ -0,0 +1,13 @@
+#ifndef RefCntIs_DEFINED
+#define RefCntIs_DEFINED
+
+// Allows tests to assert a particular value for a ref count,
+// without letting Skia library code look at that value.
+
+#include "SkRefCnt.h"
+#include "SkWeakRefCnt.h"
+
+bool RefCntIs(const SkRefCntBase&, int32_t);
+bool WeakRefCntIs(const SkWeakRefCnt&, int32_t);
+
+#endif//RefCntIs_DEFINED
diff --git a/tools/tsan.supp b/tools/tsan.supp
index 179adc9b4a..6c2b0909fc 100644
--- a/tools/tsan.supp
+++ b/tools/tsan.supp
@@ -31,9 +31,6 @@ race:SkPDF
race:SkPixelRef::callGenIDChangeListeners
race:SkPixelRef::needsNewGenID
-# This calls SkRefCnt::getRefCnt(), which is not thread safe. skia:2726
-race:SkImageFilter::filterImage
-
# SkPathRef caches its bounding box the first time it's needed.
# This will be fixed naturally once we create (from a single thread) a
# bounding-box hierarchy for SkRecord-based SkPictures; all bounds will come pre-cached.