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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: tools/skpdiff/SkDiffContext.h
diff --git a/tools/skpdiff/SkDiffContext.h b/tools/skpdiff/SkDiffContext.h
index 20193b38514248e77ba6e7a34752cf299a413d14..42282d2f670e32cc4b2515d2cb5db13de80dab17 100644
--- a/tools/skpdiff/SkDiffContext.h
+++ b/tools/skpdiff/SkDiffContext.h
@@ -8,9 +8,11 @@
#ifndef SkDiffContext_DEFINED
#define SkDiffContext_DEFINED
+#include "SkThread.h"
#include "SkString.h"
#include "SkTArray.h"
#include "SkTDArray.h"
+#include "SkTLList.h"
class SkWStream;
class SkImageDiffer;
@@ -110,13 +112,22 @@ private:
SkString fBaselinePath;
SkString fTestPath;
SkTArray<DiffData> fDiffs;
- DiffRecord* fNext;
};
+ // This is needed to work around a bug in the multithreaded case where the
+ // image decoders are crashing when large numbers of threads are invoking
+ // the decoder at the same time.
+ // see https://code.google.com/p/skia/issues/detail?id=1803
+ SkMutex fImageMutex;
+
+ // Used to protect access to fRecords and ensure only one thread is
+ // adding new entries and/or iterating over the existing entries at a time
+ SkMutex fRecordMutex;
mtklein 2013/11/06 14:24:36 You don't seem to grab this mutex when iterating o
djsollen 2013/11/06 15:01:58 I just forgot to clean up that comment after updat
+
// We use linked list for the records so that their pointers remain stable. A resizable array
// might change its pointers, which would make it harder for async diffs to record their
// results.
- DiffRecord * fRecords;
+ SkTLList<DiffRecord> fRecords;
SkImageDiffer** fDiffers;
int fDifferCount;
« 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