summaryrefslogtreecommitdiffstats
path: root/base/android
diff options
context:
space:
mode:
authorppi@chromium.org <ppi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 20:49:48 +0000
committerppi@chromium.org <ppi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 20:49:48 +0000
commit273c0de41030ddf3def46e824edd79f3eff21c3d (patch)
tree6b534e8f7f9b4f6a3738d983610c97d08bcaac94 /base/android
parent7445a2a040766fd6066e08f341149aa5315d934d (diff)
downloadchromium_src-273c0de41030ddf3def46e824edd79f3eff21c3d.zip
chromium_src-273c0de41030ddf3def46e824edd79f3eff21c3d.tar.gz
chromium_src-273c0de41030ddf3def46e824edd79f3eff21c3d.tar.bz2
Introduce a delay before a high priority binding is unbound (reland).
This patch delays unbinding high priority connections for child services. This makes sure that the renderers are not killed immediately after they are unbound, which is neccessary to mitigate technical issues[1] with the way renderers are being bound and strengthens the mechanism against possible misbehavior of the system LRU process management. [1] For instance, a content view can be detached for a quick moment while the embedder displays a short-lived animation (e.g. opening a link in a background tab) - we definitely don't want the underlying renderer to die during that period. BUG=259576 Review URL: https://chromiumcodereview.appspot.com/19803003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android')
-rw-r--r--base/android/java/src/org/chromium/base/ThreadUtils.java43
1 files changed, 27 insertions, 16 deletions
diff --git a/base/android/java/src/org/chromium/base/ThreadUtils.java b/base/android/java/src/org/chromium/base/ThreadUtils.java
index cdf73c3..a880ede 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() {