Keeping sp<IBinder> around in ClientCache
binderDied is no longer called if all sp references are dropped in SF
process. Keep an sp<IBinder> around so that we can get notified to
clean up the ClientCache/RenderEngine
Bug: b/144371238
Test: build, boot, manual (script to open and close Chrome
repeatedly, check RenderEngine image cache size in dumpsys), SurfaceFlinger_test,
libsurfaceflinger_unittest
Change-Id: Ib9374c02db59e09ca53280acc64419bda6827a4d
diff --git a/services/surfaceflinger/ClientCache.h b/services/surfaceflinger/ClientCache.h
index aa6c80d..d7af7c0 100644
--- a/services/surfaceflinger/ClientCache.h
+++ b/services/surfaceflinger/ClientCache.h
@@ -61,7 +61,8 @@
std::set<wp<ErasedRecipient>> recipients;
};
std::map<wp<IBinder> /*caching process*/,
- std::unordered_map<uint64_t /*cache id*/, ClientCacheBuffer>>
+ std::pair<sp<IBinder> /*strong ref to caching process*/,
+ std::unordered_map<uint64_t /*cache id*/, ClientCacheBuffer>>>
mBuffers GUARDED_BY(mMutex);
class CacheDeathRecipient : public IBinder::DeathRecipient {