From 4594eee516213158662b6b279bd77ba8b4aaad1e Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Mon, 25 Mar 2019 20:48:57 -0700 Subject: [PATCH] #446 + #334: trim refresh driver further; restore old Tele removal --- layout/base/nsRefreshDriver.cpp | 34 +++++++++++++++++++++----------- toolkit/xre/nsEmbedFunctions.cpp | 6 ++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index ac5a414a2..b446e4583 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -430,9 +430,11 @@ private: void OnTimerStart() { +#if(0) if (!XRE_IsParentProcess()) { mLastChildTick = TimeStamp::Now(); } +#endif } private: @@ -440,6 +442,7 @@ private: void RecordTelemetryProbes(TimeStamp aVsyncTimestamp) { +#if(0) MOZ_ASSERT(NS_IsMainThread()); #ifndef ANDROID /* bug 1142079 */ if (XRE_IsParentProcess()) { @@ -467,20 +470,23 @@ private: mVsyncRate = mVsyncRefreshDriverTimer->mVsyncChild->GetVsyncRate(); } #endif +#endif } void TickRefreshDriver(TimeStamp aVsyncTimestamp) { MOZ_ASSERT(NS_IsMainThread()); - RecordTelemetryProbes(aVsyncTimestamp); - if (XRE_IsParentProcess()) { + //RecordTelemetryProbes(aVsyncTimestamp); + //if (XRE_IsParentProcess()) { + { // Make sure the lock expires before we leave this block. MonitorAutoLock lock(mRefreshTickLock); aVsyncTimestamp = mRecentVsync; mProcessedVsync = true; - } else { - mLastChildTick = TimeStamp::Now(); } + //} else { + // mLastChildTick = TimeStamp::Now(); + //} MOZ_ASSERT(aVsyncTimestamp <= TimeStamp::Now()); // We might have a problem that we call ~VsyncRefreshDriverTimer() before @@ -504,9 +510,10 @@ private: virtual ~VsyncRefreshDriverTimer() { - if (XRE_IsParentProcess()) { + //if (XRE_IsParentProcess()) { mVsyncDispatcher->SetParentRefreshTimer(nullptr); mVsyncDispatcher = nullptr; +#if(0) } else { // Since the PVsyncChild actors live through the life of the process, just // send the unobserveVsync message to disable vsync event. We don't need @@ -516,6 +523,7 @@ private: mVsyncChild->SetVsyncObserver(nullptr); mVsyncChild = nullptr; } +#endif // Detach current vsync timer from this VsyncObserver. The observer will no // longer tick this timer. @@ -531,12 +539,12 @@ private: mLastFireEpoch = JS_Now(); mLastFireTime = TimeStamp::Now(); - if (XRE_IsParentProcess()) { + //if (XRE_IsParentProcess()) { mVsyncDispatcher->SetParentRefreshTimer(mVsyncObserver); - } else { - Unused << mVsyncChild->SendObserve(); - mVsyncObserver->OnTimerStart(); - } + //} else { + // Unused << mVsyncChild->SendObserve(); + // mVsyncObserver->OnTimerStart(); + //} ++sActiveVsyncTimers; } @@ -832,14 +840,14 @@ CreateVsyncRefreshTimer() return; } - if (XRE_IsParentProcess()) { + //if (XRE_IsParentProcess()) { // Make sure all vsync systems are ready. gfxPlatform::GetPlatform(); // In parent process, we don't need to use ipc. We can create the // VsyncRefreshDriverTimer directly. sRegularRateTimer = new VsyncRefreshDriverTimer(); return; - } + //} #ifdef MOZ_NUWA_PROCESS // 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 */ mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::REFRESH_DRIVER_TICK, mTickStart); +#endif #endif nsTObserverArray::ForwardIterator iter(mPostRefreshObservers); diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index e735bf626..c8d07b0df 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -237,6 +237,12 @@ XRE_SetProcessType(const char* aProcessTypeString) i < (int) ArrayLength(kGeckoProcessTypeString); ++i) { 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(i) != GeckoProcessType_Default)) + MOZ_CRASH("TenFourFox does not support E10S child processes."); + sChildProcessType = static_cast(i); return; }