Reason for revert:
broken the Mac and Linux builders, e.g.:
https://build.chromium.org/p/chromium/builders/Mac/builds/15151
https://build.chromium.org/p/chromium/builders/Linux%20x64/builds/19052
Original issue's description:
> SK_DECLARE_STATIC_MUTEX -> static SkMutex
>
> There's no need to use a macro to declare static SkMutexes any more
> (and there's likewise no need to restrict them to global scope).
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=
1948193002
>
> Committed: https://skia.googlesource.com/skia/+/
5e56cfd3fa1041dbb83899844fb92fa9a2ef1009
TBR=mtklein@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/
1945353003
}
}
-static SkMutex gFailuresMutex;
+SK_DECLARE_STATIC_MUTEX(gFailuresMutex);
static SkTArray<SkString> gFailures;
static void fail(const SkString& err) {
namespace DM {
SkTArray<JsonWriter::BitmapResult> gBitmapResults;
-static SkMutex gBitmapResultLock;
+SK_DECLARE_STATIC_MUTEX(gBitmapResultLock);
void JsonWriter::AddBitmapResult(const BitmapResult& result) {
SkAutoMutexAcquire lock(&gBitmapResultLock);
}
SkTArray<skiatest::Failure> gFailures;
-static SkMutex gFailureLock;
+SK_DECLARE_STATIC_MUTEX(gFailureLock);
void JsonWriter::AddTestFailure(const skiatest::Failure& failure) {
SkAutoMutexAcquire lock(gFailureLock);
#include "../private/SkThreadID.h"
#include "SkTypes.h"
+// TODO: no need for this anymore.
+#define SK_DECLARE_STATIC_MUTEX(name) static SkMutex name;
+
class SkMutex {
public:
constexpr SkMutex() = default;
return new SkDeviceProfile(gammaExp, contrast, config, level);
}
-static SkMutex gMutex;
+SK_DECLARE_STATIC_MUTEX(gMutex);
static SkDeviceProfile* gDefaultProfile;
static SkDeviceProfile* gGlobalProfile;
* cachedMaskGamma the caller must hold the gMaskGammaCacheMutex and continue
* to hold it until the returned pointer is refed or forgotten.
*/
-static SkMutex gMaskGammaCacheMutex;
+SK_DECLARE_STATIC_MUTEX(gMaskGammaCacheMutex);
static SkMaskGamma* gLinearMaskGamma = nullptr;
static SkMaskGamma* gMaskGamma = nullptr;
///////////////////////////////////////////////////////////////////////////////
-static SkMutex gMutex;
+SK_DECLARE_STATIC_MUTEX(gMutex);
static SkResourceCache* gResourceCache = nullptr;
/** Must hold gMutex when calling. */
}
-static SkMutex gCreateDefaultMutex;
+SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex);
SkTypeface* SkTypeface::GetDefaultTypeface(Style style) {
static SkOnce once[4];
return sk_atomic_inc(&gFontID) + 1;
}
-static SkMutex gMutex;
+SK_DECLARE_STATIC_MUTEX(gMutex);
void SkTypefaceCache::Add(SkTypeface* face) {
SkAutoMutexAcquire ama(gMutex);
return fCache;
}
-static SkMutex gGradientCacheMutex;
+SK_DECLARE_STATIC_MUTEX(gGradientCacheMutex);
/*
* Because our caller might rebuild the same (logically the same) gradient
* over and over, we'd like to return exactly the same "bitmap" if possible,
#ifdef SK_DEBUG
#include "SkMutex.h"
-static SkMutex gUsedCharsMutex;
+SK_DECLARE_STATIC_MUTEX(gUsedCharsMutex);
#endif
return new DiscardableMemoryPool(size, mutex);
}
-static SkMutex gMutex;
+SK_DECLARE_STATIC_MUTEX(gMutex);
SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() {
static SkOnce once;
SkDebugf("}\n");
}
-static SkMutex gTestMutex;
+SK_DECLARE_STATIC_MUTEX(gTestMutex);
void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp,
const char* testName) {
}
if (spanBase->segment() != opp && spanBase->containsCoinEnd(opp)) {
continue;
- }
+ }
const SkOpPtT* priorPtT = nullptr, * priorStopPtT;
// find prior span containing opp segment
const SkOpSegment* priorOpp = nullptr;
}
goto checkNextSpan;
}
- tryNextSpan:
+ tryNextSpan:
;
} while (oppTest != oppLast && (oppTest = oppTest->upCast()->next()));
} while ((testPtT = testPtT->next()) != startPtT);
-checkNextSpan:
+checkNextSpan:
;
} while ((test = test->final() ? nullptr : test->upCast()->next()));
}
// loop looking for a pair of angle parts that are too close to be sorted
/* This is called after other more simple intersection and angle sorting tests have been exhausted.
This should be rarely called -- the test below is thorough and time consuming.
- This checks the distance between start points; the distance between
+ This checks the distance between start points; the distance between
*/
#if DEBUG_ANGLE
void SkOpAngle::debugCheckNearCoincidence() const {
SkDebugf("\n");
}
test = test->fNext;
- } while (test->fNext != this);
+ } while (test->fNext != this);
}
#endif
dump_path(file, two, false, true);
fprintf(file, " SkPath path2(path);\n");
fprintf(file, " testPathOp(reporter, path1, path2, (SkPathOp) %d, filename);\n", op);
- fprintf(file, "}\n");
+ fprintf(file, "}\n");
fclose(file);
}
#endif
#include "SkMutex.h"
-static SkMutex debugWorstLoop;
+SK_DECLARE_STATIC_MUTEX(debugWorstLoop);
SkOpGlobalState debugWorstState(nullptr, nullptr SkDEBUGPARAMS(nullptr));
SkOpGlobalState globalState(&coincidence, contourList SkDEBUGPARAMS(testName));
#if DEBUGGING_PATHOPS_FROM_HOST
dump_op(one, two, op);
-#endif
+#endif
#if 0 && DEBUG_SHOW_TEST_NAME
char* debugName = DEBUG_FILENAME_STRING;
if (debugName && debugName[0]) {
// Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a global mutex.
// See https://bug.skia.org/1497 for background.
-static SkMutex gFCMutex;
+SK_DECLARE_STATIC_MUTEX(gFCMutex);
#ifdef SK_DEBUG
void* CreateThreadFcLocked() { return new bool(false); }
struct SkFaceRec;
-static SkMutex gFTMutex;
+SK_DECLARE_STATIC_MUTEX(gFTMutex);
static FreeTypeLibrary* gFTLibrary;
static SkFaceRec* gFaceRecHead;
#include "SkMutex.h"
#include "SkRefCnt.h"
-static SkMutex gFontConfigInterfaceMutex;
+SK_DECLARE_STATIC_MUTEX(gFontConfigInterfaceMutex);
static SkFontConfigInterface* gFontConfigInterface;
SkFontConfigInterface* SkFontConfigInterface::RefGlobal() {
#define USE_GLOBAL_MUTEX_FOR_CG_ACCESS
#ifdef USE_GLOBAL_MUTEX_FOR_CG_ACCESS
- static SkMutex gCGMutex;
+ SK_DECLARE_STATIC_MUTEX(gCGMutex);
#define AUTO_CG_LOCK() SkAutoMutexAcquire amc(gCGMutex)
#else
#define AUTO_CG_LOCK()
return face;
}
-static SkMutex gGetDefaultFaceMutex;
+SK_DECLARE_STATIC_MUTEX(gGetDefaultFaceMutex);
static SkTypeface* GetDefaultFace() {
SkAutoMutexAcquire ma(gGetDefaultFaceMutex);
// Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a global mutex.
// See https://bug.skia.org/1497 for background.
-static SkMutex gFCMutex;
+SK_DECLARE_STATIC_MUTEX(gFCMutex);
#ifdef SK_DEBUG
void* CreateThreadFcLocked() { return new bool(false); }
static bool gOnce = false;
static DWORD gTlsIndex;
-static SkMutex gMutex;
+SK_DECLARE_STATIC_MUTEX(gMutex);
void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) {
if (!forceCreateTheSlot && !gOnce) {
#include "SkTDict.h"
#define kMinStringBufferSize 128
-static SkMutex gNamedSinkMutex;
+SK_DECLARE_STATIC_MUTEX(gNamedSinkMutex);
static SkTDict<SkEventSinkID> gNamedSinkIDs(kMinStringBufferSize);
/** Register a name/id pair with the system. If the name already exists,
}
}
-static SkMutex compareDebugOut3;
+SK_DECLARE_STATIC_MUTEX(compareDebugOut3);
static int comparePaths(skiatest::Reporter* reporter, const char* testName, const SkPath& one,
const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkBitmap& bitmap,
outFile.flush();
}
-static SkMutex simplifyDebugOut;
+SK_DECLARE_STATIC_MUTEX(simplifyDebugOut);
bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state,
const char* pathStr) {
return true;
}
-static SkMutex gMutex;
+SK_DECLARE_STATIC_MUTEX(gMutex);
void initializeTests(skiatest::Reporter* reporter, const char* test) {
#if 0 // doesn't work yet
// We use a poor man's garbage collector of EGLDisplays. They are only
// terminated when there are no more EGLDisplays in use. See crbug.com/603223
-static SkMutex gDisplayMutex;
+SK_DECLARE_STATIC_MUTEX(gDisplayMutex);
static int gActiveDisplayCnt;
SkTArray<EGLDisplay> gRetiredDisplays;
}
}
-static SkMutex gTestFontMutex;
+SK_DECLARE_STATIC_MUTEX(gTestFontMutex);
SkTypeface* create_font(const char* name, SkTypeface::Style style) {
SkTestFontData* fontData = nullptr;