Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: dm/DM.cpp

Issue 1734383002: Modernize SkSpinlock. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: std::atomic<bool> Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/private/SkOnce.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 9021f3c7894097631cef8ac3a5303a5178dc6a70..0d2238898fa339a406a66454db8fab64f09d61e6 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -81,7 +81,7 @@ static void fail(const SkString& err) {
// We use a spinlock to make locking this in a signal handler _somewhat_ safe.
-SK_DECLARE_STATIC_SPINLOCK(gMutex);
+static SkSpinlock gMutex;
static int32_t gPending;
static SkTArray<SkString> gRunning;
@@ -89,7 +89,7 @@ static void done(const char* config, const char* src, const char* srcOptions, co
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
int pending;
{
- SkAutoTAcquire<SkPODSpinlock> lock(gMutex);
+ SkAutoTAcquire<SkSpinlock> lock(gMutex);
for (int i = 0; i < gRunning.count(); i++) {
if (gRunning[i] == id) {
gRunning.removeShuffle(i);
@@ -107,7 +107,7 @@ static void done(const char* config, const char* src, const char* srcOptions, co
static void start(const char* config, const char* src, const char* srcOptions, const char* name) {
SkString id = SkStringPrintf("%s %s %s %s", config, src, srcOptions, name);
- SkAutoTAcquire<SkPODSpinlock> lock(gMutex);
+ SkAutoTAcquire<SkSpinlock> lock(gMutex);
gRunning.push_back(id);
}
@@ -118,7 +118,7 @@ static void print_status() {
peak = sk_tools::getMaxResidentSetSizeMB();
SkString elapsed = HumanizeMs(SkTime::GetMSecs() - start_ms);
- SkAutoTAcquire<SkPODSpinlock> lock(gMutex);
+ SkAutoTAcquire<SkSpinlock> lock(gMutex);
SkDebugf("\n%s elapsed, %d active, %d queued, %dMB RAM, %dMB peak\n",
elapsed.c_str(), gRunning.count(), gPending - gRunning.count(), curr, peak);
for (auto& task : gRunning) {
@@ -1149,7 +1149,7 @@ int dm_main() {
if (src->veto(sink->flags()) ||
is_blacklisted(sink.tag.c_str(), src.tag.c_str(),
src.options.c_str(), src->name().c_str())) {
- SkAutoTAcquire<SkPODSpinlock> lock(gMutex);
+ SkAutoTAcquire<SkSpinlock> lock(gMutex);
gPending--;
continue;
}
« no previous file with comments | « no previous file | include/private/SkOnce.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698