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

Commit 1523386d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "PooledLambda"

parents 49639bf6 2f5ee71e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ public class Binder implements IBinder {
        long callingIdentity = clearCallingIdentity();
        Throwable throwableToPropagate = null;
        try {
            action.run();
            action.runOrThrow();
        } catch (Throwable throwable) {
            throwableToPropagate = throwable;
        } finally {
@@ -322,7 +322,7 @@ public class Binder implements IBinder {
        long callingIdentity = clearCallingIdentity();
        Throwable throwableToPropagate = null;
        try {
            return action.get();
            return action.getOrThrow();
        } catch (Throwable throwable) {
            throwableToPropagate = throwable;
            return null; // overridden by throwing in finally block
+19 −1
Original line number Diff line number Diff line
@@ -109,7 +109,9 @@ public final class Message implements Parcelable {
    // sometimes we store linked lists of these things
    /*package*/ Message next;

    private static final Object sPoolSync = new Object();

    /** @hide */
    public static final Object sPoolSync = new Object();
    private static Message sPool;
    private static int sPoolSize = 0;

@@ -370,6 +372,12 @@ public final class Message implements Parcelable {
        return callback;
    }

    /** @hide */
    public Message setCallback(Runnable r) {
        callback = r;
        return this;
    }

    /**
     * Obtains a Bundle of arbitrary data associated with this
     * event, lazily creating it if necessary. Set this value by calling
@@ -410,6 +418,16 @@ public final class Message implements Parcelable {
        this.data = data;
    }

    /**
     * Chainable setter for {@link #what}
     *
     * @hide
     */
    public Message setWhat(int what) {
        this.what = what;
        return this;
    }

    /**
     * Sends this Message to the Handler specified by {@link #getTarget}.
     * Throws a null pointer exception if this field has not been set.
+10 −3
Original line number Diff line number Diff line
@@ -130,22 +130,29 @@ public final class Pools {
    }

    /**
     * Synchronized) pool of objects.
     * Synchronized pool of objects.
     *
     * @param <T> The pooled type.
     */
    public static class SynchronizedPool<T> extends SimplePool<T> {
        private final Object mLock = new Object();
        private final Object mLock;

        /**
         * Creates a new instance.
         *
         * @param maxPoolSize The max pool size.
         * @param lock an optional custom object to synchronize on
         *
         * @throws IllegalArgumentException If the max pool size is less than zero.
         */
        public SynchronizedPool(int maxPoolSize) {
        public SynchronizedPool(int maxPoolSize, Object lock) {
            super(maxPoolSize);
            mLock = lock;
        }

        /** @see #SynchronizedPool(int, Object)  */
        public SynchronizedPool(int maxPoolSize) {
            this(maxPoolSize, new Object());
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.*;
import java.util.function.Function;
import java.util.stream.Stream;

/**
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ public class FunctionalUtils {
     */
    @FunctionalInterface
    public interface ThrowingRunnable {
        void run() throws Exception;
        void runOrThrow() throws Exception;
    }

    /**
@@ -43,7 +43,7 @@ public class FunctionalUtils {
     */
    @FunctionalInterface
    public interface ThrowingSupplier<T> {
        T get() throws Exception;
        T getOrThrow() throws Exception;
    }

    /**
Loading