mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 999071 - Don't notify observers in profiler when used by Android ANR reporter; r=BenWa
This commit is contained in:
parent
1bf8764b16
commit
872b83bfe6
@ -283,13 +283,15 @@ void TableTicker::StreamJSObject(JSStreamWriter& b)
|
||||
}
|
||||
}
|
||||
|
||||
// Send a event asking any subprocesses (plugins) to
|
||||
// give us their information
|
||||
SubprocessClosure closure(&b);
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
nsRefPtr<ProfileSaveEvent> pse = new ProfileSaveEvent(SubProcessCallback, &closure);
|
||||
os->NotifyObservers(pse, "profiler-subprocess", nullptr);
|
||||
if (Sampler::CanNotifyObservers()) {
|
||||
// Send a event asking any subprocesses (plugins) to
|
||||
// give us their information
|
||||
SubprocessClosure closure(&b);
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os) {
|
||||
nsRefPtr<ProfileSaveEvent> pse = new ProfileSaveEvent(SubProcessCallback, &closure);
|
||||
os->NotifyObservers(pse, "profiler-subprocess", nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
@ -306,7 +308,6 @@ void TableTicker::StreamJSObject(JSStreamWriter& b)
|
||||
b.EndArray();
|
||||
|
||||
b.EndObject();
|
||||
|
||||
}
|
||||
|
||||
// END SaveProfileTask et al
|
||||
|
@ -698,9 +698,11 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval,
|
||||
|
||||
sIsProfiling = true;
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os)
|
||||
os->NotifyObservers(nullptr, "profiler-started", nullptr);
|
||||
if (Sampler::CanNotifyObservers()) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os)
|
||||
os->NotifyObservers(nullptr, "profiler-started", nullptr);
|
||||
}
|
||||
|
||||
LOG("END mozilla_sampler_start");
|
||||
}
|
||||
@ -749,9 +751,11 @@ void mozilla_sampler_stop()
|
||||
|
||||
sIsProfiling = false;
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os)
|
||||
os->NotifyObservers(nullptr, "profiler-stopped", nullptr);
|
||||
if (Sampler::CanNotifyObservers()) {
|
||||
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||
if (os)
|
||||
os->NotifyObservers(nullptr, "profiler-stopped", nullptr);
|
||||
}
|
||||
|
||||
LOG("END mozilla_sampler_stop");
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "PlatformMacros.h"
|
||||
#include "v8-support.h"
|
||||
#include <vector>
|
||||
@ -353,6 +354,17 @@ class Sampler {
|
||||
static void SetActiveSampler(TableTicker* sampler) { sActiveSampler = sampler; }
|
||||
|
||||
static mozilla::Mutex* sRegisteredThreadsMutex;
|
||||
|
||||
static bool CanNotifyObservers() {
|
||||
#if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK)
|
||||
// Android ANR reporter uses the profiler off the main thread
|
||||
return NS_IsMainThread();
|
||||
#else
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
static std::vector<ThreadInfo*>* sRegisteredThreads;
|
||||
static TableTicker* sActiveSampler;
|
||||
|
Loading…
Reference in New Issue
Block a user