make ResourceCache for display lists thread-safe

Change-Id: I41885b4ae249d7d7c000bab17bf32340ba85ab3a
diff --git a/libs/hwui/ResourceCache.h b/libs/hwui/ResourceCache.h
index 2256fd1..b0abe2c 100644
--- a/libs/hwui/ResourceCache.h
+++ b/libs/hwui/ResourceCache.h
@@ -70,6 +70,13 @@
     void deleteResourceReference(void* resource, ResourceReference* ref);
     void incrementRefcount(void* resource, ResourceType resourceType);
     void logCache();
+
+    /**
+     * Used to increment, decrement, and destroy. Incrementing is generally accessed on the UI
+     * thread, but destroying resources may be called from the GC thread, the finalizer thread,
+     * or a reference queue finalization thread.
+     */
+    mutable Mutex mLock;
 };
 
 }; // namespace uirenderer