#446: refresh driver overhaul + M1367830 M1352205

This commit is contained in:
Cameron Kaiser 2017-12-19 18:40:46 -08:00
parent 2043f98e25
commit 14cee4ada4
4 changed files with 49 additions and 43 deletions

View File

@ -6024,11 +6024,6 @@ nsDocShell::SetIsActive(bool aIsActive)
nsresult nsresult
nsDocShell::SetIsActiveInternal(bool aIsActive, bool aIsHidden) nsDocShell::SetIsActiveInternal(bool aIsActive, bool aIsHidden)
{ {
// We disallow setting active on chrome docshells.
if (mItemType == nsIDocShellTreeItem::typeChrome) {
return NS_ERROR_INVALID_ARG;
}
// Keep track ourselves. // Keep track ourselves.
mIsActive = aIsActive; mIsActive = aIsActive;

View File

@ -426,9 +426,11 @@ private:
void OnTimerStart() void OnTimerStart()
{ {
#if(0)
if (!XRE_IsParentProcess()) { if (!XRE_IsParentProcess()) {
mLastChildTick = TimeStamp::Now(); mLastChildTick = TimeStamp::Now();
} }
#endif
} }
private: private:
@ -436,6 +438,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()) {
@ -463,20 +466,21 @@ 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()) {
MonitorAutoLock lock(mRefreshTickLock); MonitorAutoLock lock(mRefreshTickLock);
aVsyncTimestamp = mRecentVsync; aVsyncTimestamp = mRecentVsync;
mProcessedVsync = true; mProcessedVsync = true;
} else { //} else {
mLastChildTick = TimeStamp::Now(); // 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
@ -500,9 +504,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
@ -512,6 +517,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.
@ -542,11 +548,11 @@ private:
// Protect updates to `sActiveVsyncTimers`. // Protect updates to `sActiveVsyncTimers`.
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (XRE_IsParentProcess()) { //if (XRE_IsParentProcess()) {
mVsyncDispatcher->SetParentRefreshTimer(nullptr); mVsyncDispatcher->SetParentRefreshTimer(nullptr);
} else { //} else {
Unused << mVsyncChild->SendUnobserve(); // Unused << mVsyncChild->SendUnobserve();
} //}
MOZ_ASSERT(sActiveVsyncTimers > 0); MOZ_ASSERT(sActiveVsyncTimers > 0);
--sActiveVsyncTimers; --sActiveVsyncTimers;
@ -679,6 +685,8 @@ protected:
virtual void ScheduleNextTick(TimeStamp aNowTime) virtual void ScheduleNextTick(TimeStamp aNowTime)
{ {
return; // speculative from bug 1352205 and TenFourFox issue 446
if (mDisableAfterMilliseconds > 0.0 && if (mDisableAfterMilliseconds > 0.0 &&
mNextTickDuration > mDisableAfterMilliseconds) mNextTickDuration > mDisableAfterMilliseconds)
{ {
@ -828,14 +836,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()
@ -935,7 +943,7 @@ nsRefreshDriver::GetThrottledTimerInterval()
if (rate <= 0) { if (rate <= 0) {
rate = DEFAULT_THROTTLED_FRAME_RATE; rate = DEFAULT_THROTTLED_FRAME_RATE;
} }
return 1000.0 / rate; return 3000.0 / rate;
} }
/* static */ mozilla::TimeDuration /* static */ mozilla::TimeDuration
@ -1874,7 +1882,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
} }
} }
#ifndef ANDROID /* bug 1142079 */ #if(0)
mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::REFRESH_DRIVER_TICK, mTickStart); mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::REFRESH_DRIVER_TICK, mTickStart);
#endif #endif

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 441, 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;
} }

View File

@ -132,33 +132,30 @@ nsAppShellService::CreateHiddenWindowHelper(bool aIsPrivate)
rv = NS_NewURI(getter_AddRefs(url), hiddenWindowURL); rv = NS_NewURI(getter_AddRefs(url), hiddenWindowURL);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
RefPtr<nsWebShellWindow> newWindow; if (aIsPrivate) {
if (!aIsPrivate) {
rv = JustCreateTopWindow(nullptr, url,
chromeMask, initialWidth, initialHeight,
true, nullptr, getter_AddRefs(newWindow));
NS_ENSURE_SUCCESS(rv, rv);
mHiddenWindow.swap(newWindow);
} else {
// Create the hidden private window
chromeMask |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW; chromeMask |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
rv = JustCreateTopWindow(nullptr, url,
chromeMask, initialWidth, initialHeight,
true, nullptr, getter_AddRefs(newWindow));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocShell> docShell;
newWindow->GetDocShell(getter_AddRefs(docShell));
if (docShell) {
docShell->SetAffectPrivateSessionLifetime(false);
}
mHiddenPrivateWindow.swap(newWindow);
} }
// RegisterTopLevelWindow(newWindow); -- Mac only RefPtr<nsWebShellWindow> newWindow;
rv = JustCreateTopWindow(nullptr, url,
chromeMask, initialWidth, initialHeight,
true, nullptr, getter_AddRefs(newWindow));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDocShell> docShell;
newWindow->GetDocShell(getter_AddRefs(docShell));
if (docShell) {
docShell->SetIsActive(false);
if (aIsPrivate) {
docShell->SetAffectPrivateSessionLifetime(false);
}
}
if (aIsPrivate) {
mHiddenPrivateWindow.swap(newWindow);
} else {
mHiddenWindow.swap(newWindow);
}
return NS_OK; return NS_OK;
} }