skia2/tools/RefCntIs.cpp
mtklein 4ae94ffce5 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
2014-07-08 06:48:17 -07:00

10 lines
195 B
C++

#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;
}