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

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

Issue 684923002: MultiPictureDraw is taskgroup aware. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: actually call Reset() to free the data in each data 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 | « src/core/SkMultiPictureDraw.cpp ('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 "SkRunnable.h" 12
13 struct SkRunnable;
13 14
14 class SkTaskGroup : SkNoncopyable { 15 class SkTaskGroup : SkNoncopyable {
15 public: 16 public:
16 // Create one of these in main() to enable SkTaskGroups globally. 17 // Create one of these in main() to enable SkTaskGroups globally.
17 struct Enabler : SkNoncopyable { 18 struct Enabler : SkNoncopyable {
18 explicit Enabler(int threads = -1); // Default is system-reported core count. 19 explicit Enabler(int threads = -1); // Default is system-reported core count.
19 ~Enabler(); 20 ~Enabler();
20 }; 21 };
21 22
22 SkTaskGroup(); 23 SkTaskGroup();
23 ~SkTaskGroup() { this->wait(); } 24 ~SkTaskGroup() { this->wait(); }
24 25
25 // Add a task to this SkTaskGroup. It will likely run on another thread. 26 // Add a task to this SkTaskGroup. It will likely run on another thread.
26 // Neither add() method takes owership of any of its parameters. 27 // Neither add() method takes owership of any of its parameters.
27 void add(SkRunnable*); 28 void add(SkRunnable*);
28 void add(void (*fn)(void*), void* arg); 29 void add(void (*fn)(void*), void* arg);
29 30
30 // Block until all Tasks previously add()ed to this SkTaskGroup have run. 31 // Block until all Tasks previously add()ed to this SkTaskGroup have run.
31 // You may safely reuse this SkTaskGroup after wait() returns. 32 // You may safely reuse this SkTaskGroup after wait() returns.
32 void wait(); 33 void wait();
33 34
34 private: 35 private:
35 /*atomic*/ int32_t fPending; 36 /*atomic*/ int32_t fPending;
36 }; 37 };
37 38
38 #endif//SkTaskGroup_DEFINED 39 #endif//SkTaskGroup_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkMultiPictureDraw.cpp ('k') | src/core/SkTaskGroup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698