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

Side by Side Diff: tools/skpdiff/SkDiffContext.h

Issue 60833002: fix multithread related crashes in skpdiff (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 SkDiffContext_DEFINED 8 #ifndef SkDiffContext_DEFINED
9 #define SkDiffContext_DEFINED 9 #define SkDiffContext_DEFINED
10 10
11 #include "SkThread.h"
11 #include "SkString.h" 12 #include "SkString.h"
12 #include "SkTArray.h" 13 #include "SkTArray.h"
13 #include "SkTDArray.h" 14 #include "SkTDArray.h"
15 #include "SkTLList.h"
14 16
15 class SkWStream; 17 class SkWStream;
16 class SkImageDiffer; 18 class SkImageDiffer;
17 19
18 /** 20 /**
19 * Collects records of diffs and outputs them as JSON. 21 * Collects records of diffs and outputs them as JSON.
20 */ 22 */
21 class SkDiffContext { 23 class SkDiffContext {
22 public: 24 public:
23 SkDiffContext(); 25 SkDiffContext();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const char* fDiffName; 105 const char* fDiffName;
104 double fResult; 106 double fResult;
105 SkTDArray<SkIPoint> fPointsOfInterest; 107 SkTDArray<SkIPoint> fPointsOfInterest;
106 }; 108 };
107 109
108 struct DiffRecord { 110 struct DiffRecord {
109 SkString fDifferencePath; 111 SkString fDifferencePath;
110 SkString fBaselinePath; 112 SkString fBaselinePath;
111 SkString fTestPath; 113 SkString fTestPath;
112 SkTArray<DiffData> fDiffs; 114 SkTArray<DiffData> fDiffs;
113 DiffRecord* fNext;
114 }; 115 };
115 116
117 // This is needed to work around a bug in the multithreaded case where the
118 // image decoders are crashing when large numbers of threads are invoking
119 // the decoder at the same time.
120 SkMutex fImageMutex;
scroggo 2013/11/05 21:08:52 Could you create a bug add a link to it here?
121
122 // Used to protect access to fRecords and ensure only one thread is
123 // adding new entries and/or iterating over the existing entries at a time
124 SkMutex fRecordMutex;
125
116 // We use linked list for the records so that their pointers remain stable. A resizable array 126 // We use linked list for the records so that their pointers remain stable. A resizable array
117 // might change its pointers, which would make it harder for async diffs to record their 127 // might change its pointers, which would make it harder for async diffs to record their
118 // results. 128 // results.
119 DiffRecord * fRecords; 129 SkTLList<DiffRecord> fRecords;
120 130
121 SkImageDiffer** fDiffers; 131 SkImageDiffer** fDiffers;
122 int fDifferCount; 132 int fDifferCount;
123 int fThreadCount; 133 int fThreadCount;
124 }; 134 };
125 135
126 #endif 136 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | tools/skpdiff/SkDiffContext.cpp » ('j') | tools/skpdiff/SkDiffContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698