Index: tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp |
diff --git a/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp b/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp |
index f2a02c1c1823972793a9af7685910e6d46ec4d06..dcb99dd9d6494ffea4d484ad6f45e2c178861bb1 100644 |
--- a/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp |
+++ b/tools/skpdiff/SkDifferentPixelsMetric_opencl.cpp |
@@ -48,9 +48,14 @@ const char* SkDifferentPixelsMetric::getName() { |
} |
int SkDifferentPixelsMetric::queueDiff(SkBitmap* baseline, SkBitmap* test) { |
- int diffID = fQueuedDiffs.count(); |
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(); |
+ queueLock.release(); |
// If we never end up running the kernel, include some safe defaults in the result. |
diff->finished = false; |