diff options
| author | Eugene Susla <eugenesusla@google.com> | 2017-06-23 17:25:24 -0700 |
|---|---|---|
| committer | Eugene Susla <eugenesusla@google.com> | 2017-12-05 10:46:59 -0800 |
| commit | 2f5ee71ec851b1149b4e10ec211ad520cd73776e (patch) | |
| tree | 3ecf658e14233141e3bb739070dc454e50d79502 /core/java/android/os/Message.java | |
| parent | e4cf6bf4745754615b19d95a90d809889c5e4b43 (diff) | |
PooledLambda
This introduces PooledLambda - a way of obtaining lambdas without the
allocations overhead.
See PooledLambda javadoc for a guide and PooledLambdaSample for code samples
of useful usages.
Test: ensure samples of PooledLambdaSample work as described.
Change-Id: I46f8ad27bc1de07e19f6e39f89d2cafe4238497a
Diffstat (limited to 'core/java/android/os/Message.java')
| -rw-r--r-- | core/java/android/os/Message.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/core/java/android/os/Message.java b/core/java/android/os/Message.java index d066db1fc4cc..b303e10fa64b 100644 --- a/core/java/android/os/Message.java +++ b/core/java/android/os/Message.java @@ -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 @@ -411,6 +419,16 @@ public final class Message implements Parcelable { } /** + * 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. */ |
