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

Unified Diff: src/core/SkTaskGroup.cpp

Issue 1894893002: Modernize and trim down SkOnce. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: might as well class Created 4 years, 8 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
Index: src/core/SkTaskGroup.cpp
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index b696555d6faef35394199a1c658ab39990f31649..2ae1b5997128d514d97ce7693a60816061065941 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -26,11 +26,11 @@
}
#endif
-// We cache sk_num_cores() so we only query the OS once.
-SK_DECLARE_STATIC_ONCE(g_query_num_cores_once);
int sk_num_cores() {
+ // We cache sk_num_cores() so we only query the OS once.
static int num_cores = 0;
- SkOnce(&g_query_num_cores_once, query_num_cores, &num_cores);
+ static SkOnce once;
bungeman-skia 2016/04/18 15:19:00 It is not entirely clear to me how using member in
mtklein 2016/04/18 15:27:44 It makes the default constructor for SkOnce conste
+ once(query_num_cores, &num_cores);
SkASSERT(num_cores > 0);
return num_cores;
}

Powered by Google App Engine
This is Rietveld 408576698