Re-jigger layers
Bug: 15185239 Bug: 15238382 Make DeferredLayerUpdater ref counted so that HardwareLayer:finalizer() works non-crashily on leaked layers Give DeferredLayerUpdater the ability to have a layer destroyer set so that leaked layers can still be recycled on the RenderThread Order layer updates based off of pushLayerUpdate() calls to fix issue with nested layers Change-Id: I4449cee607f7e5126e02fed7464cf48038e3dfdf
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Trace.h>
|
||||
|
||||
#include "../DeferredLayerUpdater.h"
|
||||
#include "../DisplayList.h"
|
||||
#include "../RenderNode.h"
|
||||
#include "CanvasContext.h"
|
||||
@@ -47,17 +48,22 @@ void DrawFrameTask::setContext(RenderThread* thread, CanvasContext* context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
void DrawFrameTask::addLayer(DeferredLayerUpdater* layer) {
|
||||
LOG_ALWAYS_FATAL_IF(!mContext, "Lifecycle violation, there's no context to addLayer with!");
|
||||
void DrawFrameTask::pushLayerUpdate(DeferredLayerUpdater* layer) {
|
||||
LOG_ALWAYS_FATAL_IF(!mContext, "Lifecycle violation, there's no context to pushLayerUpdate with!");
|
||||
|
||||
mLayers.push(layer);
|
||||
for (size_t i = 0; i < mLayers.size(); i++) {
|
||||
if (mLayers[i].get() == layer) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
mLayers.push_back(layer);
|
||||
}
|
||||
|
||||
void DrawFrameTask::removeLayer(DeferredLayerUpdater* layer) {
|
||||
void DrawFrameTask::removeLayerUpdate(DeferredLayerUpdater* layer) {
|
||||
for (size_t i = 0; i < mLayers.size(); i++) {
|
||||
if (mLayers[i] == layer) {
|
||||
mLayers.removeAt(i);
|
||||
break;
|
||||
if (mLayers[i].get() == layer) {
|
||||
mLayers.erase(mLayers.begin() + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +138,16 @@ bool DrawFrameTask::syncFrameState(TreeInfo& info) {
|
||||
mContext->makeCurrent();
|
||||
Caches::getInstance().textureCache.resetMarkInUse();
|
||||
initTreeInfo(info);
|
||||
mContext->prepareDraw(&mLayers, info);
|
||||
|
||||
for (size_t i = 0; i < mLayers.size(); i++) {
|
||||
mContext->processLayerUpdate(mLayers[i].get(), info);
|
||||
}
|
||||
mLayers.clear();
|
||||
if (info.out.hasAnimations) {
|
||||
// TODO: Uh... crap?
|
||||
}
|
||||
mContext->prepareTree(info);
|
||||
|
||||
if (info.out.hasAnimations) {
|
||||
// TODO: dirty calculations, for now just do a full-screen inval
|
||||
mDirty.setEmpty();
|
||||
|
||||
Reference in New Issue
Block a user