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

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..e87f02f093d372fc9cd3f11663fa01f21ef6cce0 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,21 @@ 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.
+ SkMutex fImageMutex;
scroggo 2013/11/05 21:08:52 Could you create a bug add a link to it here?
+
+ // 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;
+
// 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