mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1655278 - Ensure AndroidVsyncSource::Display::mVsyncDuration is initialized before CompositorBridgeParent. r=kats
When a CompositorBridgeParent is initialized it reads the vsync duration from the AndroidVsyncSource::Display instance. The vsync duration is currently initialized in AndroidVsyncSource::EnableVsync(). Since bug 1617750 landed, which makes the hidden window lazily loaded, the first tab's CompositorBridgeParent is being initialized before vsync is enabled, meaning it reads a value of zero. Instead, initialize mVsyncDuration in the AndroidVsyncSource::Display constructor. Differential Revision: https://phabricator.services.mozilla.com/D85611
This commit is contained in:
parent
cc95b93cba
commit
afb4f3c9f1
@ -303,6 +303,9 @@ class AndroidVsyncSource final : public VsyncSource {
|
|||||||
Display()
|
Display()
|
||||||
: mJavaVsync(java::VsyncSource::INSTANCE()), mObservingVsync(false) {
|
: mJavaVsync(java::VsyncSource::INSTANCE()), mObservingVsync(false) {
|
||||||
JavaVsyncSupport::Init(); // To register native methods.
|
JavaVsyncSupport::Init(); // To register native methods.
|
||||||
|
|
||||||
|
float fps = mJavaVsync->GetRefreshRate();
|
||||||
|
mVsyncDuration = TimeDuration::FromMilliseconds(1000.0 / fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
~Display() { DisableVsync(); }
|
~Display() { DisableVsync(); }
|
||||||
@ -321,12 +324,7 @@ class AndroidVsyncSource final : public VsyncSource {
|
|||||||
if (mObservingVsync) {
|
if (mObservingVsync) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool ok = mJavaVsync->ObserveVsync(true);
|
mObservingVsync = mJavaVsync->ObserveVsync(true);
|
||||||
if (ok && !mVsyncDuration) {
|
|
||||||
float fps = mJavaVsync->GetRefreshRate();
|
|
||||||
mVsyncDuration = TimeDuration::FromMilliseconds(1000.0 / fps);
|
|
||||||
}
|
|
||||||
mObservingVsync = ok;
|
|
||||||
MOZ_ASSERT(mObservingVsync);
|
MOZ_ASSERT(mObservingVsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user