Merge "Delete display list objects and resources on the UI thread Bug #6073717 Bug #6065504 Bug #6026515 Bug #5971725"
This commit is contained in:
@@ -679,7 +679,7 @@ static void android_view_GLES20Canvas_resetDisplayListRenderer(JNIEnv* env,
|
||||
|
||||
static void android_view_GLES20Canvas_destroyDisplayList(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
delete displayList;
|
||||
DisplayList::destroyDisplayListDeferred(displayList);
|
||||
}
|
||||
|
||||
static bool android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <utils/String8.h>
|
||||
|
||||
#include "Caches.h"
|
||||
#include "DisplayListRenderer.h"
|
||||
#include "Properties.h"
|
||||
#include "LayerRenderer.h"
|
||||
|
||||
@@ -199,6 +200,13 @@ void Caches::clearGarbage() {
|
||||
LayerRenderer::destroyLayer(layer);
|
||||
}
|
||||
mLayerGarbage.clear();
|
||||
|
||||
count = mDisplayListGarbage.size();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
DisplayList* displayList = mDisplayListGarbage.itemAt(i);
|
||||
delete displayList;
|
||||
}
|
||||
mDisplayListGarbage.clear();
|
||||
}
|
||||
|
||||
void Caches::deleteLayerDeferred(Layer* layer) {
|
||||
@@ -206,6 +214,11 @@ void Caches::deleteLayerDeferred(Layer* layer) {
|
||||
mLayerGarbage.push(layer);
|
||||
}
|
||||
|
||||
void Caches::deleteDisplayListDeferred(DisplayList* displayList) {
|
||||
Mutex::Autolock _l(mGarbageLock);
|
||||
mDisplayListGarbage.push(displayList);
|
||||
}
|
||||
|
||||
void Caches::flush(FlushMode mode) {
|
||||
FLUSH_LOGD("Flushing caches (mode %d)", mode);
|
||||
|
||||
|
||||
@@ -90,6 +90,8 @@ struct CacheLogger {
|
||||
// Caches
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DisplayList;
|
||||
|
||||
class ANDROID_API Caches: public Singleton<Caches> {
|
||||
Caches();
|
||||
|
||||
@@ -141,6 +143,11 @@ public:
|
||||
*/
|
||||
void deleteLayerDeferred(Layer* layer);
|
||||
|
||||
/*
|
||||
* Can be used to delete a display list from a non EGL thread.
|
||||
*/
|
||||
void deleteDisplayListDeferred(DisplayList* layer);
|
||||
|
||||
/**
|
||||
* Binds the VBO used to render simple textured quads.
|
||||
*/
|
||||
@@ -269,6 +276,7 @@ private:
|
||||
|
||||
mutable Mutex mGarbageLock;
|
||||
Vector<Layer*> mLayerGarbage;
|
||||
Vector<DisplayList*> mDisplayListGarbage;
|
||||
|
||||
DebugLevel mDebugLevel;
|
||||
bool mInitialized;
|
||||
|
||||
@@ -101,6 +101,13 @@ DisplayList::~DisplayList() {
|
||||
clearResources();
|
||||
}
|
||||
|
||||
void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) {
|
||||
if (displayList) {
|
||||
DISPLAY_LIST_LOGD("Deferring display list destruction");
|
||||
Caches::getInstance().deleteDisplayListDeferred(displayList);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayList::clearResources() {
|
||||
sk_free((void*) mReader.base());
|
||||
|
||||
|
||||
@@ -119,16 +119,16 @@ public:
|
||||
|
||||
static const char* OP_NAMES[];
|
||||
|
||||
void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false);
|
||||
|
||||
ANDROID_API size_t getSize();
|
||||
ANDROID_API static void destroyDisplayListDeferred(DisplayList* displayList);
|
||||
ANDROID_API static void outputLogBuffer(int fd);
|
||||
|
||||
void initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing = false);
|
||||
|
||||
bool replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flags, uint32_t level = 0);
|
||||
|
||||
void output(OpenGLRenderer& renderer, uint32_t level = 0);
|
||||
|
||||
ANDROID_API static void outputLogBuffer(int fd);
|
||||
|
||||
void setRenderable(bool renderable) {
|
||||
mIsRenderable = renderable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user