remove SkTLS

- used for debug lock tracking in SkFont*
  - used for debug logging in SkPathOps
  - genuine use in GLTestContext_cmd_buf?
    switched that to thread_local
  - keep empty SkTLS_{pthread,win}.cpp until
    references to them can be cleaned up

Bug: skia:10006
Change-Id: I195a94c95d3f1a1918ee8c9bc4a15fa5b4344fbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275282
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2020-03-05 09:22:06 -06:00 committed by Skia Commit-Bot
parent 93a2a6b8ba
commit 491df6ba72
25 changed files with 4 additions and 571 deletions

View File

@ -947,7 +947,6 @@ component("skia") {
"src/ports/SkImageGeneratorWIC.cpp",
"src/ports/SkOSFile_win.cpp",
"src/ports/SkOSLibrary_win.cpp",
"src/ports/SkTLS_win.cpp",
]
libs += [
"FontSub.lib",
@ -960,7 +959,6 @@ component("skia") {
sources += [
"src/ports/SkOSFile_posix.cpp",
"src/ports/SkOSLibrary_posix.cpp",
"src/ports/SkTLS_pthread.cpp",
]
libs += [ "dl" ]
}

View File

@ -382,7 +382,6 @@ skia_core_sources = [
"$_src/core/SkThreadID.cpp",
"$_src/core/SkTLazy.h",
"$_src/core/SkTLList.h",
"$_src/core/SkTLS.cpp",
"$_src/core/SkTMultiMap.h",
"$_src/core/SkTraceEvent.h",
"$_src/core/SkTraceEventCommon.h",

View File

@ -306,7 +306,6 @@ PORTS_SRCS_UNIX = struct(
"src/ports/SkFontMgr_fontconfig_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],
)
@ -338,7 +337,6 @@ PORTS_SRCS_ANDROID = struct(
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],
)
@ -374,7 +372,6 @@ PORTS_SRCS_IOS = struct(
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],
)
@ -416,7 +413,6 @@ PORTS_SRCS_WASM = struct(
"src/ports/SkFontMgr_fontconfig_factory.cpp",
"src/ports/SkFontMgr_fuchsia.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],
)

View File

@ -1,105 +0,0 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/core/SkTLS.h"
struct SkTLSRec {
SkTLSRec* fNext;
void* fData;
SkTLS::CreateProc fCreateProc;
SkTLS::DeleteProc fDeleteProc;
~SkTLSRec() {
if (fDeleteProc) {
fDeleteProc(fData);
}
// else we leak fData, or it will be managed by the caller
}
};
void SkTLS::Destructor(void* ptr) {
SkTLSRec* rec = (SkTLSRec*)ptr;
do {
SkTLSRec* next = rec->fNext;
delete rec;
rec = next;
} while (rec);
}
void* SkTLS::Get(CreateProc createProc, DeleteProc deleteProc) {
if (nullptr == createProc) {
return nullptr;
}
void* ptr = SkTLS::PlatformGetSpecific(true);
if (ptr) {
const SkTLSRec* rec = (const SkTLSRec*)ptr;
do {
if (rec->fCreateProc == createProc) {
SkASSERT(rec->fDeleteProc == deleteProc);
return rec->fData;
}
} while ((rec = rec->fNext) != nullptr);
// not found, so create a new one
}
// add a new head of our change
SkTLSRec* rec = new SkTLSRec;
rec->fNext = (SkTLSRec*)ptr;
SkTLS::PlatformSetSpecific(rec);
rec->fData = createProc();
rec->fCreateProc = createProc;
rec->fDeleteProc = deleteProc;
return rec->fData;
}
void* SkTLS::Find(CreateProc createProc) {
if (nullptr == createProc) {
return nullptr;
}
void* ptr = SkTLS::PlatformGetSpecific(false);
if (ptr) {
const SkTLSRec* rec = (const SkTLSRec*)ptr;
do {
if (rec->fCreateProc == createProc) {
return rec->fData;
}
} while ((rec = rec->fNext) != nullptr);
}
return nullptr;
}
void SkTLS::Delete(CreateProc createProc) {
if (nullptr == createProc) {
return;
}
void* ptr = SkTLS::PlatformGetSpecific(false);
SkTLSRec* curr = (SkTLSRec*)ptr;
SkTLSRec* prev = nullptr;
while (curr) {
SkTLSRec* next = curr->fNext;
if (curr->fCreateProc == createProc) {
if (prev) {
prev->fNext = next;
} else {
// we have a new head of our chain
SkTLS::PlatformSetSpecific(next);
}
delete curr;
break;
}
prev = curr;
curr = next;
}
}

View File

@ -1,83 +0,0 @@
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkTLS_DEFINED
#define SkTLS_DEFINED
#include "include/core/SkTypes.h"
/**
* Maintains a per-thread cache, using a CreateProc as the key into that cache.
*/
class SkTLS {
public:
typedef void* (*CreateProc)();
typedef void (*DeleteProc)(void*);
/**
* If Get() has previously been called with this CreateProc, then this
* returns its cached data, otherwise it returns nullptr. The CreateProc is
* never invoked in Find, it is only used as a key for searching the
* cache.
*/
static void* Find(CreateProc);
/**
* Return the cached data that was returned by the CreateProc. This proc
* is only called the first time Get is called, and there after it is
* cached (per-thread), using the CreateProc as a key to look it up.
*
* When this thread, or Delete is called, the cached data is removed, and
* if a DeleteProc was specified, it is passed the pointer to the cached
* data.
*/
static void* Get(CreateProc, DeleteProc);
/**
* Remove (optionally calling the DeleteProc if it was specificed in Get)
* the cached data associated with this CreateProc. If no associated cached
* data is found, do nothing.
*/
static void Delete(CreateProc);
private:
// Our implementation requires only 1 TLS slot, as we manage multiple values
// ourselves in a list, with the platform specific value as our head.
/**
* Implemented by the platform, to return the value of our (one) slot per-thread
*
* If forceCreateTheSlot is true, then we must have created the "slot" for
* our TLS, even though we know that the return value will be nullptr in that
* case (i.e. no-slot and first-time-slot both return nullptr). This ensures
* that after calling GetSpecific, we know that we can legally call
* SetSpecific.
*
* If forceCreateTheSlot is false, then the impl can either create the
* slot or not.
*/
static void* PlatformGetSpecific(bool forceCreateTheSlot);
/**
* Implemented by the platform, to set the value for our (one) slot per-thread
*
* The implementation can rely on GetSpecific(true) having been previously
* called before SetSpecific is called.
*/
static void PlatformSetSpecific(void*);
public:
/**
* Will delete our internal list. To be called by the platform if/when its
* TLS slot is deleted (often at thread shutdown).
*
* Public *only* for the platform's use, not to be called by a client.
*/
static void Destructor(void* ptr);
};
#endif

View File

@ -511,28 +511,6 @@ void SkPathOpsDebug::WindingPrintf(int wind) {
#endif // defined SK_DEBUG || !FORCE_RELEASE
#if DEBUG_SHOW_TEST_NAME
void* SkPathOpsDebug::CreateNameStr() { return new char[DEBUG_FILENAME_STRING_LENGTH]; }
void SkPathOpsDebug::DeleteNameStr(void* v) { delete[] reinterpret_cast<char*>(v); }
void SkPathOpsDebug::BumpTestName(char* test) {
char* num = test + strlen(test);
while (num[-1] >= '0' && num[-1] <= '9') {
--num;
}
if (num[0] == '\0') {
return;
}
int dec = atoi(num);
if (dec == 0) {
return;
}
++dec;
SK_SNPRINTF(num, DEBUG_FILENAME_STRING_LENGTH - (num - test), "%d", dec);
}
#endif
static void show_function_header(const char* functionName) {
SkDebugf("\nstatic void %s(skiatest::Reporter* reporter, const char* filename) {\n", functionName);
if (strcmp("skphealth_com76", functionName) == 0) {

View File

@ -97,7 +97,6 @@ DummyClasses(Cubic, Cubic);
#define DEBUG_MARK_DONE 0
#define DEBUG_PATH_CONSTRUCTION 0
#define DEBUG_PERP 0
#define DEBUG_SHOW_TEST_NAME 0
#define DEBUG_SORT 0
#define DEBUG_T_SECT 0
#define DEBUG_T_SECT_DUMP 0
@ -128,7 +127,6 @@ DummyClasses(Cubic, Cubic);
#define DEBUG_MARK_DONE 1
#define DEBUG_PATH_CONSTRUCTION 1
#define DEBUG_PERP 1
#define DEBUG_SHOW_TEST_NAME 1
#define DEBUG_SORT 1
#define DEBUG_T_SECT 0 // enabling may trigger validate asserts even though op does not fail
#define DEBUG_T_SECT_DUMP 0 // Use 1 normally. Use 2 to number segments, 3 for script output
@ -246,10 +244,6 @@ DummyClasses(Cubic, Cubic);
#define DEBUG_TEST 0
#endif
#if DEBUG_SHOW_TEST_NAME
#include "src/core/SkTLS.h"
#endif
// Tests with extreme numbers may fail, but all other tests should never fail.
#define FAIL_IF(cond) \
do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } while (false)
@ -358,14 +352,6 @@ public:
static bool ValidWind(int winding);
static void WindingPrintf(int winding);
#if DEBUG_SHOW_TEST_NAME
static void* CreateNameStr();
static void DeleteNameStr(void* v);
#define DEBUG_FILENAME_STRING_LENGTH 64
#define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebug::CreateNameStr, \
SkPathOpsDebug::DeleteNameStr)))
static void BumpTestName(char* );
#endif
static void ShowActiveSpans(SkOpContourHead* contourList);
static void ShowOnePath(const SkPath& path, const char* name, bool includeDeclaration);
static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, const char* name);

View File

@ -199,9 +199,6 @@ public:
reassemble contour pieces into new path
*/
void SkPathWriter::assemble() {
#if DEBUG_SHOW_TEST_NAME
SkDebugf("</div>\n");
#endif
if (!this->someAssemblyRequired()) {
return;
}

View File

@ -23,10 +23,6 @@
#include <fontconfig/fontconfig.h>
#include <unistd.h>
#ifdef SK_DEBUG
# include "src/core/SkTLS.h"
#endif
namespace {
// Fontconfig is not threadsafe before 2.10.91. Before that, we lock with a global mutex.
@ -36,23 +32,12 @@ static SkMutex& f_c_mutex() {
return mutex;
}
#ifdef SK_DEBUG
void* CreateThreadFcLocked() { return new bool(false); }
void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); }
# define THREAD_FC_LOCKED \
static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked))
#endif
struct FCLocker {
// Assume FcGetVersion() has always been thread safe.
FCLocker() {
if (FcGetVersion() < 21091) {
f_c_mutex().acquire();
} else {
SkDEBUGCODE(bool* threadLocked = THREAD_FC_LOCKED);
SkASSERT(false == *threadLocked);
SkDEBUGCODE(*threadLocked = true);
}
}
@ -60,16 +45,12 @@ struct FCLocker {
AssertHeld();
if (FcGetVersion() < 21091) {
f_c_mutex().release();
} else {
SkDEBUGCODE(*THREAD_FC_LOCKED = false);
}
}
static void AssertHeld() { SkDEBUGCODE(
if (FcGetVersion() < 21091) {
f_c_mutex().assertHeld();
} else {
SkASSERT(true == *THREAD_FC_LOCKED);
}
) }
};

View File

@ -38,10 +38,6 @@ class SkData;
# define FC_POSTSCRIPT_NAME "postscriptname"
#endif
#ifdef SK_DEBUG
# include "src/core/SkTLS.h"
#endif
/** Since FontConfig is poorly documented, this gives a high level overview:
*
* FcConfig is a handle to a FontConfig configuration instance. Each 'configuration' is independent
@ -68,30 +64,17 @@ static SkMutex& f_c_mutex() {
return mutex;
}
#ifdef SK_DEBUG
void* CreateThreadFcLocked() { return new bool(false); }
void DeleteThreadFcLocked(void* v) { delete static_cast<bool*>(v); }
# define THREAD_FC_LOCKED \
static_cast<bool*>(SkTLS::Get(CreateThreadFcLocked, DeleteThreadFcLocked))
#endif
class FCLocker {
// Assume FcGetVersion() has always been thread safe.
static void lock() SK_NO_THREAD_SAFETY_ANALYSIS {
if (FcGetVersion() < 21091) {
f_c_mutex().acquire();
} else {
SkDEBUGCODE(bool* threadLocked = THREAD_FC_LOCKED);
SkASSERT(false == *threadLocked);
SkDEBUGCODE(*threadLocked = true);
}
}
static void unlock() SK_NO_THREAD_SAFETY_ANALYSIS {
AssertHeld();
if (FcGetVersion() < 21091) {
f_c_mutex().release();
} else {
SkDEBUGCODE(*THREAD_FC_LOCKED = false);
}
}
@ -112,8 +95,6 @@ public:
static void AssertHeld() { SkDEBUGCODE(
if (FcGetVersion() < 21091) {
f_c_mutex().assertHeld();
} else {
SkASSERT(true == *THREAD_FC_LOCKED);
}
) }
};

View File

@ -1,18 +0,0 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "src/core/SkTLS.h"
static void* gSpecific = nullptr;
void* SkTLS::PlatformGetSpecific(bool) {
return gSpecific;
}
void SkTLS::PlatformSetSpecific(void* ptr) {
gSpecific = ptr;
}

View File

@ -1,25 +1 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/private/SkOnce.h"
#include "src/core/SkTLS.h"
#include <pthread.h>
static pthread_key_t gSkTLSKey;
void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) {
// should we use forceCreateTheSlot to potentially just return nullptr if
// we've never been called with forceCreateTheSlot==true ?
static SkOnce once;
once([]{pthread_key_create(&gSkTLSKey, SkTLS::Destructor);});
return pthread_getspecific(gSkTLSKey);
}
void SkTLS::PlatformSetSpecific(void* ptr) {
(void)pthread_setspecific(gSkTLSKey, ptr);
}
// Copyright 2020 Google LLC.

View File

@ -1,80 +1 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "include/core/SkTypes.h"
#if defined(SK_BUILD_FOR_WIN)
#include "include/private/SkMutex.h"
#include "src/core/SkLeanWindows.h"
#include "src/core/SkTLS.h"
static bool gOnce = false;
static DWORD gTlsIndex;
void* SkTLS::PlatformGetSpecific(bool forceCreateTheSlot) {
static SkMutex& mutex = *(new SkMutex);
if (!forceCreateTheSlot && !gOnce) {
return nullptr;
}
if (!gOnce) {
SkAutoMutexExclusive tmp(mutex);
if (!gOnce) {
gTlsIndex = TlsAlloc();
gOnce = true;
}
}
return TlsGetValue(gTlsIndex);
}
void SkTLS::PlatformSetSpecific(void* ptr) {
SkASSERT(gOnce);
(void)TlsSetValue(gTlsIndex, ptr);
}
// Call TLS destructors on thread exit. Code based on Chromium's
// base/threading/thread_local_storage_win.cc
#ifdef _WIN64
#pragma comment(linker, "/INCLUDE:_tls_used")
#pragma comment(linker, "/INCLUDE:skia_tls_callback")
#else
#pragma comment(linker, "/INCLUDE:__tls_used")
#pragma comment(linker, "/INCLUDE:_skia_tls_callback")
#endif
void NTAPI onTLSCallback(PVOID unused, DWORD reason, PVOID unused2) {
if ((DLL_THREAD_DETACH == reason || DLL_PROCESS_DETACH == reason) && gOnce) {
void* ptr = TlsGetValue(gTlsIndex);
if (ptr != nullptr) {
SkTLS::Destructor(ptr);
TlsSetValue(gTlsIndex, nullptr);
}
}
}
extern "C" {
#ifdef _WIN64
#pragma const_seg(".CRT$XLB")
extern const PIMAGE_TLS_CALLBACK skia_tls_callback;
const PIMAGE_TLS_CALLBACK skia_tls_callback = onTLSCallback;
#pragma const_seg()
#else
#pragma data_seg(".CRT$XLB")
PIMAGE_TLS_CALLBACK skia_tls_callback = onTLSCallback;
#pragma data_seg()
#endif
}
#endif//defined(SK_BUILD_FOR_WIN)
// Copyright 2020 Google LLC.

View File

@ -11120,8 +11120,5 @@ static const size_t testCount = SK_ARRAY_COUNT(tests);
static bool runReverse = false;
DEF_TEST(PathOpsBattle, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, tests, testCount, firstTest, nullptr, stopTest, runReverse);
}

View File

@ -2424,8 +2424,5 @@ static const size_t testCount = SK_ARRAY_COUNT(tests);
static bool runReverse = false;
DEF_TEST(PathOpsBuildUse, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, tests, testCount, firstTest, nullptr, stopTest, runReverse);
}

View File

@ -87,70 +87,6 @@ enum class ExpectMatch {
kFlaky
};
#if DEBUG_SHOW_TEST_NAME
static void showPathData(const SkPath& path) {
SkPath::RawIter iter(path);
uint8_t verb;
SkPoint pts[4];
SkPoint firstPt = {0, 0}, lastPt = {0, 0};
bool firstPtSet = false;
bool lastPtSet = true;
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
switch (verb) {
case SkPath::kMove_Verb:
if (firstPtSet && lastPtSet && firstPt != lastPt) {
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", lastPt.fX, lastPt.fY,
firstPt.fX, firstPt.fY);
lastPtSet = false;
}
firstPt = pts[0];
firstPtSet = true;
continue;
case SkPath::kLine_Verb:
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", pts[0].fX, pts[0].fY,
pts[1].fX, pts[1].fY);
lastPt = pts[1];
lastPtSet = true;
break;
case SkPath::kQuad_Verb:
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n",
pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY);
lastPt = pts[2];
lastPtSet = true;
break;
case SkPath::kConic_Verb:
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}, //weight=%1.9g\n",
pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY,
iter.conicWeight());
lastPt = pts[2];
lastPtSet = true;
break;
case SkPath::kCubic_Verb:
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n",
pts[0].fX, pts[0].fY, pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY,
pts[3].fX, pts[3].fY);
lastPt = pts[3];
lastPtSet = true;
break;
case SkPath::kClose_Verb:
if (firstPtSet && lastPtSet && firstPt != lastPt) {
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", lastPt.fX, lastPt.fY,
firstPt.fX, firstPt.fY);
}
firstPtSet = lastPtSet = false;
break;
default:
SkDEBUGFAIL("bad verb");
return;
}
}
if (firstPtSet && lastPtSet && firstPt != lastPt) {
SkDebugf("{{%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", lastPt.fX, lastPt.fY,
firstPt.fX, firstPt.fY);
}
}
#endif
void showOp(const SkPathOp op) {
switch (op) {
case kDifference_SkPathOp:
@ -173,35 +109,6 @@ void showOp(const SkPathOp op) {
}
}
#if DEBUG_SHOW_TEST_NAME
static char hexorator(int x) {
if (x < 10) {
return x + '0';
}
x -= 10;
SkASSERT(x < 26);
return x + 'A';
}
#endif
void ShowTestName(PathOpsThreadState* state, int a, int b, int c, int d) {
#if DEBUG_SHOW_TEST_NAME
state->fSerialNo[0] = hexorator(state->fA);
state->fSerialNo[1] = hexorator(state->fB);
state->fSerialNo[2] = hexorator(state->fC);
state->fSerialNo[3] = hexorator(state->fD);
state->fSerialNo[4] = hexorator(a);
state->fSerialNo[5] = hexorator(b);
state->fSerialNo[6] = hexorator(c);
state->fSerialNo[7] = hexorator(d);
state->fSerialNo[8] = '\0';
SkDebugf("%s\n", state->fSerialNo);
if (strcmp(state->fSerialNo, state->fKey) == 0) {
SkDebugf("%s\n", state->fPathStr.c_str());
}
#endif
}
const int bitWidth = 64;
const int bitHeight = 64;
@ -559,9 +466,6 @@ static bool check_for_duplicate_names(const char* testName) {
static bool inner_simplify(skiatest::Reporter* reporter, const SkPath& path, const char* filename,
ExpectSuccess expectSuccess, SkipAssert skipAssert, ExpectMatch expectMatch) {
#if 0 && DEBUG_SHOW_TEST_NAME
showPathData(path);
#endif
if (PathOpsDebug::gJson) {
if (check_for_duplicate_names(filename)) {
return true;
@ -631,21 +535,9 @@ bool testSimplifyFail(skiatest::Reporter* reporter, const SkPath& path, const ch
ExpectSuccess::kNo, SkipAssert::kYes, ExpectMatch::kNo);
}
#if DEBUG_SHOW_TEST_NAME
static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) {
SkDebugf("\n");
showPathData(a);
showOp(shapeOp);
showPathData(b);
}
#endif
static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
const SkPathOp shapeOp, const char* testName, ExpectSuccess expectSuccess,
SkipAssert skipAssert, ExpectMatch expectMatch) {
#if 0 && DEBUG_SHOW_TEST_NAME
showName(a, b, shapeOp);
#endif
if (PathOpsDebug::gJson) {
if (check_for_duplicate_names(testName)) {
return true;
@ -734,9 +626,6 @@ bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a, const SkPath&
bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
const SkPathOp shapeOp, const char* testName) {
#if DEBUG_SHOW_TEST_NAME
showName(a, b, shapeOp);
#endif
SkPath orig;
orig.lineTo(54, 43);
SkPath out = orig;
@ -800,9 +689,6 @@ void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
while (index > 0 && tests[index].fun != firstTest) {
--index;
}
#if DEBUG_SHOW_TEST_NAME
SkDebugf("\n<div id=\"%s\">\n", tests[index].str);
#endif
(*tests[index].fun)(reporter, tests[index].str);
if (tests[index].fun == stopTest) {
return;
@ -816,9 +702,6 @@ void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
foundSkip = true;
}
if (foundSkip && tests[index].fun != firstTest) {
#if DEBUG_SHOW_TEST_NAME
SkDebugf("\n<div id=\"%s\">\n", tests[index].str);
#endif
(*tests[index].fun)(reporter, tests[index].str);
}
if (tests[index].fun == stopTest || index == last) {
@ -826,29 +709,4 @@ void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
}
index += reverse ? -1 : 1;
} while (true);
#if DEBUG_SHOW_TEST_NAME
SkDebugf(
"\n"
"</div>\n"
"\n"
"<script type=\"text/javascript\">\n"
"\n"
"var testDivs = [\n"
);
index = reverse ? count - 1 : 0;
last = reverse ? 0 : count - 1;
foundSkip = !skipTest;
do {
if (tests[index].fun == skipTest) {
foundSkip = true;
}
if (foundSkip && tests[index].fun != firstTest) {
SkDebugf(" %s,\n", tests[index].str);
}
if (tests[index].fun == stopTest || index == last) {
break;
}
index += reverse ? -1 : 1;
} while (true);
#endif
}

View File

@ -57,7 +57,6 @@ void RunTestSet(skiatest::Reporter* reporter, TestDesc tests[], size_t count,
void (*firstTest)(skiatest::Reporter* , const char* filename),
void (*skipTest)(skiatest::Reporter* , const char* filename),
void (*stopTest)(skiatest::Reporter* , const char* filename), bool reverse);
void ShowTestName(PathOpsThreadState* data, int a, int b, int c, int d);
void ShowFunctionHeader(const char* name);
void ShowPath(const SkPath& path, const char* pathName);
void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo);

View File

@ -2437,8 +2437,5 @@ static const size_t testCount = SK_ARRAY_COUNT(tests);
static bool runReverse = false;
DEF_TEST(PathOpsFuzz763, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
}

View File

@ -1679,8 +1679,5 @@ static const size_t testCount = SK_ARRAY_COUNT(tests);
static bool runReverse = false;
DEF_TEST(PathOpsIssue3651, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
}

View File

@ -15,9 +15,6 @@ static int loopNo = 158;
static std::atomic<int> gCubicsTestNo{0};
static void testOpCubicsMain(PathOpsThreadState* data) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
SkASSERT(data);
const SkPathFillType fts[] = { SkPathFillType::kWinding, SkPathFillType::kEvenOdd };
PathOpsThreadState& state = *data;

View File

@ -32,9 +32,6 @@ static void add_point(SkString* str, SkScalar x, SkScalar y) {
static std::atomic<int> gLoopsTestNo{0};
static void testOpLoopsMain(PathOpsThreadState* data) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
SkASSERT(data);
PathOpsThreadState& state = *data;
SkString pathStr;

View File

@ -9492,9 +9492,6 @@ static bool runSubTestsFirst = true;
static bool runReverse = false;
DEF_TEST(PathOpsOp, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
if (runSubTests && runSubTestsFirst) {
RunTestSet(reporter, subTests, subTestCount, firstSubTest, nullptr, stopTest, runReverse);
}
@ -12531,9 +12528,6 @@ static struct TestDesc failTests[] = {
static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
DEF_TEST(PathOpsFailOp, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, false);
}

View File

@ -54,13 +54,11 @@ static void testSimplifyTrianglesMain(PathOpsThreadState* data) {
pathStr.appendf(" path.close();\n");
state.outputProgress(pathStr.c_str(), SkPathFillType::kWinding);
}
ShowTestName(&state, d, e, f, 0);
testSimplify(path, false, out, state, pathStr.c_str());
path.setFillType(SkPathFillType::kEvenOdd);
if (state.fReporter->verbose()) {
state.outputProgress(pathStr.c_str(), SkPathFillType::kEvenOdd);
}
ShowTestName(&state, d, e, f, 1);
testSimplify(path, true, out, state, pathStr.c_str());
}
}

View File

@ -4766,8 +4766,5 @@ static const size_t testCount = SK_ARRAY_COUNT(tests);
static bool runReverse = false;
DEF_TEST(PathOpsSkp, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runReverse);
}

View File

@ -12,7 +12,6 @@
#include "include/gpu/gl/GrGLInterface.h"
#include "include/private/SkMutex.h"
#include "include/private/SkOnce.h"
#include "src/core/SkTLS.h"
#include "src/ports/SkOSLibrary.h"
#include "tools/gpu/gl/command_buffer/GLTestContext_command_buffer.h"
@ -193,10 +192,9 @@ private:
EGLContext fContext = EGL_NO_CONTEXT;
static TLSCurrentObjects* Get() {
return (TLSCurrentObjects*) SkTLS::Get(TLSCreate, TLSDelete);
static thread_local TLSCurrentObjects objects;
return &objects;
}
static void* TLSCreate() { return new TLSCurrentObjects(); }
static void TLSDelete(void* objs) { delete (TLSCurrentObjects*)objs; }
};
std::function<void()> context_restorer() {