зеркало из https://github.com/mozilla/gecko-dev.git
bug 1218576 - Ensure remaining batched telemetry is flushed on content process shutdown r=gfritzsche
On content process shutdown we send a content process ping to ensure we have up-to-date data from the content process before it goes away. Now we need to also flush the batched telemetry accumulations to the parent so that it can be present in the ping. No attempt is made to synchronize access to IPCTimerFired. It is safe to re-enter. No attempt is made to cancel the timer as its firing is benign. MozReview-Commit-ID: 1gjNH9IPhKf
This commit is contained in:
Родитель
5a9db54b76
Коммит
26c492926f
|
@ -2359,6 +2359,13 @@ TelemetryImpl::ClearScalars()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelemetryImpl::FlushBatchedChildTelemetry()
|
||||
{
|
||||
TelemetryHistogram::IPCTimerFired(nullptr, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
size_t
|
||||
TelemetryImpl::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
||||
{
|
||||
|
|
|
@ -2596,8 +2596,11 @@ TelemetryHistogram::GetHistogramSizesofIncludingThis(mozilla::MallocSizeOf
|
|||
// It releases the lock before calling out to IPC code which can (and does)
|
||||
// Accumulate (which would deadlock)
|
||||
//
|
||||
// To ensure non-reentrancy, the timer is not released until the method
|
||||
// completes
|
||||
// To ensure we don't loop IPCTimerFired->AccumulateChild->arm timer, we don't
|
||||
// unset gIPCTimerArmed until the IPC completes
|
||||
//
|
||||
// This function may be re-entered. The shared datastructures gAccumulations and
|
||||
// gKeyedAccumulations are guarded by the lock.
|
||||
void
|
||||
TelemetryHistogram::IPCTimerFired(nsITimer* aTimer, void* aClosure)
|
||||
{
|
||||
|
|
|
@ -1838,7 +1838,7 @@ var Impl = {
|
|||
// content-child-shutdown is only registered for content processes.
|
||||
Services.obs.removeObserver(this, "content-child-shutdown");
|
||||
this.uninstall();
|
||||
|
||||
Telemetry.flushBatchedChildTelemetry();
|
||||
this.sendContentProcessPing(REASON_SAVED_SESSION);
|
||||
break;
|
||||
case TOPIC_CYCLE_COLLECTOR_BEGIN:
|
||||
|
|
|
@ -416,4 +416,10 @@ interface nsITelemetry : nsISupports
|
|||
* Resets all the stored scalars. This is intended to be only used in tests.
|
||||
*/
|
||||
void clearScalars();
|
||||
|
||||
/**
|
||||
* Immediately sends any Telemetry batched on this process to the parent
|
||||
* process. This is intended only to be used on process shutdown.
|
||||
*/
|
||||
void flushBatchedChildTelemetry();
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче