Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e3df2fe authored by Eric Miao's avatar Eric Miao Committed by Android (Google) Code Review
Browse files

Merge "Add missing method NativeAllocationRegistry.createMalloced(Class,long)" into main

parents 2c9e768d 0bd6c6bf
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import java.lang.ref.Reference;
public class NativeAllocationRegistry {
    private final long mFreeFunction;
    private static final Cleaner sCleaner = Cleaner.create();
    private static final long DEFAULT_SIZE = 98;

    public static NativeAllocationRegistry createNonmalloced(
            ClassLoader classLoader, long freeFunction, long size) {
@@ -55,6 +56,11 @@ public class NativeAllocationRegistry {
        return new NativeAllocationRegistry(clazz.getClassLoader(), freeFunction, size);
    }

    public static NativeAllocationRegistry createMalloced(
            Class clazz, long freeFunction) {
        return new NativeAllocationRegistry(clazz.getClassLoader(), freeFunction, DEFAULT_SIZE);
    }

    public NativeAllocationRegistry(ClassLoader classLoader, long freeFunction, long size) {
        if (size < 0) {
            throw new IllegalArgumentException("Invalid native allocation size: " + size);