#446 + #334: trim refresh driver further; restore old Tele removal

This commit is contained in:
Cameron Kaiser 2019-03-25 20:48:57 -07:00
parent b22dfbd773
commit 4594eee516
2 changed files with 28 additions and 12 deletions

View File

@ -430,9 +430,11 @@ private:
void OnTimerStart() void OnTimerStart()
{ {
#if(0)
if (!XRE_IsParentProcess()) { if (!XRE_IsParentProcess()) {
mLastChildTick = TimeStamp::Now(); mLastChildTick = TimeStamp::Now();
} }
#endif
} }
private: private:
@ -440,6 +442,7 @@ private:
void RecordTelemetryProbes(TimeStamp aVsyncTimestamp) void RecordTelemetryProbes(TimeStamp aVsyncTimestamp)
{ {
#if(0)
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
#ifndef ANDROID /* bug 1142079 */ #ifndef ANDROID /* bug 1142079 */
if (XRE_IsParentProcess()) { if (XRE_IsParentProcess()) {
@ -467,20 +470,23 @@ private:
mVsyncRate = mVsyncRefreshDriverTimer->mVsyncChild->GetVsyncRate(); mVsyncRate = mVsyncRefreshDriverTimer->mVsyncChild->GetVsyncRate();
} }
#endif #endif
#endif
} }
void TickRefreshDriver(TimeStamp aVsyncTimestamp) void TickRefreshDriver(TimeStamp aVsyncTimestamp)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
RecordTelemetryProbes(aVsyncTimestamp); //RecordTelemetryProbes(aVsyncTimestamp);
if (XRE_IsParentProcess()) { //if (XRE_IsParentProcess()) {
{ // Make sure the lock expires before we leave this block.
MonitorAutoLock lock(mRefreshTickLock); MonitorAutoLock lock(mRefreshTickLock);
aVsyncTimestamp = mRecentVsync; aVsyncTimestamp = mRecentVsync;
mProcessedVsync = true; mProcessedVsync = true;
} else {
mLastChildTick = TimeStamp::Now();
} }
//} else {
// mLastChildTick = TimeStamp::Now();
//}
MOZ_ASSERT(aVsyncTimestamp <= TimeStamp::Now()); MOZ_ASSERT(aVsyncTimestamp <= TimeStamp::Now());
// We might have a problem that we call ~VsyncRefreshDriverTimer() before // We might have a problem that we call ~VsyncRefreshDriverTimer() before
@ -504,9 +510,10 @@ private:
virtual ~VsyncRefreshDriverTimer() virtual ~VsyncRefreshDriverTimer()
{ {
if (XRE_IsParentProcess()) { //if (XRE_IsParentProcess()) {
mVsyncDispatcher->SetParentRefreshTimer(nullptr); mVsyncDispatcher->SetParentRefreshTimer(nullptr);
mVsyncDispatcher = nullptr; mVsyncDispatcher = nullptr;
#if(0)
} else { } else {
// Since the PVsyncChild actors live through the life of the process, just // Since the PVsyncChild actors live through the life of the process, just
// send the unobserveVsync message to disable vsync event. We don't need // send the unobserveVsync message to disable vsync event. We don't need
@ -516,6 +523,7 @@ private:
mVsyncChild->SetVsyncObserver(nullptr); mVsyncChild->SetVsyncObserver(nullptr);
mVsyncChild = nullptr; mVsyncChild = nullptr;
} }
#endif
// Detach current vsync timer from this VsyncObserver. The observer will no // Detach current vsync timer from this VsyncObserver. The observer will no
// longer tick this timer. // longer tick this timer.
@ -531,12 +539,12 @@ private:
mLastFireEpoch = JS_Now(); mLastFireEpoch = JS_Now();
mLastFireTime = TimeStamp::Now(); mLastFireTime = TimeStamp::Now();
if (XRE_IsParentProcess()) { //if (XRE_IsParentProcess()) {
mVsyncDispatcher->SetParentRefreshTimer(mVsyncObserver); mVsyncDispatcher->SetParentRefreshTimer(mVsyncObserver);
} else { //} else {
Unused << mVsyncChild->SendObserve(); // Unused << mVsyncChild->SendObserve();
mVsyncObserver->OnTimerStart(); // mVsyncObserver->OnTimerStart();
} //}
++sActiveVsyncTimers; ++sActiveVsyncTimers;
} }
@ -832,14 +840,14 @@ CreateVsyncRefreshTimer()
return; return;
} }
if (XRE_IsParentProcess()) { //if (XRE_IsParentProcess()) {
// Make sure all vsync systems are ready. // Make sure all vsync systems are ready.
gfxPlatform::GetPlatform(); gfxPlatform::GetPlatform();
// In parent process, we don't need to use ipc. We can create the // In parent process, we don't need to use ipc. We can create the
// VsyncRefreshDriverTimer directly. // VsyncRefreshDriverTimer directly.
sRegularRateTimer = new VsyncRefreshDriverTimer(); sRegularRateTimer = new VsyncRefreshDriverTimer();
return; return;
} //}
#ifdef MOZ_NUWA_PROCESS #ifdef MOZ_NUWA_PROCESS
// NUWA process will just use software timer. Use NuwaAddFinalConstructor() // NUWA process will just use software timer. Use NuwaAddFinalConstructor()
@ -1878,8 +1886,10 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
} }
} }
#if(0)
#ifndef ANDROID /* bug 1142079 */ #ifndef ANDROID /* bug 1142079 */
mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::REFRESH_DRIVER_TICK, mTickStart); mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::REFRESH_DRIVER_TICK, mTickStart);
#endif
#endif #endif
nsTObserverArray<nsAPostRefreshObserver*>::ForwardIterator iter(mPostRefreshObservers); nsTObserverArray<nsAPostRefreshObserver*>::ForwardIterator iter(mPostRefreshObservers);

View File

@ -237,6 +237,12 @@ XRE_SetProcessType(const char* aProcessTypeString)
i < (int) ArrayLength(kGeckoProcessTypeString); i < (int) ArrayLength(kGeckoProcessTypeString);
++i) { ++i) {
if (!strcmp(kGeckoProcessTypeString[i], aProcessTypeString)) { if (!strcmp(kGeckoProcessTypeString[i], aProcessTypeString)) {
// For purposes of TenFourFox issue 446, assert that we never, ever
// launch a child process (it would immediately crash anyway due to
// defective IPC, but let's be paranoid and make it crash predictably).
if (MOZ_UNLIKELY(static_cast<GeckoProcessType>(i) != GeckoProcessType_Default))
MOZ_CRASH("TenFourFox does not support E10S child processes.");
sChildProcessType = static_cast<GeckoProcessType>(i); sChildProcessType = static_cast<GeckoProcessType>(i);
return; return;
} }