[SurfaceFlinger] Add log threshold for IGBP leak.
We should emit warning logs if we suspect a leak, so that we have a
better idea what's going on with the system before crashing.
Bug: 149942390
Test: builds, boots
Change-Id: Iff257ad017da19e2866b7a35b6093186da7a4308
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c79621b..50bcc1e 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -972,6 +972,10 @@
// Can't be unordered_set because wp<> isn't hashable
std::set<wp<IBinder>> mGraphicBufferProducerList;
size_t mMaxGraphicBufferProducerListSize = MAX_LAYERS;
+ // If there are more GraphicBufferProducers tracked by SurfaceFlinger than
+ // this threshold, then begin logging.
+ size_t mGraphicBufferProducerListSizeLogThreshold =
+ static_cast<size_t>(0.95 * static_cast<double>(MAX_LAYERS));
// protected by mStateLock (but we could use another lock)
bool mLayersRemoved = false;