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

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

Issue 1413973002: Modifications to get 'blaze build -c opt //third_party/skia/HEAD/...' to work. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/core/SkStream.cpp ('k') | src/gpu/GrContext.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
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const Func* f; 62 const Func* f;
63 int start, end; 63 int start, end;
64 }; 64 };
65 65
66 // TODO(mtklein): this chunking strategy could probably use some tuning. 66 // TODO(mtklein): this chunking strategy could probably use some tuning.
67 int max_chunks = sk_num_cores() * 2, 67 int max_chunks = sk_num_cores() * 2,
68 stride = (end + max_chunks - 1 ) / max_chunks, 68 stride = (end + max_chunks - 1 ) / max_chunks,
69 nchunks = (end + stride - 1 ) / stride; 69 nchunks = (end + stride - 1 ) / stride;
70 SkASSERT(nchunks <= max_chunks); 70 SkASSERT(nchunks <= max_chunks);
71 71
72 #if defined(GOOGLE3)
73 // Stack frame size is limited in GOOGLE3.
74 SkAutoSTMalloc<512, Chunk> chunks(nchunks);
75 #else
72 // With the chunking strategy above this won't malloc until we have a machin e with >512 cores. 76 // With the chunking strategy above this won't malloc until we have a machin e with >512 cores.
73 SkAutoSTMalloc<1024, Chunk> chunks(nchunks); 77 SkAutoSTMalloc<1024, Chunk> chunks(nchunks);
78 #endif
74 79
75 for (int i = 0; i < nchunks; i++) { 80 for (int i = 0; i < nchunks; i++) {
76 Chunk& c = chunks[i]; 81 Chunk& c = chunks[i];
77 c.f = &f; 82 c.f = &f;
78 c.start = i * stride; 83 c.start = i * stride;
79 c.end = SkTMin(c.start + stride, end); 84 c.end = SkTMin(c.start + stride, end);
80 SkASSERT(c.start < c.end); // Nothing will break if start >= end, but i t's a wasted chunk. 85 SkASSERT(c.start < c.end); // Nothing will break if start >= end, but i t's a wasted chunk.
81 } 86 }
82 87
83 void(*run_chunk)(Chunk*) = [](Chunk* c) { 88 void(*run_chunk)(Chunk*) = [](Chunk* c) {
84 for (int i = c->start; i < c->end; i++) { 89 for (int i = c->start; i < c->end; i++) {
85 (*c->f)(i); 90 (*c->f)(i);
86 } 91 }
87 }; 92 };
88 SkTaskGroup().batch(run_chunk, chunks.get(), nchunks); 93 SkTaskGroup().batch(run_chunk, chunks.get(), nchunks);
89 } 94 }
90 95
91 #endif//SkTaskGroup_DEFINED 96 #endif//SkTaskGroup_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkStream.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698