Bug 1443187 - Avoid crashing if a previously-uncomposited layer tree gets adopted. r=botond

MozReview-Commit-ID: FZYwS7IwdKq

--HG--
extra : rebase_source : ea7b093df17887af841cb4ccdd64d47a69c016ad
This commit is contained in:
Kartikaya Gupta 2018-03-07 16:41:44 -05:00
parent 5110d9e202
commit ff4a47d56e
3 changed files with 17 additions and 12 deletions

View File

@ -254,14 +254,15 @@ APZCTreeManager::NotifyLayerTreeAdopted(uint64_t aLayersId,
{
APZThreadUtils::AssertOnSamplerThread();
MOZ_ASSERT(aOldApzcTreeManager);
aOldApzcTreeManager->mFocusState.RemoveFocusTarget(aLayersId);
// While we could move the focus target information from the old APZC tree
// manager into this one, it's safer to not do that, as we'll probably have
// that information repopulated soon anyway (on the next layers update).
if (aOldApzcTreeManager) {
aOldApzcTreeManager->mFocusState.RemoveFocusTarget(aLayersId);
// While we could move the focus target information from the old APZC tree
// manager into this one, it's safer to not do that, as we'll probably have
// that information repopulated soon anyway (on the next layers update).
}
UniquePtr<APZTestData> adoptedData;
{ // scope lock for removal on oldApzcTreeManager
if (aOldApzcTreeManager) {
MutexAutoLock lock(aOldApzcTreeManager->mTestDataLock);
auto it = aOldApzcTreeManager->mTestData.find(aLayersId);
if (it != aOldApzcTreeManager->mTestData.end()) {

View File

@ -66,8 +66,7 @@ APZSampler::NotifyLayerTreeAdopted(uint64_t aLayersId,
const RefPtr<APZSampler>& aOldSampler)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
MOZ_ASSERT(aOldSampler);
mApz->NotifyLayerTreeAdopted(aLayersId, aOldSampler->mApz);
mApz->NotifyLayerTreeAdopted(aLayersId, aOldSampler ? aOldSampler->mApz : nullptr);
}
void

View File

@ -1743,10 +1743,15 @@ CompositorBridgeParent::RecvAdoptChild(const uint64_t& child)
parent = sIndirectLayerTrees[child].mApzcTreeManagerParent;
}
// We don't support moving a child from a APZ-enabled compositor to a
// APZ-disabled compostior. The mOptions assertion above should already
// ensure this, since APZ-ness is one of the things in mOptions.
MOZ_ASSERT((oldApzSampler != nullptr) == (mApzSampler != nullptr));
if (oldApzSampler) {
// We don't support moving a child from an APZ-enabled compositor to a
// APZ-disabled compositor. The mOptions assertion above should already
// ensure this, since APZ-ness is one of the things in mOptions. Note
// however it is possible for mApzSampler to be non-null here with
// oldApzSampler null, because the child may not have been previously
// composited.
MOZ_ASSERT(mApzSampler);
}
if (mApzSampler) {
if (parent) {
MOZ_ASSERT(mApzcTreeManager);