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

Unified Diff: content/public/android/java/src/org/chromium/content/app/LibraryLoader.java

Issue 11566020: Adding extra logs to investigate a crasher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Made findbugs happy Created 8 years 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: content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
diff --git a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
index bd3c5c98caa75c5b622c741d1d7b5996964fe0be..75e40c00e70265e59c959771ceeff85df7d63a9e 100644
--- a/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
+++ b/content/public/android/java/src/org/chromium/content/app/LibraryLoader.java
@@ -145,16 +145,20 @@ public class LibraryLoader {
// This asserts that calls to ensureInitialized() will happen from the
// same thread.
+ private static Object sCheckThreadLock = new Object();
private static Thread sMyThread;
private static void checkThreadUsage() {
- Thread currentThread = java.lang.Thread.currentThread();
- if (sMyThread == null) {
- sMyThread = currentThread;
- } else {
- if (sMyThread != currentThread) {
- Log.e(TAG, "Threading violation detected. My thread=" + sMyThread +
- " but I'm being accessed from thread=" + currentThread);
- assert false;
+ Thread currentThread = Thread.currentThread();
+ synchronized (sCheckThreadLock) {
+ if (sMyThread == null) {
+ sMyThread = currentThread;
+ } else {
+ if (sMyThread != currentThread) {
+ Log.e(TAG, "Threading violation detected. My thread=" + sMyThread + " id=" +
+ sMyThread.getId() + " but I'm being accessed from thread=" +
+ currentThread + " id=" + currentThread.getId());
+ assert false;
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698