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

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

Issue 19803003: Introduce a delay before a high priority binding is unbound (reland). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
Index: base/android/java/src/org/chromium/base/ThreadUtils.java
diff --git a/base/android/java/src/org/chromium/base/ThreadUtils.java b/base/android/java/src/org/chromium/base/ThreadUtils.java
index cdf73c39f97bf90652d38567170741962b6a7518..a880ede1e3dc940b661b1791d3af5a5e04530e02 100644
--- a/base/android/java/src/org/chromium/base/ThreadUtils.java
+++ b/base/android/java/src/org/chromium/base/ThreadUtils.java
@@ -18,8 +18,8 @@ import java.util.concurrent.FutureTask;
public class ThreadUtils {
/**
- * Run the supplied Runnable on the main thread. The method will block until
- * the Runnable completes.
+ * Run the supplied Runnable on the main thread. The method will block until the Runnable
+ * completes.
*
* @param r The Runnable to run.
*/
@@ -38,8 +38,8 @@ public class ThreadUtils {
}
/**
- * Run the supplied Callable on the main thread, wrapping any exceptions in
- * a RuntimeException. The method will block until the Callable completes.
+ * Run the supplied Callable on the main thread, wrapping any exceptions in a RuntimeException.
+ * The method will block until the Callable completes.
*
* @param c The Callable to run
* @return The result of the callable
@@ -53,8 +53,8 @@ public class ThreadUtils {
}
/**
- * Run the supplied Callable on the main thread, The method will block until
- * the Callable completes.
+ * Run the supplied Callable on the main thread, The method will block until the Callable
+ * completes.
*
* @param c The Callable to run
* @return The result of the callable
@@ -71,8 +71,8 @@ public class ThreadUtils {
}
/**
- * Run the supplied FutureTask on the main thread. The method will block
- * only if the current thread is the main thread.
+ * Run the supplied FutureTask on the main thread. The method will block only if the current
+ * thread is the main thread.
*
* @param task The FutureTask to run
* @return The queried task (to aid inline construction)
@@ -87,8 +87,8 @@ public class ThreadUtils {
}
/**
- * Run the supplied Callable on the main thread. The method will block
- * only if the current thread is the main thread.
+ * Run the supplied Callable on the main thread. The method will block only if the current
+ * thread is the main thread.
*
* @param c The Callable to run
* @return A FutureTask wrapping the callable to retrieve results
@@ -98,8 +98,8 @@ public class ThreadUtils {
}
/**
- * Run the supplied Runnable on the main thread. The method will block
- * only if the current thread is the main thread.
+ * Run the supplied Runnable on the main thread. The method will block only if the current
+ * thread is the main thread.
*
* @param r The Runnable to run
*/
@@ -112,8 +112,8 @@ public class ThreadUtils {
}
/**
- * Post the supplied FutureTask to run on the main thread. The method will
- * not block, even if called on the UI thread.
+ * Post the supplied FutureTask to run on the main thread. The method will not block, even if
+ * called on the UI thread.
*
* @param task The FutureTask to run
* @return The queried task (to aid inline construction)
@@ -124,8 +124,8 @@ public class ThreadUtils {
}
/**
- * Post the supplied Runnable to run on the main thread. The method will
- * not block, even if called on the UI thread.
+ * Post the supplied Runnable to run on the main thread. The method will not block, even if
+ * called on the UI thread.
*
* @param task The Runnable to run
*/
@@ -134,6 +134,17 @@ public class ThreadUtils {
}
/**
+ * Post the supplied Runnable to run on the main thread after the given amount of time. The
+ * method will not block, even if called on the UI thread.
+ *
+ * @param task The Runnable to run
+ * @param delayMillis The delay in milliseconds until the Runnable will be run
+ */
+ public static void postOnUiThreadDelayed(Runnable r, long delayMillis) {
+ LazyHolder.sUiThreadHandler.postDelayed(r, delayMillis);
+ }
+
+ /**
* Asserts that the current thread is running on the main thread.
*/
public static void assertOnUiThread() {

Powered by Google App Engine
This is Rietveld 408576698