summaryrefslogtreecommitdiffstats
path: root/core/jni/android_view_Surface.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-03-23 15:31:21 -0700
committerMathias Agopian <mathias@google.com>2010-03-23 15:31:21 -0700
commitaf1e11b849ea527f4b1b1695924ce42cc9d7f670 (patch)
tree8ec0fb78802fcf7a7e5430efb5723767c8772689 /core/jni/android_view_Surface.cpp
parent1a26c9aa0b96d30fc99eeb10bfd41f966ceb003a (diff)
downloadframeworks_base-af1e11b849ea527f4b1b1695924ce42cc9d7f670.zip
frameworks_base-af1e11b849ea527f4b1b1695924ce42cc9d7f670.tar.gz
frameworks_base-af1e11b849ea527f4b1b1695924ce42cc9d7f670.tar.bz2
one step toward fixing [2501808] sapphire: OOM in GPU Surface area
when a surface was returned from a remote process through the binder we would leak its resources until a GC happened. implement writeToParcel to release the source when PARCELABLE_WRITE_RETURN_VALUE is set Change-Id: I6a9fa369b0d164a9ca1229b8a2944d3c132a3720
Diffstat (limited to 'core/jni/android_view_Surface.cpp')
-rw-r--r--core/jni/android_view_Surface.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 060ca50..ed26cbe 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -35,6 +35,11 @@
namespace android {
+enum {
+ // should match Parcelable.java
+ PARCELABLE_WRITE_RETURN_VALUE = 0x0001
+};
+
// ----------------------------------------------------------------------------
static const char* const OutOfResourcesException =
@@ -612,6 +617,9 @@ static void Surface_writeToParcel(
const sp<SurfaceControl>& control(getSurfaceControl(env, clazz));
SurfaceControl::writeSurfaceToParcel(control, parcel);
+ if (flags & PARCELABLE_WRITE_RETURN_VALUE) {
+ setSurfaceControl(env, clazz, 0);
+ }
}
// ----------------------------------------------------------------------------