Loading core/java/android/hardware/HardwareBuffer.java +12 −4 Original line number Diff line number Diff line Loading @@ -277,6 +277,17 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { return new HardwareBuffer(nativeObject); } /** * @hide */ private static NativeAllocationRegistry getRegistry(long size) { final long func = nGetNativeFinalizer(); final Class cls = HardwareBuffer.class; return com.android.libcore.Flags.nativeMetrics() ? NativeAllocationRegistry.createNonmalloced(cls, func, size) : NativeAllocationRegistry.createNonmalloced(cls.getClassLoader(), func, size); } /** * Private use only. See {@link #create(int, int, int, int, long)}. May also be * called from JNI using an already allocated native <code>HardwareBuffer</code>. Loading @@ -285,10 +296,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { private HardwareBuffer(long nativeObject) { mNativeObject = nativeObject; long bufferSize = nEstimateSize(nativeObject); ClassLoader loader = HardwareBuffer.class.getClassLoader(); NativeAllocationRegistry registry = new NativeAllocationRegistry( loader, nGetNativeFinalizer(), bufferSize); mCleaner = registry.registerNativeAllocation(this, mNativeObject); mCleaner = getRegistry(bufferSize).registerNativeAllocation(this, mNativeObject); mCloseGuard.open("HardwareBuffer.close"); } Loading Loading
core/java/android/hardware/HardwareBuffer.java +12 −4 Original line number Diff line number Diff line Loading @@ -277,6 +277,17 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { return new HardwareBuffer(nativeObject); } /** * @hide */ private static NativeAllocationRegistry getRegistry(long size) { final long func = nGetNativeFinalizer(); final Class cls = HardwareBuffer.class; return com.android.libcore.Flags.nativeMetrics() ? NativeAllocationRegistry.createNonmalloced(cls, func, size) : NativeAllocationRegistry.createNonmalloced(cls.getClassLoader(), func, size); } /** * Private use only. See {@link #create(int, int, int, int, long)}. May also be * called from JNI using an already allocated native <code>HardwareBuffer</code>. Loading @@ -285,10 +296,7 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable { private HardwareBuffer(long nativeObject) { mNativeObject = nativeObject; long bufferSize = nEstimateSize(nativeObject); ClassLoader loader = HardwareBuffer.class.getClassLoader(); NativeAllocationRegistry registry = new NativeAllocationRegistry( loader, nGetNativeFinalizer(), bufferSize); mCleaner = registry.registerNativeAllocation(this, mNativeObject); mCleaner = getRegistry(bufferSize).registerNativeAllocation(this, mNativeObject); mCloseGuard.open("HardwareBuffer.close"); } Loading