summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderProxy.cpp
diff options
context:
space:
mode:
authorRob Carr <racarr@google.com>2021-06-25 02:18:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-06-25 02:18:17 +0000
commit472d962453e89c3c9da5c6d0aa024978ca534b4d (patch)
treea78ecfd15781dbb139f86115d5c704ca94e9c59f /libs/hwui/renderthread/RenderProxy.cpp
parent4a9037a8cdad62c2b0b20de37696a3ee135679fa (diff)
parentda3559683482a61d93b06bed6f46349f6f01dc63 (diff)
Merge "Delete RenderProxy off of the cleaner thread" into sc-dev
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index a77b5b569907..e538a92fbd97 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -26,6 +26,7 @@
#include "renderthread/CanvasContext.h"
#include "renderthread/RenderTask.h"
#include "renderthread/RenderThread.h"
+#include "thread/CommonPool.h"
#include "utils/Macros.h"
#include "utils/TimeUtils.h"
@@ -42,6 +43,17 @@ RenderProxy::RenderProxy(bool translucent, RenderNode* rootRenderNode,
mDrawFrameTask.setContext(&mRenderThread, mContext, rootRenderNode);
}
+void RenderProxy::asyncDelete(RenderProxy* proxy) {
+ if (!proxy) return;
+
+ if (proxy->mContext) {
+ // Use the common pool because ~RenderProxy blocks on calling into RenderThread
+ CommonPool::post([proxy]() { delete proxy; });
+ } else {
+ delete proxy;
+ }
+}
+
RenderProxy::~RenderProxy() {
destroyContext();
}