Remove sync flush
Bug: 13952590
It was attempting to flush state changes after the canvas was
destroyed, which caused layer updates to crash.
Due to the removal of SetDisplayListData, the sync mode isn't able
to do anything ever, so remove it.
Change-Id: I1e18ce288d81fd47cc6e612afda9476f75ecef2e
diff --git a/libs/hwui/DeferredLayerUpdater.cpp b/libs/hwui/DeferredLayerUpdater.cpp
index c64c169..8b23955 100644
--- a/libs/hwui/DeferredLayerUpdater.cpp
+++ b/libs/hwui/DeferredLayerUpdater.cpp
@@ -41,6 +41,7 @@
DeferredLayerUpdater::~DeferredLayerUpdater() {
SkSafeUnref(mColorFilter);
+ setTransform(0);
if (mLayer) {
mCaches.resourceCache.decrementRefcount(mLayer);
}
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index c5122e2..a39abc3 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -387,6 +387,7 @@
void CanvasContext::processLayerUpdates(const Vector<DeferredLayerUpdater*>* layerUpdaters,
bool* hasFunctors) {
+ LOG_ALWAYS_FATAL_IF(!mCanvas, "Cannot process layer updates without a canvas!");
mGlobalContext->makeCurrent(mEglSurface);
for (size_t i = 0; i < layerUpdaters->size(); i++) {
DeferredLayerUpdater* update = layerUpdaters->itemAt(i);
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index 372d0d0..cf6c8db 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -30,7 +30,7 @@
namespace uirenderer {
namespace renderthread {
-DrawFrameTask::DrawFrameTask() : mContext(0), mTaskMode(MODE_INVALID), mRenderNode(0) {
+DrawFrameTask::DrawFrameTask() : mContext(0), mRenderNode(0) {
}
DrawFrameTask::~DrawFrameTask() {
@@ -69,23 +69,14 @@
LOG_ALWAYS_FATAL_IF(!mRenderNode.get(), "Cannot drawFrame with no render node!");
LOG_ALWAYS_FATAL_IF(!mContext, "Cannot drawFrame with no CanvasContext!");
- postAndWait(renderThread, MODE_FULL);
+ postAndWait(renderThread);
// Reset the single-frame data
mDirty.setEmpty();
mRenderNode = 0;
}
-void DrawFrameTask::flushStateChanges(RenderThread* renderThread) {
- LOG_ALWAYS_FATAL_IF(!mContext, "Cannot drawFrame with no CanvasContext!");
-
- postAndWait(renderThread, MODE_STATE_ONLY);
-}
-
-void DrawFrameTask::postAndWait(RenderThread* renderThread, TaskMode mode) {
- LOG_ALWAYS_FATAL_IF(mode == MODE_INVALID, "That's not a real mode, silly!");
-
- mTaskMode = mode;
+void DrawFrameTask::postAndWait(RenderThread* renderThread) {
AutoMutex _lock(mLock);
renderThread->queue(this);
mSignal.wait(mLock);
@@ -97,11 +88,6 @@
// canUnblockUiThread is temporary until WebView has a solution for syncing frame state
bool canUnblockUiThread = syncFrameState();
- if (mTaskMode == MODE_STATE_ONLY) {
- unblockUiThread();
- return;
- }
-
// Grab a copy of everything we need
Rect dirtyCopy(mDirty);
sp<RenderNode> renderNode = mRenderNode;
@@ -125,12 +111,9 @@
bool hasFunctors = false;
mContext->processLayerUpdates(&mLayers, &hasFunctors);
- // If we don't have an mRenderNode this is a state flush only
- if (mRenderNode.get()) {
- TreeInfo info = {0};
- mRenderNode->prepareTree(info);
- hasFunctors |= info.hasFunctors;
- }
+ TreeInfo info = {0};
+ mRenderNode->prepareTree(info);
+ hasFunctors |= info.hasFunctors;
return !hasFunctors;
}
diff --git a/libs/hwui/renderthread/DrawFrameTask.h b/libs/hwui/renderthread/DrawFrameTask.h
index a512408..055d4cf 100644
--- a/libs/hwui/renderthread/DrawFrameTask.h
+++ b/libs/hwui/renderthread/DrawFrameTask.h
@@ -56,18 +56,11 @@
void setRenderNode(RenderNode* renderNode);
void setDirty(int left, int top, int right, int bottom);
void drawFrame(RenderThread* renderThread);
- void flushStateChanges(RenderThread* renderThread);
virtual void run();
private:
- enum TaskMode {
- MODE_INVALID,
- MODE_FULL,
- MODE_STATE_ONLY,
- };
-
- void postAndWait(RenderThread* renderThread, TaskMode mode);
+ void postAndWait(RenderThread* renderThread);
bool syncFrameState();
void unblockUiThread();
static void drawRenderNode(CanvasContext* context, RenderNode* renderNode, Rect* dirty);
@@ -80,7 +73,6 @@
/*********************************************
* Single frame data
*********************************************/
- TaskMode mTaskMode;
sp<RenderNode> mRenderNode;
Rect mDirty;
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 49b9aca..5ab43b5 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -75,9 +75,6 @@
void RenderProxy::destroyContext() {
if (mContext) {
- // Flush any pending changes to ensure all garbage is destroyed
- mDrawFrameTask.flushStateChanges(&mRenderThread);
-
SETUP_TASK(destroyContext);
args->context = mContext;
mContext = 0;
@@ -149,10 +146,6 @@
}
void RenderProxy::destroyCanvas() {
- // If the canvas is being destroyed we won't be drawing again anytime soon
- // So flush any pending state changes to allow for resource cleanup.
- mDrawFrameTask.flushStateChanges(&mRenderThread);
-
SETUP_TASK(destroyCanvas);
args->context = mContext;
post(task);