summaryrefslogtreecommitdiffstats
path: root/libs/hwui/RenderState.h
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-08-26 17:30:15 -0700
committerChris Craik <ccraik@google.com>2014-08-26 17:30:15 -0700
commit1d4774233304c484673e2af2c1de2ab41021c979 (patch)
tree68f78af2c5f7562d7bfd726f7b793831cca4d8b7 /libs/hwui/RenderState.h
parent780617faa2c9b3dbcb902da06a486149c5bddbb3 (diff)
downloadframeworks_base-1d4774233304c484673e2af2c1de2ab41021c979.zip
frameworks_base-1d4774233304c484673e2af2c1de2ab41021c979.tar.gz
frameworks_base-1d4774233304c484673e2af2c1de2ab41021c979.tar.bz2
Crash instead of leaking layers/textures between GL contexts
bug:17208461 Change-Id: I4d58f301cf0f5e8145e808a5d6ade4de7801970b
Diffstat (limited to 'libs/hwui/RenderState.h')
-rw-r--r--libs/hwui/RenderState.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/hwui/RenderState.h b/libs/hwui/RenderState.h
index f7116e2..cd71c73 100644
--- a/libs/hwui/RenderState.h
+++ b/libs/hwui/RenderState.h
@@ -16,6 +16,7 @@
#ifndef RENDERSTATE_H
#define RENDERSTATE_H
+#include <set>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
@@ -37,6 +38,7 @@ class RenderState {
PREVENT_COPY_AND_ASSIGN(RenderState);
public:
void onGLContextCreated();
+ void onGLContextDestroyed();
void setViewport(GLsizei width, GLsizei height);
void getViewport(GLsizei* outWidth, GLsizei* outHeight);
@@ -48,6 +50,13 @@ public:
void debugOverdraw(bool enable, bool clear);
+ void registerLayer(const Layer* layer) {
+ mActiveLayers.insert(layer);
+ }
+ void unregisterLayer(const Layer* layer) {
+ mActiveLayers.erase(layer);
+ }
+
private:
friend class renderthread::RenderThread;
@@ -58,6 +67,7 @@ private:
~RenderState();
Caches* mCaches;
+ std::set<const Layer*> mActiveLayers;
GLsizei mViewportWidth;
GLsizei mViewportHeight;