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

Side by Side Diff: base/android/java/src/org/chromium/base/ThreadUtils.java

Issue 2181053002: android: dcheck_always_on sets BuildConfig.IS_DCHECK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix findbugs 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.base; 5 package org.chromium.base;
6 6
7 import android.os.Handler; 7 import android.os.Handler;
8 import android.os.Looper; 8 import android.os.Looper;
9 import android.os.Process; 9 import android.os.Process;
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 */ 182 */
183 @VisibleForTesting 183 @VisibleForTesting
184 public static void postOnUiThreadDelayed(Runnable task, long delayMillis) { 184 public static void postOnUiThreadDelayed(Runnable task, long delayMillis) {
185 getUiThreadHandler().postDelayed(task, delayMillis); 185 getUiThreadHandler().postDelayed(task, delayMillis);
186 } 186 }
187 187
188 /** 188 /**
189 * Asserts that the current thread is running on the main thread. 189 * Asserts that the current thread is running on the main thread.
190 */ 190 */
191 public static void assertOnUiThread() { 191 public static void assertOnUiThread() {
192 if (BuildConfig.IS_DEBUG && !runningOnUiThread()) { 192 if (BuildConfig.DCHECK_IS_ON && !runningOnUiThread()) {
193 throw new IllegalStateException("Must be called on the Ui thread."); 193 throw new IllegalStateException("Must be called on the Ui thread.");
194 } 194 }
195 } 195 }
196 196
197 /** 197 /**
198 * @return true iff the current thread is the main (UI) thread. 198 * @return true iff the current thread is the main (UI) thread.
199 */ 199 */
200 public static boolean runningOnUiThread() { 200 public static boolean runningOnUiThread() {
201 return getUiThreadHandler().getLooper() == Looper.myLooper(); 201 return getUiThreadHandler().getLooper() == Looper.myLooper();
202 } 202 }
(...skipping 13 matching lines...) Expand all
216 /** 216 /**
217 * Checks whether Thread priority is THREAD_PRIORITY_AUDIO or not. 217 * Checks whether Thread priority is THREAD_PRIORITY_AUDIO or not.
218 * @param tid Thread id. 218 * @param tid Thread id.
219 * @return true for THREAD_PRIORITY_AUDIO and false otherwise. 219 * @return true for THREAD_PRIORITY_AUDIO and false otherwise.
220 */ 220 */
221 @CalledByNative 221 @CalledByNative
222 private static boolean isThreadPriorityAudio(int tid) { 222 private static boolean isThreadPriorityAudio(int tid) {
223 return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_AUDIO; 223 return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_AUDIO;
224 } 224 }
225 } 225 }
OLDNEW
« no previous file with comments | « base/android/java/src/org/chromium/base/BaseChromiumApplication.java ('k') | base/android/java/templates/BuildConfig.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698