summaryrefslogtreecommitdiffstats
path: root/opengl/libs/EGL/egl_cache.h
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-11-07 17:03:54 -0800
committerJamie Gennis <jgennis@google.com>2011-11-08 15:54:36 -0800
commitd90bf3911dd19a93b373680f2bde551c9c3c016b (patch)
tree46f73f4a38456e4a16d63c25caa966a4dfea5ef8 /opengl/libs/EGL/egl_cache.h
parent9cf8b6eadba70aca871faf8ba23825c57ede7cb5 (diff)
downloadframeworks_base-d90bf3911dd19a93b373680f2bde551c9c3c016b.zip
frameworks_base-d90bf3911dd19a93b373680f2bde551c9c3c016b.tar.gz
frameworks_base-d90bf3911dd19a93b373680f2bde551c9c3c016b.tar.bz2
EGL: implement loading and saving the cache
This change adds support for saving and loading the contents of the EGL cache. It also adds some simple tests for the EGL cache. Change-Id: I18e5e789e0897a0783d29d1c1e64d26de2dd44c4
Diffstat (limited to 'opengl/libs/EGL/egl_cache.h')
-rw-r--r--opengl/libs/EGL/egl_cache.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/opengl/libs/EGL/egl_cache.h b/opengl/libs/EGL/egl_cache.h
index 7021752..05d5873 100644
--- a/opengl/libs/EGL/egl_cache.h
+++ b/opengl/libs/EGL/egl_cache.h
@@ -21,6 +21,7 @@
#include <EGL/eglext.h>
#include <utils/BlobCache.h>
+#include <utils/String8.h>
#include <utils/StrongPointer.h>
// ----------------------------------------------------------------------------
@@ -29,7 +30,7 @@ namespace android {
class egl_display_t;
-class egl_cache_t {
+class EGLAPI egl_cache_t {
public:
// get returns a pointer to the singleton egl_cache_t object. This
@@ -60,6 +61,10 @@ public:
EGLsizei getBlob(const void* key, EGLsizei keySize, void* value,
EGLsizei valueSize);
+ // setCacheFilename sets the name of the file that should be used to store
+ // cache contents from one program invocation to another.
+ void setCacheFilename(const char* filename);
+
private:
// Creation and (the lack of) destruction is handled internally.
egl_cache_t();
@@ -96,9 +101,19 @@ private:
// first time it's needed.
sp<BlobCache> mBlobCache;
+ // mFilename is the name of the file for storing cache contents in between
+ // program invocations. It is initialized to an empty string at
+ // construction time, and can be set with the setCacheFilename method. An
+ // empty string indicates that the cache should not be saved to or restored
+ // from disk.
+ String8 mFilename;
+
// mMutex is the mutex used to prevent concurrent access to the member
// variables. It must be locked whenever the member variables are accessed.
mutable Mutex mMutex;
+
+ // sCache is the singleton egl_cache_t object.
+ static egl_cache_t sCache;
};
// ----------------------------------------------------------------------------