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

Unified Diff: src/core/SkTaskGroup.cpp

Issue 1948313002: Revert of SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « src/core/SkTaskGroup.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTaskGroup.cpp
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp
index 7a58c865a730a0e2ed7cae6b4f201779c5b09c2b..2ae1b5997128d514d97ce7693a60816061065941 100644
--- a/src/core/SkTaskGroup.cpp
+++ b/src/core/SkTaskGroup.cpp
@@ -14,25 +14,25 @@
#include "SkThreadUtils.h"
#if defined(SK_BUILD_FOR_WIN32)
- static void query_num_cores(int* cores) {
+ static void query_num_cores(int* num_cores) {
SYSTEM_INFO sysinfo;
GetNativeSystemInfo(&sysinfo);
- *cores = sysinfo.dwNumberOfProcessors;
+ *num_cores = sysinfo.dwNumberOfProcessors;
}
#else
#include <unistd.h>
- static void query_num_cores(int* cores) {
- *cores = (int)sysconf(_SC_NPROCESSORS_ONLN);
+ static void query_num_cores(int* num_cores) {
+ *num_cores = (int)sysconf(_SC_NPROCESSORS_ONLN);
}
#endif
-static int num_cores() {
- // We cache num_cores() so we only query the OS once.
- static int cores = 0;
+int sk_num_cores() {
+ // We cache sk_num_cores() so we only query the OS once.
+ static int num_cores = 0;
static SkOnce once;
- once(query_num_cores, &cores);
- SkASSERT(cores > 0);
- return cores;
+ once(query_num_cores, &num_cores);
+ SkASSERT(num_cores > 0);
+ return num_cores;
}
namespace {
@@ -98,7 +98,7 @@
explicit ThreadPool(int threads) {
if (threads == -1) {
- threads = num_cores();
+ threads = sk_num_cores();
}
for (int i = 0; i < threads; i++) {
fThreads.push(new SkThread(&ThreadPool::Loop, this));
« no previous file with comments | « src/core/SkTaskGroup.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698