summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorppi@chromium.org <ppi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 21:52:41 +0000
committerppi@chromium.org <ppi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-18 21:52:41 +0000
commit1aaf3f192c62c191ae1d71f10b8001a85799107a (patch)
treed5b729582cd1b554a9ea887fc54c67c5b779cc32 /base
parent3252b9d550c211ebbc33d82eee0ac09b3e61808c (diff)
downloadchromium_src-1aaf3f192c62c191ae1d71f10b8001a85799107a.zip
chromium_src-1aaf3f192c62c191ae1d71f10b8001a85799107a.tar.gz
chromium_src-1aaf3f192c62c191ae1d71f10b8001a85799107a.tar.bz2
Introduce a delay before a high priority binding is unbound.
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 BUG=261339 Review URL: https://chromiumcodereview.appspot.com/19564005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-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() {