Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2157)

Unified Diff: base/android/java/src/org/chromium/base/Callback.java

Issue 2759963002: Enable Java 8 by default
Patch Set: Add example usage Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/callback_android.cc ('k') | base/android/java/src/org/chromium/base/Promise.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/Callback.java
diff --git a/base/android/java/src/org/chromium/base/Callback.java b/base/android/java/src/org/chromium/base/Callback.java
index ee5857d639e726b68afcac5b41fd519d067ea7b1..75aa7222ad645d5e959b97da9c922fb5fc3501dc 100644
--- a/base/android/java/src/org/chromium/base/Callback.java
+++ b/base/android/java/src/org/chromium/base/Callback.java
@@ -11,27 +11,27 @@ import org.chromium.base.annotations.CalledByNative;
*
* @param <T> The type of the computation's result.
*/
-public abstract class Callback<T> {
+public interface Callback<T> {
/**
* Invoked with the result of a computation.
*/
- public abstract void onResult(T result);
+ void onResult(T result);
@SuppressWarnings("unchecked")
@CalledByNative
- private void onResultFromNative(Object result) {
- onResult((T) result);
+ static void onResultFromNative(Callback callback, Object result) {
+ callback.onResult(result);
}
@SuppressWarnings("unchecked")
@CalledByNative
- private void onResultFromNative(boolean result) {
- onResult((T) Boolean.valueOf(result));
+ static void onResultFromNative(Callback callback, boolean result) {
+ callback.onResult(Boolean.valueOf(result));
}
@SuppressWarnings("unchecked")
@CalledByNative
- private void onResultFromNative(int result) {
- onResult((T) Integer.valueOf(result));
+ static void onResultFromNative(Callback callback, int result) {
+ callback.onResult(Integer.valueOf(result));
}
}
« no previous file with comments | « base/android/callback_android.cc ('k') | base/android/java/src/org/chromium/base/Promise.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698