bool ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies) { SAMPLE_LABEL("ShadowLayerForwarder", "EndTranscation"); RenderTraceScope rendertrace("Foward Transaction", "000091"); NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to"); NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?"); AutoTxnEnd _(mTxn); if (mTxn->Empty()) { MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?), skipping Update()")); return true; } MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers...")); for (PRUint32 i = 0; i < mTxn->mDyingBuffers.Length(); ++i) { DestroySharedSurface(&mTxn->mDyingBuffers[i]); } MOZ_LAYERS_LOG(("[LayersForwarder] building transaction...")); // We purposely add attribute-change ops to the final changeset // before we add paint ops. This allows layers to record the // attribute changes before new pixels arrive, which can be useful // for setting up back/front buffers. RenderTraceScope rendertrace2("Foward Transaction", "000092"); for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin(); it != mTxn->mMutants.end(); ++it) { ShadowableLayer* shadow = *it; Layer* mutant = shadow->AsLayer(); NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?"); LayerAttributes attrs; CommonLayerAttributes& common = attrs.common(); common.visibleRegion() = mutant->GetVisibleRegion(); common.transform() = mutant->GetTransform(); common.contentFlags() = mutant->GetContentFlags(); common.opacity() = mutant->GetOpacity(); common.useClipRect() = !!mutant->GetClipRect(); common.clipRect() = (common.useClipRect() ? *mutant->GetClipRect() : nsIntRect()); common.isFixedPosition() = mutant->GetIsFixedPosition(); if (Layer* maskLayer = mutant->GetMaskLayer()) { common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer()); } else { common.maskLayerChild() = NULL; } common.maskLayerParent() = NULL; attrs.specific() = null_t(); mutant->FillSpecificAttributes(attrs.specific()); mTxn->AddEdit(OpSetLayerAttributes(NULL, Shadow(shadow), attrs)); } AutoInfallibleTArray<Edit, 10> cset; size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size(); NS_ABORT_IF_FALSE(nCsets > 0, "should have bailed by now"); cset.SetCapacity(nCsets); if (!mTxn->mCset.empty()) { cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size()); } // Paints after non-paint ops, including attribute changes. See // above. if (!mTxn->mPaints.empty()) { cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size()); } MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send...")); PlatformSyncBeforeUpdate(); if (mTxn->mSwapRequired) { MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction...")); RenderTraceScope rendertrace3("Forward Transaction", "000093"); if (!mShadowManager->SendUpdate(cset, mIsFirstPaint, aReplies)) { MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); return false; } } else { // If we don't require a swap we can call SendUpdateNoSwap which // assumes that aReplies is empty (DEBUG assertion) MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction...")); RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093"); if (!mShadowManager->SendUpdateNoSwap(cset, mIsFirstPaint)) { MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); return false; } } mIsFirstPaint = false; MOZ_LAYERS_LOG(("[LayersForwarder] ... done")); return true; }
bool ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies, const nsIntRegion& aRegionToClear, uint64_t aId, bool aScheduleComposite, uint32_t aPaintSequenceNumber, bool aIsRepeatTransaction, bool* aSent) { *aSent = false; MOZ_ASSERT(aId); PROFILER_LABEL("ShadowLayerForwarder", "EndTranscation", js::ProfileEntry::Category::GRAPHICS); RenderTraceScope rendertrace("Foward Transaction", "000091"); NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to"); NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?"); DiagnosticTypes diagnostics = gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes(); if (mDiagnosticTypes != diagnostics) { mDiagnosticTypes = diagnostics; mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics)); } AutoTxnEnd _(mTxn); if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) { MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()")); return true; } MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers...")); MOZ_LAYERS_LOG(("[LayersForwarder] building transaction...")); // We purposely add attribute-change ops to the final changeset // before we add paint ops. This allows layers to record the // attribute changes before new pixels arrive, which can be useful // for setting up back/front buffers. RenderTraceScope rendertrace2("Foward Transaction", "000092"); for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin(); it != mTxn->mMutants.end(); ++it) { ShadowableLayer* shadow = *it; Layer* mutant = shadow->AsLayer(); NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?"); LayerAttributes attrs; CommonLayerAttributes& common = attrs.common(); common.visibleRegion() = mutant->GetVisibleRegion(); common.eventRegions() = mutant->GetEventRegions(); common.postXScale() = mutant->GetPostXScale(); common.postYScale() = mutant->GetPostYScale(); common.transform() = mutant->GetBaseTransform(); common.contentFlags() = mutant->GetContentFlags(); common.opacity() = mutant->GetOpacity(); common.useClipRect() = !!mutant->GetClipRect(); common.clipRect() = (common.useClipRect() ? *mutant->GetClipRect() : nsIntRect()); common.isFixedPosition() = mutant->GetIsFixedPosition(); common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor(); common.fixedPositionMargin() = mutant->GetFixedPositionMargins(); common.isStickyPosition() = mutant->GetIsStickyPosition(); if (mutant->GetIsStickyPosition()) { common.stickyScrollContainerId() = mutant->GetStickyScrollContainerId(); common.stickyScrollRangeOuter() = mutant->GetStickyScrollRangeOuter(); common.stickyScrollRangeInner() = mutant->GetStickyScrollRangeInner(); } common.scrollbarTargetContainerId() = mutant->GetScrollbarTargetContainerId(); common.scrollbarDirection() = mutant->GetScrollbarDirection(); common.mixBlendMode() = (int8_t)mutant->GetMixBlendMode(); common.forceIsolatedGroup() = mutant->GetForceIsolatedGroup(); if (Layer* maskLayer = mutant->GetMaskLayer()) { common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer()); } else { common.maskLayerChild() = nullptr; } common.maskLayerParent() = nullptr; common.animations() = mutant->GetAnimations(); common.invalidRegion() = mutant->GetInvalidRegion(); attrs.specific() = null_t(); mutant->FillSpecificAttributes(attrs.specific()); MOZ_LAYERS_LOG(("[LayersForwarder] OpSetLayerAttributes(%p)\n", mutant)); mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs)); } AutoInfallibleTArray<Edit, 10> cset; size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size(); NS_ABORT_IF_FALSE(nCsets > 0 || mWindowOverlayChanged, "should have bailed by now"); cset.SetCapacity(nCsets); if (!mTxn->mCset.empty()) { cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size()); } // Paints after non-paint ops, including attribute changes. See // above. if (!mTxn->mPaints.empty()) { cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size()); } mWindowOverlayChanged = false; TargetConfig targetConfig(mTxn->mTargetBounds, mTxn->mTargetRotation, mTxn->mClientBounds, mTxn->mTargetOrientation, aRegionToClear); if (!IsSameProcess()) { MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send...")); PlatformSyncBeforeUpdate(); } profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END); if (mTxn->mSwapRequired) { MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction...")); RenderTraceScope rendertrace3("Forward Transaction", "000093"); if (!HasShadowManager() || !mShadowManager->IPCOpen() || !mShadowManager->SendUpdate(cset, aId, targetConfig, mIsFirstPaint, aScheduleComposite, aPaintSequenceNumber, aIsRepeatTransaction, aReplies)) { MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); return false; } } else { // If we don't require a swap we can call SendUpdateNoSwap which // assumes that aReplies is empty (DEBUG assertion) MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction...")); RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093"); if (!HasShadowManager() || !mShadowManager->IPCOpen() || !mShadowManager->SendUpdateNoSwap(cset, aId, targetConfig, mIsFirstPaint, aPaintSequenceNumber, aScheduleComposite, aIsRepeatTransaction)) { MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); return false; } } *aSent = true; mIsFirstPaint = false; MOZ_LAYERS_LOG(("[LayersForwarder] ... done")); return true; }
PRBool ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies) { NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to"); NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?"); AutoTxnEnd _(mTxn); if (mTxn->Empty()) { MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?), skipping Update()")); return PR_TRUE; } MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers...")); for (PRUint32 i = 0; i < mTxn->mDyingBuffers.Length(); ++i) { DestroySharedSurface(&mTxn->mDyingBuffers[i]); } MOZ_LAYERS_LOG(("[LayersForwarder] building transaction...")); // We purposely add attribute-change ops to the final changeset // before we add paint ops. This allows layers to record the // attribute changes before new pixels arrive, which can be useful // for setting up back/front buffers. for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin(); it != mTxn->mMutants.end(); ++it) { ShadowableLayer* shadow = *it; Layer* mutant = shadow->AsLayer(); NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?"); LayerAttributes attrs; CommonLayerAttributes& common = attrs.common(); common.visibleRegion() = mutant->GetVisibleRegion(); common.transform() = mutant->GetTransform(); common.contentFlags() = mutant->GetContentFlags(); common.opacity() = mutant->GetOpacity(); common.useClipRect() = !!mutant->GetClipRect(); common.clipRect() = (common.useClipRect() ? *mutant->GetClipRect() : nsIntRect()); common.isFixedPosition() = mutant->GetIsFixedPosition(); common.useTileSourceRect() = !!mutant->GetTileSourceRect(); common.tileSourceRect() = (common.useTileSourceRect() ? *mutant->GetTileSourceRect() : nsIntRect()); attrs.specific() = null_t(); mutant->FillSpecificAttributes(attrs.specific()); mTxn->AddEdit(OpSetLayerAttributes(NULL, Shadow(shadow), attrs)); } AutoInfallibleTArray<Edit, 10> cset; size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size(); NS_ABORT_IF_FALSE(nCsets > 0, "should have bailed by now"); cset.SetCapacity(nCsets); if (!mTxn->mCset.empty()) { cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size()); } // Paints after non-paint ops, including attribute changes. See // above. if (!mTxn->mPaints.empty()) { cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size()); } MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send...")); PlatformSyncBeforeUpdate(); MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction...")); if (!mShadowManager->SendUpdate(cset, aReplies)) { MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!")); return PR_FALSE; } MOZ_LAYERS_LOG(("[LayersForwarder] ... done")); return PR_TRUE; }