Bug 790593 - Notify when the profiler starts and stops through the observer service. r=ehsan

This commit is contained in:
Mike Hommey 2012-09-20 19:36:50 +02:00
parent 841e6ae593
commit 4af0818cb7

View File

@ -29,6 +29,8 @@
#include "nsIXULAppInfo.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
// JS
#include "jsdbgapi.h"
@ -1096,6 +1098,10 @@ void mozilla_sampler_start(int aProfileEntries, int aInterval,
t->Start();
if (t->ProfileJS())
stack->enableJSSampling();
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os)
os->NotifyObservers(nullptr, "profiler-started", nullptr);
}
void mozilla_sampler_stop()
@ -1118,6 +1124,10 @@ void mozilla_sampler_stop()
if (disableJS)
stack->disableJSSampling();
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
if (os)
os->NotifyObservers(nullptr, "profiler-stopped", nullptr);
}
bool mozilla_sampler_is_active()