| OLD | NEW |
| 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 #include "../private/SkAtomics.h" |
| 13 #include "SkTemplates.h" | 13 #include "SkTemplates.h" |
| 14 | 14 |
| 15 struct SkRunnable; | 15 struct SkRunnable; |
| 16 | 16 |
| 17 class SkTaskGroup : SkNoncopyable { | 17 class SkTaskGroup : SkNoncopyable { |
| 18 public: | 18 public: |
| 19 // Create one of these in main() to enable SkTaskGroups globally. | 19 // Create one of these in main() to enable SkTaskGroups globally. |
| 20 struct Enabler : SkNoncopyable { | 20 struct Enabler : SkNoncopyable { |
| 21 explicit Enabler(int threads = -1); // Default is system-reported core
count. | 21 explicit Enabler(int threads = -1); // Default is system-reported core
count. |
| 22 ~Enabler(); | 22 ~Enabler(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 void(*run_chunk)(Chunk*) = [](Chunk* c) { | 83 void(*run_chunk)(Chunk*) = [](Chunk* c) { |
| 84 for (int i = c->start; i < c->end; i++) { | 84 for (int i = c->start; i < c->end; i++) { |
| 85 (*c->f)(i); | 85 (*c->f)(i); |
| 86 } | 86 } |
| 87 }; | 87 }; |
| 88 SkTaskGroup().batch(run_chunk, chunks.get(), nchunks); | 88 SkTaskGroup().batch(run_chunk, chunks.get(), nchunks); |
| 89 } | 89 } |
| 90 | 90 |
| 91 #endif//SkTaskGroup_DEFINED | 91 #endif//SkTaskGroup_DEFINED |
| OLD | NEW |