Bug 1618625: When resolving a XPCOMEventTarget, set its Java thread name; r=geckoview-reviewers,snorp

Differential Revision: https://phabricator.services.mozilla.com/D64632

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Aaron Klotz 2020-02-27 21:49:54 +00:00
Родитель 11c1a5975d
Коммит cad95f20f4
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -62,6 +62,14 @@ public final class XPCOMEventTarget extends JNIObject implements IXPCOMEventTarg
} else {
throw new RuntimeException("Attempt to assign to unknown thread named " + name);
}
// Ensure that we see the right name in the Java debugger. We don't do this for mMainThread
// because its name was already set (in this context, "main" is the GeckoThread).
if (mMainThread != target) {
target.execute(() -> {
Thread.currentThread().setName(name);
});
}
}
@Override