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

Side by Side Diff: src/core/SkTaskGroup.cpp

Issue 700683002: Manually load CONDITION_VARIABLE methods on Windows, checking for failure (XP). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: winapi Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/utils/SkCondVar.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkTaskGroup.h" 1 #include "SkTaskGroup.h"
2 2
3 #include "SkCondVar.h" 3 #include "SkCondVar.h"
4 #include "SkRunnable.h" 4 #include "SkRunnable.h"
5 #include "SkTDArray.h" 5 #include "SkTDArray.h"
6 #include "SkThread.h" 6 #include "SkThread.h"
7 #include "SkThreadUtils.h" 7 #include "SkThreadUtils.h"
8 8
9 #if defined(SK_BUILD_FOR_WIN32) 9 #if defined(SK_BUILD_FOR_WIN32)
10 static inline int num_cores() { 10 static inline int num_cores() {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 static ThreadPool* gGlobal; 159 static ThreadPool* gGlobal;
160 friend struct SkTaskGroup::Enabler; 160 friend struct SkTaskGroup::Enabler;
161 }; 161 };
162 ThreadPool* ThreadPool::gGlobal = NULL; 162 ThreadPool* ThreadPool::gGlobal = NULL;
163 163
164 } // namespace 164 } // namespace
165 165
166 SkTaskGroup::Enabler::Enabler(int threads) { 166 SkTaskGroup::Enabler::Enabler(int threads) {
167 SkASSERT(ThreadPool::gGlobal == NULL); 167 SkASSERT(ThreadPool::gGlobal == NULL);
168 if (threads != 0) { 168 if (threads != 0 && SkCondVar::Supported()) {
169 ThreadPool::gGlobal = SkNEW_ARGS(ThreadPool, (threads)); 169 ThreadPool::gGlobal = SkNEW_ARGS(ThreadPool, (threads));
170 } 170 }
171 } 171 }
172 172
173 SkTaskGroup::Enabler::~Enabler() { 173 SkTaskGroup::Enabler::~Enabler() {
174 SkDELETE(ThreadPool::gGlobal); 174 SkDELETE(ThreadPool::gGlobal);
175 } 175 }
176 176
177 SkTaskGroup::SkTaskGroup() : fPending(0) {} 177 SkTaskGroup::SkTaskGroup() : fPending(0) {}
178 178
179 void SkTaskGroup::wait() { ThreadPool::Wait(&fPending ); } 179 void SkTaskGroup::wait() { ThreadPool::Wait(&fPending ); }
180 void SkTaskGroup::add(SkRunnable* task) { ThreadPool::Add(task, &fPe nding); } 180 void SkTaskGroup::add(SkRunnable* task) { ThreadPool::Add(task, &fPe nding); }
181 void SkTaskGroup::add(void (*fn)(void*), void* arg) { ThreadPool::Add(fn, arg, & fPending); } 181 void SkTaskGroup::add(void (*fn)(void*), void* arg) { ThreadPool::Add(fn, arg, & fPending); }
182 void SkTaskGroup::batch (void (*fn)(void*), void* args, int N, size_t stride) { 182 void SkTaskGroup::batch (void (*fn)(void*), void* args, int N, size_t stride) {
183 ThreadPool::Batch(fn, args, N, stride, &fPending); 183 ThreadPool::Batch(fn, args, N, stride, &fPending);
184 } 184 }
185 185
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkCondVar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698