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:
Makoto Kato 2018-05-24 20:46:18 +09:00
Родитель ea9422f7e0
Коммит 8b264ece4d
1 изменённых файлов: 2 добавлений и 8 удалений

Просмотреть файл

@ -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;