Bug 1661172 - Register the android UI thread as "AndroidUI" with the profiler. r=geckoview-reviewers,agi

This allows getting profiler markers from that thread, and also shows some limited C++ call stack information.
The stacks aren't complete because we don't know the address at which the thread's stack starts.

Differential Revision: https://phabricator.services.mozilla.com/D97366
This commit is contained in:
Markus Stange 2020-11-17 21:45:40 +00:00
Родитель 7b40f0b246
Коммит 29d637a3c1
1 изменённых файлов: 3 добавлений и 0 удалений

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

@ -15,6 +15,7 @@
#include "mozilla/ThreadEventQueue.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include "GeckoProfiler.h"
#include "nsThread.h"
#include "nsThreadManager.h"
#include "nsThreadUtils.h"
@ -164,6 +165,7 @@ class CreateOnUiThread : public Runnable {
sThread = new AndroidUiThread();
sThread->InitCurrentThread();
sThread->SetObserver(new ThreadObserver());
PROFILER_REGISTER_THREAD("AndroidUI");
sMessageLoop =
new MessageLoop(MessageLoop::TYPE_MOZILLA_ANDROID_UI, sThread.get());
lock.NotifyAll();
@ -193,6 +195,7 @@ class DestroyOnUiThread : public Runnable {
delete sMessageLoop;
sMessageLoop = nullptr;
MOZ_ASSERT(sThread);
PROFILER_UNREGISTER_THREAD();
nsThreadManager::get().UnregisterCurrentThread(*sThread);
sThread = nullptr;
mDestroyed = true;