Merge "Surface: Release references to BlastBufferQueue and SurfaceControl on Surface#destroy" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f632b44030
@@ -98,6 +98,7 @@ public class Surface implements Parcelable {
|
||||
|
||||
private static native int nativeSetFrameRate(
|
||||
long nativeObject, float frameRate, int compatibility, int changeFrameRateStrategy);
|
||||
private static native void nativeDestroy(long nativeObject);
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<Surface> CREATOR =
|
||||
new Parcelable.Creator<Surface>() {
|
||||
@@ -339,6 +340,9 @@ public class Surface implements Parcelable {
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
public void destroy() {
|
||||
if (mNativeObject != 0) {
|
||||
nativeDestroy(mNativeObject);
|
||||
}
|
||||
release();
|
||||
}
|
||||
|
||||
|
||||
@@ -903,7 +903,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
||||
mSurfaceAlpha = 1f;
|
||||
|
||||
synchronized (mSurfaceControlLock) {
|
||||
mSurface.release();
|
||||
mSurface.destroy();
|
||||
if (mBlastBufferQueue != null) {
|
||||
mBlastBufferQueue.destroy();
|
||||
mBlastBufferQueue = null;
|
||||
|
||||
@@ -449,6 +449,11 @@ static jint nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong nativeObject, jf
|
||||
int(changeFrameRateStrategy));
|
||||
}
|
||||
|
||||
static void nativeDestroy(JNIEnv* env, jclass clazz, jlong nativeObject) {
|
||||
sp<Surface> surface(reinterpret_cast<Surface*>(nativeObject));
|
||||
surface->destroy();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static const JNINativeMethod gSurfaceMethods[] = {
|
||||
@@ -477,6 +482,7 @@ static const JNINativeMethod gSurfaceMethods[] = {
|
||||
{"nativeSetAutoRefreshEnabled", "(JZ)I", (void*)nativeSetAutoRefreshEnabled},
|
||||
{"nativeSetFrameRate", "(JFII)I", (void*)nativeSetFrameRate},
|
||||
{"nativeGetFromBlastBufferQueue", "(JJ)J", (void*)nativeGetFromBlastBufferQueue},
|
||||
{"nativeDestroy", "(J)V", (void*)nativeDestroy},
|
||||
};
|
||||
|
||||
int register_android_view_Surface(JNIEnv* env)
|
||||
|
||||
Reference in New Issue
Block a user