зеркало из https://github.com/mozilla/pjs.git
Bug 708962 - Start Telemetry service at application start to avoid deadlock from GetService spinning event loop. r=benjamin
This commit is contained in:
Родитель
1db1e240b1
Коммит
06d61e5a27
|
@ -581,14 +581,7 @@ TelemetryImpl::RecordSlowStatement(const nsACString &statement,
|
|||
const nsACString &dbName,
|
||||
PRUint32 delay)
|
||||
{
|
||||
if (!sTelemetry) {
|
||||
// Make the service manager hold a long-lived reference to the service
|
||||
nsCOMPtr<nsITelemetry> telemetryService =
|
||||
do_GetService("@mozilla.org/base/telemetry;1");
|
||||
if (!telemetryService || !sTelemetry)
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(sTelemetry);
|
||||
if (!sTelemetry->mCanRecord || !sTelemetry->mTrackedDBs.GetEntry(dbName))
|
||||
return;
|
||||
|
||||
|
@ -678,6 +671,14 @@ RecordSlowSQLStatement(const nsACString &statement,
|
|||
TelemetryImpl::RecordSlowStatement(statement, dbName, delay);
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
// Make the service manager hold a long-lived reference to the service
|
||||
nsCOMPtr<nsITelemetry> telemetryService =
|
||||
do_GetService("@mozilla.org/base/telemetry;1");
|
||||
MOZ_ASSERT(telemetryService);
|
||||
}
|
||||
|
||||
} // namespace Telemetry
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ enum ID {
|
|||
HistogramCount
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the Telemetry service on the main thread at startup.
|
||||
*/
|
||||
void Init();
|
||||
|
||||
/**
|
||||
* Adds sample to a histogram defined in TelemetryHistograms.h
|
||||
*
|
||||
|
|
|
@ -140,6 +140,7 @@ extern nsresult nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **)
|
|||
#include "mozilla/FunctionTimer.h"
|
||||
#include "mozilla/Omnijar.h"
|
||||
#include "mozilla/HangMonitor.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
#include "nsChromeRegistry.h"
|
||||
#include "nsChromeProtocolHandler.h"
|
||||
|
@ -536,6 +537,8 @@ NS_InitXPCOM2(nsIServiceManager* *result,
|
|||
|
||||
mozilla::HangMonitor::Startup();
|
||||
|
||||
mozilla::Telemetry::Init();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче