diff options
author | reed <reed@google.com> | 2016-05-05 01:36:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-05 01:36:43 -0700 |
commit | 959a2937d55279c6d020f2511007bb39ed322ace (patch) | |
tree | be843fd0a48d47d9ed0d2cc7ef61a4821208c33a /src/core/SkTaskGroup.cpp | |
parent | 82da9a8aa0ce648f36882830765b42e0ada6c0fa (diff) |
Revert of SkOncePtr -> SkOnce (patchset #1 id:1 of https://codereview.chromium.org/1949313003/ )
Reason for revert:
ok, I have no idea what's going on
Original issue's description:
> Reland of SkOncePtr -> SkOnce (patchset #1 id:1 of https://codereview.chromium.org/1945293004/ )
>
> Reason for revert:
> previous revert unneeded (I think)
>
> Original issue's description:
> > Revert of SkOncePtr -> SkOnce (patchset #4 id:60001 of https://codereview.chromium.org/1953533002/ )
> >
> > 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:
> > > SkOncePtr -> SkOnce
> > >
> > > It's always nice to kill off a synchronization primitive.
> > > And while less terse, I think this new code reads more clearly.
> > >
> > > ... and, SkOncePtr's tests were the only thing now using sk_num_cores()
> > > outside of SkTaskGroup, so I've hidden it as static inside SkTaskGroup.cpp.
> > >
> > > BUG=skia:
> > > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1953533002
> > > CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
> > >
> > > Committed: https://skia.googlesource.com/skia/+/9bd3fc7fa9bb7cad050bd619aa93d4c48ebb5c02
> >
> > TBR=herb@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:
> >
> > Committed: https://skia.googlesource.com/skia/+/7eb33da7eede34c050b865dbb1b60c3dcea7191b
>
> TBR=herb@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:
>
> Committed: https://skia.googlesource.com/skia/+/82da9a8aa0ce648f36882830765b42e0ada6c0fa
TBR=herb@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/1948313002
Diffstat (limited to 'src/core/SkTaskGroup.cpp')
-rw-r--r-- | src/core/SkTaskGroup.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp index 7a58c865a7..2ae1b59971 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 @@ private: 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)); |