mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 02:05:42 +00:00
Bug 1455006 - Use Looper to get main thread instead of main thread name. r=jchen
Actually, Gecko uses thread name "main" to find main thread. But Android has Looper object to get main loop. So we should use it instead. MozReview-Commit-ID: 9oVqftqLZmh --HG-- extra : rebase_source : 84593b794f9055739a10a08ca2b4fa737043100c
This commit is contained in:
parent
ea9422f7e0
commit
8b264ece4d
@ -5,6 +5,7 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.os.Looper;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@ -78,14 +79,7 @@ public class GeckoJavaSampler {
|
||||
mSamplePos = 0;
|
||||
|
||||
// Find the main thread
|
||||
Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
|
||||
for (Thread t : threadSet) {
|
||||
if (t.getName().compareToIgnoreCase("main") == 0) {
|
||||
sMainThread = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sMainThread = Looper.getMainLooper().getThread();
|
||||
if (sMainThread == null) {
|
||||
Log.e(LOGTAG, "Main thread not found");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user