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

Unified Diff: src/utils/SkThreadUtils_win.cpp

Issue 1408213005: Remove SkThread::setProcessorAffinity() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: gAdds Created 5 years, 2 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/utils/SkThreadUtils_pthread_other.cpp ('k') | tests/AtomicTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkThreadUtils_win.cpp
diff --git a/src/utils/SkThreadUtils_win.cpp b/src/utils/SkThreadUtils_win.cpp
index a5efb939f33254d4b7dd7c87d294f5bc532f0e70..07cceee14218ec629d1da7e38c82b1e47cb473bc 100644
--- a/src/utils/SkThreadUtils_win.cpp
+++ b/src/utils/SkThreadUtils_win.cpp
@@ -53,7 +53,7 @@ SkThread::SkThread(entryPointProc entryPoint, void* data) {
0, // use default stack size
thread_start, // thread function name (proxy)
winData, // argument to thread function (proxy args)
- CREATE_SUSPENDED, // create suspended so affinity can be set
+ CREATE_SUSPENDED, // we used to set processor affinity, which needed this
&winData->fThreadId); // returns the thread identifier
}
@@ -96,41 +96,3 @@ void SkThread::join() {
WaitForSingleObject(winData->fHandle, INFINITE);
}
-
-static unsigned int num_bits_set(DWORD_PTR mask) {
- unsigned int count;
- for (count = 0; mask; ++count) {
- mask &= mask - 1;
- }
- return count;
-}
-
-static unsigned int nth_set_bit(unsigned int n, DWORD_PTR mask) {
- n %= num_bits_set(mask);
- for (unsigned int setBitsSeen = 0, currentBit = 0; true; ++currentBit) {
- if (mask & (static_cast<DWORD_PTR>(1) << currentBit)) {
- ++setBitsSeen;
- if (setBitsSeen > n) {
- return currentBit;
- }
- }
- }
-}
-
-bool SkThread::setProcessorAffinity(unsigned int processor) {
- SkThread_WinData* winData = static_cast<SkThread_WinData*>(fData);
- if (nullptr == winData->fHandle) {
- return false;
- }
-
- DWORD_PTR processAffinityMask;
- DWORD_PTR systemAffinityMask;
- if (0 == GetProcessAffinityMask(GetCurrentProcess(),
- &processAffinityMask,
- &systemAffinityMask)) {
- return false;
- }
-
- DWORD_PTR threadAffinityMask = 1 << nth_set_bit(processor, processAffinityMask);
- return 0 != SetThreadAffinityMask(winData->fHandle, threadAffinityMask);
-}
« no previous file with comments | « src/utils/SkThreadUtils_pthread_other.cpp ('k') | tests/AtomicTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698