From 1b0278c19e004dac80196f1eda257fd08af954a5 Mon Sep 17 00:00:00 2001 From: Bo Liu Date: Thu, 3 Jan 2019 16:36:24 -0800 Subject: [PATCH] Mark GrContext dirty after onContextDestroyed Bug: 120997728 Test: hwui_unit_test passes Change-Id: I8b60c45ebf7904b7026b480541dac78b70a59e0d --- libs/hwui/WebViewFunctorManager.cpp | 5 +++++ libs/hwui/renderthread/RenderThread.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libs/hwui/WebViewFunctorManager.cpp b/libs/hwui/WebViewFunctorManager.cpp index 5b7ae70e821ce..9170d6d1dc508 100644 --- a/libs/hwui/WebViewFunctorManager.cpp +++ b/libs/hwui/WebViewFunctorManager.cpp @@ -18,6 +18,7 @@ #include #include "Properties.h" +#include "renderthread/RenderThread.h" #include #include @@ -90,6 +91,10 @@ void WebViewFunctor::destroyContext() { mHasContext = false; ATRACE_NAME("WebViewFunctor::onContextDestroyed"); mCallbacks.onContextDestroyed(mFunctor, mData); + + // grContext may be null in unit tests. + auto* grContext = renderthread::RenderThread::getInstance().getGrContext(); + if (grContext) grContext->resetContext(); } } diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h index 12666b323d117..5272227509c83 100644 --- a/libs/hwui/renderthread/RenderThread.h +++ b/libs/hwui/renderthread/RenderThread.h @@ -123,6 +123,7 @@ private: friend class RenderProxy; friend class DummyVsyncSource; friend class android::uirenderer::TestUtils; + friend class android::uirenderer::WebViewFunctor; RenderThread(); virtual ~RenderThread();