From cad95f20f4acfbadadf1e42691bc0e2121c7e218 Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Thu, 27 Feb 2020 21:49:54 +0000 Subject: [PATCH] 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 --- .../java/org/mozilla/gecko/util/XPCOMEventTarget.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/XPCOMEventTarget.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/XPCOMEventTarget.java index fdc46a3e61bb..70ae651780f9 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/XPCOMEventTarget.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/XPCOMEventTarget.java @@ -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