summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderProxy.h
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2021-06-24 17:09:32 -0400
committerJohn Reck <jreck@google.com>2021-06-24 21:58:05 +0000
commitda3559683482a61d93b06bed6f46349f6f01dc63 (patch)
tree210f6c122864d1cbe4cd8ff2c5a057839993c240 /libs/hwui/renderthread/RenderProxy.h
parenta02615b9cc55ae2310bf5de366bc7352a86814e4 (diff)
Delete RenderProxy off of the cleaner thread
Speculation for the cause of an ANR. HardwareRenderer's cleaner can block on RenderThread, which in turn blocks ART's cleaner thread. This can potentially cause other blockages, but it's also poor behavior to have such a long-running Cleaner anyway. Avoid this by putting cleanup to CommonPool. Bug: 191514384 Test: make, CtsUiRenderingTestCases still passes Change-Id: I8190f7862528c3ac39ce636f6fca229322480968
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.h')
-rw-r--r--libs/hwui/renderthread/RenderProxy.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index d575aa77e4ab..f4bcd07b2ef4 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -62,10 +62,14 @@ enum {
* references RenderProxy fields. This is safe as RenderProxy cannot
* be deleted if it is blocked inside a call.
*/
-class RenderProxy {
+class RenderProxy final {
public:
RenderProxy(bool opaque, RenderNode* rootNode, IContextFactory* contextFactory);
- virtual ~RenderProxy();
+ ~RenderProxy();
+
+ // Schedules a delete of the RenderProxy at a later date. Avoids blocking the current thread
+ // on destruction which ~RenderProxy does by default.
+ static void asyncDelete(RenderProxy*);
// Won't take effect until next EGLSurface creation
void setSwapBehavior(SwapBehavior swapBehavior);