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

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

Issue 1193493003: Modernize atomics in SkTaskGroup's threadpool. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « include/core/SkAtomics.h ('k') | src/core/SkTaskGroup.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTaskGroup_DEFINED 8 #ifndef SkTaskGroup_DEFINED
9 #define SkTaskGroup_DEFINED 9 #define SkTaskGroup_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include "SkAtomics.h"
12 13
13 struct SkRunnable; 14 struct SkRunnable;
14 15
15 class SkTaskGroup : SkNoncopyable { 16 class SkTaskGroup : SkNoncopyable {
16 public: 17 public:
17 // Create one of these in main() to enable SkTaskGroups globally. 18 // Create one of these in main() to enable SkTaskGroups globally.
18 struct Enabler : SkNoncopyable { 19 struct Enabler : SkNoncopyable {
19 explicit Enabler(int threads = -1); // Default is system-reported core count. 20 explicit Enabler(int threads = -1); // Default is system-reported core count.
20 ~Enabler(); 21 ~Enabler();
21 }; 22 };
(...skipping 16 matching lines...) Expand all
38 // Block until all Tasks previously add()ed to this SkTaskGroup have run. 39 // Block until all Tasks previously add()ed to this SkTaskGroup have run.
39 // You may safely reuse this SkTaskGroup after wait() returns. 40 // You may safely reuse this SkTaskGroup after wait() returns.
40 void wait(); 41 void wait();
41 42
42 private: 43 private:
43 typedef void(*void_fn)(void*); 44 typedef void(*void_fn)(void*);
44 45
45 void add (void_fn, void* arg); 46 void add (void_fn, void* arg);
46 void batch(void_fn, void* args, int N, size_t stride); 47 void batch(void_fn, void* args, int N, size_t stride);
47 48
48 /*atomic*/ int32_t fPending; 49 SkAtomic<int32_t> fPending;
49 }; 50 };
50 51
51 #endif//SkTaskGroup_DEFINED 52 #endif//SkTaskGroup_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkAtomics.h ('k') | src/core/SkTaskGroup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698