diff options
author | Jamie Gennis <jgennis@google.com> | 2010-07-15 17:29:15 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2010-07-16 13:03:15 -0700 |
commit | 5ee65f0d441ca558bc95b60c1468f2aadfeeddbd (patch) | |
tree | fe143a0721ac44a3d2c34a46ad5240ea2d586f76 /core/jni/android_view_Surface.cpp | |
parent | eec69d2923636b2aaa51df93bacc2b3bbb742736 (diff) | |
download | frameworks_base-5ee65f0d441ca558bc95b60c1468f2aadfeeddbd.zip frameworks_base-5ee65f0d441ca558bc95b60c1468f2aadfeeddbd.tar.gz frameworks_base-5ee65f0d441ca558bc95b60c1468f2aadfeeddbd.tar.bz2 |
Re-use existing Surface objects when reading them from parcels.
This change adds a process-global cache of previously deserialized Surface
objects so that if a Surface object wrapping the same ISurface gets received
again the same Surface can be used. This is important because the 'tail'
pointer in the SharedBufferClient is stored only on the client side, and needs
to be the same for all the Surface objects wrapping an ISurface instance. This
solves the problem by making there only be one Surface object wrapping an
ISurface per process.
Change-Id: I4bf0b8787885c56277622fca053022d2bb638902
Diffstat (limited to 'core/jni/android_view_Surface.cpp')
-rw-r--r-- | core/jni/android_view_Surface.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp index 7305032..c4d6d1b 100644 --- a/core/jni/android_view_Surface.cpp +++ b/core/jni/android_view_Surface.cpp @@ -237,7 +237,7 @@ static void Surface_initParcel(JNIEnv* env, jobject clazz, jobject argParcel) return; } - sp<Surface> sur(Surface::readFromParcel(*parcel, 0)); + sp<Surface> sur(Surface::readFromParcel(*parcel)); setSurface(env, clazz, sur); } @@ -616,8 +616,7 @@ static void Surface_readFromParcel( return; } - const sp<Surface>& curr(getSurface(env, clazz)); - sp<Surface> sur(Surface::readFromParcel(*parcel, curr)); + sp<Surface> sur(Surface::readFromParcel(*parcel)); setSurface(env, clazz, sur); } @@ -729,4 +728,3 @@ int register_android_view_Surface(JNIEnv* env) } }; - |