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

Side by Side Diff: tests/PathOpsThreadedCommon.h

Issue 13958005: path ops : remove countdown overkill (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/PathOpsThreadedCommon.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 2012 Google Inc. 2 * Copyright 2012 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 #ifndef PathOpsThreadedCommon_DEFINED 7 #ifndef PathOpsThreadedCommon_DEFINED
8 #define PathOpsThreadedCommon_DEFINED 8 #define PathOpsThreadedCommon_DEFINED
9 9
10 #include "SkCountdown.h" 10 #include "SkCountdown.h"
(...skipping 18 matching lines...) Expand all
29 const char* fKey; 29 const char* fKey;
30 char fSerialNo[9]; 30 char fSerialNo[9];
31 skiatest::Reporter* fReporter; 31 skiatest::Reporter* fReporter;
32 SkBitmap* fBitmap; 32 SkBitmap* fBitmap;
33 }; 33 };
34 34
35 class PathOpsThreadedTestRunner { 35 class PathOpsThreadedTestRunner {
36 public: 36 public:
37 PathOpsThreadedTestRunner(skiatest::Reporter* reporter, int threadCount) 37 PathOpsThreadedTestRunner(skiatest::Reporter* reporter, int threadCount)
38 : fNumThreads(threadCount) 38 : fNumThreads(threadCount)
39 , fThreadPool(threadCount)
40 , fCountdown(threadCount)
41 , fReporter(reporter) { 39 , fReporter(reporter) {
42 } 40 }
43 41
44 ~PathOpsThreadedTestRunner(); 42 ~PathOpsThreadedTestRunner();
45 43
46 void render(); 44 void render();
47 45
48 public: 46 public:
49 int fNumThreads; 47 int fNumThreads;
50 SkTDArray<PathOpsThreadedRunnable*> fRunnables; 48 SkTDArray<PathOpsThreadedRunnable*> fRunnables;
51 SkThreadPool fThreadPool;
52 SkCountdown fCountdown;
53 skiatest::Reporter* fReporter; 49 skiatest::Reporter* fReporter;
54 }; 50 };
55 51
56 class PathOpsThreadedRunnable : public SkRunnable { 52 class PathOpsThreadedRunnable : public SkRunnable {
57 public: 53 public:
58 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), int a, int b, int c, int d, 54 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), int a, int b, int c, int d,
59 PathOpsThreadedTestRunner* runner) { 55 PathOpsThreadedTestRunner* runner) {
60 fState.fA = a; 56 fState.fA = a;
61 fState.fB = b; 57 fState.fB = b;
62 fState.fC = c; 58 fState.fC = c;
63 fState.fD = d; 59 fState.fD = d;
64 fState.fReporter = runner->fReporter; 60 fState.fReporter = runner->fReporter;
65 fTestFun = testFun; 61 fTestFun = testFun;
66 fDone = &runner->fCountdown;
67 } 62 }
68 63
69 virtual void run() SK_OVERRIDE { 64 virtual void run() SK_OVERRIDE {
70 SkBitmap bitmap; 65 SkBitmap bitmap;
71 fState.fBitmap = &bitmap; 66 fState.fBitmap = &bitmap;
72 char pathStr[PATH_STR_SIZE]; 67 char pathStr[PATH_STR_SIZE];
73 fState.fPathStr = pathStr; 68 fState.fPathStr = pathStr;
74 (*fTestFun)(&fState); 69 (*fTestFun)(&fState);
75 fDone->run();
76 } 70 }
77 71
78 private: 72 private:
79 PathOpsThreadState fState; 73 PathOpsThreadState fState;
80 void (*fTestFun)(PathOpsThreadState*); 74 void (*fTestFun)(PathOpsThreadState*);
81 SkRunnable* fDone;
82 }; 75 };
83 76
84 #endif 77 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/PathOpsThreadedCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698