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

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

Issue 1918403004: Add Check and DCheck java classes to base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Converted crashing mechanism to throw an AssertionError instead Created 4 years, 4 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 ef2887acd0c97e5c8ca97beb489c1dbe50302d98..9c557e806b4403135a08ec3f41817f3f9161cf94 100644
--- a/base/android/java/src/org/chromium/base/ThreadUtils.java
+++ b/base/android/java/src/org/chromium/base/ThreadUtils.java
@@ -35,9 +35,9 @@ public class ThreadUtils {
public static void setUiThread(Looper looper) {
synchronized (sLock) {
if (sUiThreadHandler != null && sUiThreadHandler.getLooper() != looper) {
- throw new RuntimeException("UI thread looper is already set to "
- + sUiThreadHandler.getLooper() + " (Main thread looper is "
- + Looper.getMainLooper() + "), cannot set to new looper " + looper);
+ Check.notReached("UI thread looper is already set to %1$s (Main thread looper is "
+ + "%2$s), cannot set to new looper %3$s",
+ sUiThreadHandler.getLooper(), Looper.getMainLooper(), looper);
} else {
sUiThreadHandler = new Handler(looper);
}
@@ -47,9 +47,7 @@ public class ThreadUtils {
private static Handler getUiThreadHandler() {
synchronized (sLock) {
if (sUiThreadHandler == null) {
- if (sWillOverride) {
- throw new RuntimeException("Did not yet override the UI thread");
- }
+ Check.isFalse(sWillOverride, "Did not yet override the UI thread");
sUiThreadHandler = new Handler(Looper.getMainLooper());
}
return sUiThreadHandler;
« no previous file with comments | « base/android/java/src/org/chromium/base/Check.java ('k') | base/android/junit/src/org/chromium/base/CheckTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698