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

Unified Diff: tools/skpdiff/SkPMetric.cpp

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
« tools/skpdiff/SkImageDiffer.h ('K') | « tools/skpdiff/SkImageDiffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpdiff/SkPMetric.cpp
diff --git a/tools/skpdiff/SkPMetric.cpp b/tools/skpdiff/SkPMetric.cpp
index a19ed826f8f1cd344708a65dd51ade5beb4b6c0d..5b770b08bdbdee7e5803eb36a9dd317d4d69b6c9 100644
--- a/tools/skpdiff/SkPMetric.cpp
+++ b/tools/skpdiff/SkPMetric.cpp
@@ -430,8 +430,14 @@ const char* SkPMetric::getName() {
int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
double startTime = get_seconds();
+
+ // since we currently synchronously do the diff within queueDiff we only need
+ // to protect the createion of the ID and queuedDiff object.
+ SkAutoMutexAcquire queueLock(fQueueMutex);
int diffID = fQueuedDiffs.count();
QueuedDiff& diff = fQueuedDiffs.push_back();
+ queueLock.release();
+
diff.result = 0.0;
// Ensure the images are comparable
@@ -456,7 +462,8 @@ int SkPMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) {
void SkPMetric::deleteDiff(int id) {
-
+ // clean up the POI array to save space
+ return fQueuedDiffs[id].poi.reset();
}
bool SkPMetric::isFinished(int id) {
« tools/skpdiff/SkImageDiffer.h ('K') | « tools/skpdiff/SkImageDiffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698