Bug 1727489 - Remove PLayerTransaction. r=jrmuizel,jgilbert

Differential Revision: https://phabricator.services.mozilla.com/D123595
This commit is contained in:
Matt Woodrow 2021-08-26 00:25:21 +00:00
parent 12aab272c2
commit 0d4e9aa48a
33 changed files with 9 additions and 2117 deletions

View File

@ -8,7 +8,6 @@
#include "MobileViewportManager.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "nsPresContext.h"
#include "nsCaret.h"
#include "nsContentList.h"

View File

@ -20,7 +20,6 @@
#include "mozilla/ipc/Shmem.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/OOPCanvasRenderer.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#include "mozilla/layers/WebRenderUserData.h"

View File

@ -6,7 +6,6 @@
#include "HostWebGLContext.h"
#include "CompositableHost.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/LayersSurfaces.h"
#include "MozFramebuffer.h"

View File

@ -6,7 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PCompositorBridge;
include protocol PLayerTransaction;
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
using mozilla::layers::SurfaceDescriptor from "mozilla/layers/LayersTypes.h";

View File

@ -6,7 +6,6 @@
#include "WebGLParent.h"
#include "WebGLChild.h"
#include "mozilla/layers/LayerTransactionParent.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#include "ImageContainer.h"
#include "HostWebGLContext.h"

View File

@ -92,7 +92,6 @@
#include "mozilla/layers/IAPZCTreeManager.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "nsBrowserStatusFilter.h"
#include "nsColorPickerProxy.h"

View File

@ -69,7 +69,6 @@
#include "mozilla/layers/APZUtils.h" // for AsyncTransform
#include "mozilla/layers/CompositorController.h" // for CompositorController
#include "mozilla/layers/DirectionUtils.h" // for GetAxis{Start,End,Length,Scale}
#include "mozilla/layers/LayerTransactionParent.h" // for LayerTransactionParent
#include "mozilla/layers/MetricsSharingController.h" // for MetricsSharingController
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/Unused.h" // for unused
@ -3660,7 +3659,6 @@ Maybe<CSSPoint> AsyncPanZoomController::GetCurrentAnimationDestination(
ParentLayerPoint
AsyncPanZoomController::AdjustHandoffVelocityForOverscrollBehavior(
ParentLayerPoint& aHandoffVelocity) const {
ParentLayerPoint residualVelocity;
ScrollDirections handoffDirections = GetAllowedHandoffDirections();
if (!handoffDirections.contains(ScrollDirection::eHorizontal)) {

View File

@ -14,7 +14,6 @@
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/RepaintRequest.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/WebRenderBridgeChild.h"

View File

@ -23,7 +23,8 @@
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/CompositorTypes.h" // for CompositableType, etc
#include "mozilla/layers/ISurfaceAllocator.h"
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
#include "mozilla/layers/TextureForwarder.h"
#include "mozilla/layers/TextureClient.h" // for TextureClient, etc
#include "mozilla/layers/TextureClientOGL.h" // for SurfaceTextureClient
#include "mozilla/mozalloc.h" // for operator delete, etc

View File

@ -17,8 +17,6 @@
#include "mozilla/layers/APZCTreeManagerChild.h"
#include "mozilla/layers/CanvasChild.h"
#include "mozilla/layers/LayerManager.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/layers/PTextureChild.h"
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "mozilla/layers/TextureClientPool.h" // for TextureClientPool
@ -57,7 +55,6 @@
using mozilla::Unused;
using mozilla::gfx::GPUProcessManager;
using mozilla::layers::LayerTransactionChild;
namespace mozilla {
namespace layers {
@ -173,14 +170,6 @@ void CompositorBridgeChild::Destroy() {
return;
}
AutoTArray<PLayerTransactionChild*, 16> transactions;
ManagedPLayerTransactionChild(transactions);
for (int i = transactions.Length() - 1; i >= 0; --i) {
RefPtr<LayerTransactionChild> layers =
static_cast<LayerTransactionChild*>(transactions[i]);
layers->Destroy();
}
AutoTArray<PWebRenderBridgeChild*, 16> wrBridges;
ManagedPWebRenderBridgeChild(wrBridges);
for (int i = wrBridges.Length() - 1; i >= 0; --i) {
@ -314,22 +303,6 @@ bool CompositorBridgeChild::CompositorIsInGPUProcess() {
return bridge->OtherPid() != dom::ContentChild::GetSingleton()->OtherPid();
}
PLayerTransactionChild* CompositorBridgeChild::AllocPLayerTransactionChild(
const nsTArray<LayersBackend>& aBackendHints, const LayersId& aId) {
LayerTransactionChild* c = new LayerTransactionChild(aId);
c->AddIPDLReference();
return c;
}
bool CompositorBridgeChild::DeallocPLayerTransactionChild(
PLayerTransactionChild* actor) {
LayersId childId = static_cast<LayerTransactionChild*>(actor)->GetId();
ClearSharedFrameMetricsData(childId);
static_cast<LayerTransactionChild*>(actor)->ReleaseIPDLReference();
return true;
}
mozilla::ipc::IPCResult CompositorBridgeChild::RecvInvalidateLayers(
const LayersId& aLayersId) {
if (mLayerManager) {

View File

@ -241,11 +241,6 @@ class CompositorBridgeChild final : public PCompositorBridgeChild,
void PrepareFinalDestroy();
void AfterDestroy();
PLayerTransactionChild* AllocPLayerTransactionChild(
const nsTArray<LayersBackend>& aBackendHints, const LayersId& aId);
bool DeallocPLayerTransactionChild(PLayerTransactionChild* aChild);
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvSharedCompositorFrameMetrics(

View File

@ -12,7 +12,6 @@
#include <utility> // for pair
#include "apz/src/APZCTreeManager.h" // for APZCTreeManager
#include "LayerTransactionParent.h" // for LayerTransactionParent
#include "RenderTrace.h" // for RenderTraceLayers
#include "base/process.h" // for ProcessId
#include "gfxContext.h" // for gfxContext
@ -57,7 +56,6 @@
#include "mozilla/layers/LayerTreeOwnerTracker.h"
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/OMTASampler.h"
#include "mozilla/layers/PLayerTransactionParent.h"
#include "mozilla/layers/RemoteContentController.h"
#include "mozilla/layers/UiCompositorControllerParent.h"
#include "mozilla/layers/WebRenderBridgeParent.h"
@ -224,8 +222,7 @@ CompositorBridgeParent::LayerTreeState::LayerTreeState()
: mApzcTreeManagerParent(nullptr),
mParent(nullptr),
mLayerManager(nullptr),
mContentCompositorBridgeParent(nullptr),
mLayerTree(nullptr) {}
mContentCompositorBridgeParent(nullptr) {}
CompositorBridgeParent::LayerTreeState::~LayerTreeState() {
if (mController) {
@ -776,27 +773,6 @@ void CompositorBridgeParent::ResumeCompositionAndResize(int x, int y, int width,
ResumeComposition();
}
void CompositorBridgeParent::UpdatePaintTime(LayerTransactionParent* aLayerTree,
const TimeDuration& aPaintTime) {
// We get a lot of paint timings for things with empty transactions.
if (!mLayerManager || aPaintTime.ToMilliseconds() < 1.0) {
return;
}
mLayerManager->SetPaintTime(aPaintTime);
}
void CompositorBridgeParent::RegisterPayloads(
LayerTransactionParent* aLayerTree,
const nsTArray<CompositionPayload>& aPayload) {
// We get a lot of paint timings for things with empty transactions.
if (!mLayerManager) {
return;
}
mLayerManager->RegisterPayloads(aPayload);
}
void CompositorBridgeParent::NotifyShadowTreeTransaction(
LayersId aId, bool aIsFirstPaint, const FocusTarget& aFocusTarget,
bool aScheduleComposite, uint32_t aPaintSequenceNumber,
@ -863,107 +839,6 @@ void CompositorBridgeParent::SetShadowProperties(Layer* aLayer) {
});
}
void CompositorBridgeParent::CompositeToTarget(VsyncId aId, DrawTarget* aTarget,
const gfx::IntRect* aRect) {
AUTO_PROFILER_TRACING_MARKER("Paint", "Composite", GRAPHICS);
AUTO_PROFILER_LABEL("CompositorBridgeParent::CompositeToTarget", GRAPHICS);
PerfStats::AutoMetricRecording<PerfStats::Metric::Compositing> autoRecording;
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread(),
"Composite can only be called on the compositor thread");
TimeStamp start = TimeStamp::Now();
if (!CanComposite()) {
TimeStamp end = TimeStamp::Now();
DidComposite(aId, start, end);
return;
}
AutoResolveRefLayers resolve(mCompositionManager, this);
nsCString none;
if (aTarget) {
mLayerManager->BeginTransactionWithDrawTarget(aTarget, *aRect);
} else {
mLayerManager->BeginTransaction(none);
}
SetShadowProperties(mLayerManager->GetRoot());
if (mForceCompositionTask && !mOverrideComposeReadiness) {
if (mCompositionManager->ReadyForCompose()) {
mForceCompositionTask->Cancel();
mForceCompositionTask = nullptr;
} else {
return;
}
}
mCompositionManager->ComputeRotation();
SampleTime time = mTestTime ? SampleTime::FromTest(*mTestTime)
: mCompositorScheduler->GetLastComposeTime();
bool requestNextFrame =
mCompositionManager->TransformShadowTree(time, mVsyncRate);
if (requestNextFrame) {
ScheduleComposition();
}
RenderTraceLayers(mLayerManager->GetRoot(), "0000");
if (StaticPrefs::layers_dump_host_layers() || StaticPrefs::layers_dump()) {
printf_stderr("Painting --- compositing layer tree:\n");
mLayerManager->Dump(/* aSorted = */ true);
}
mLayerManager->SetDebugOverlayWantsNextFrame(false);
mLayerManager->EndTransaction(time.Time());
if (!aTarget) {
TimeStamp end = TimeStamp::Now();
DidComposite(aId, start, end);
}
// We're not really taking advantage of the stored composite-again-time here.
// We might be able to skip the next few composites altogether. However,
// that's a bit complex to implement and we'll get most of the advantage
// by skipping compositing when we detect there's nothing invalid. This is why
// we do "composite until" rather than "composite again at".
//
// TODO(bug 1328602) Figure out what we should do here with the render thread.
if (!mLayerManager->GetCompositeUntilTime().IsNull() ||
mLayerManager->DebugOverlayWantsNextFrame()) {
ScheduleComposition();
}
#ifdef COMPOSITOR_PERFORMANCE_WARNING
TimeDuration executionTime =
TimeStamp::Now() - mCompositorScheduler->GetLastComposeTime().Time();
TimeDuration frameBudget = TimeDuration::FromMilliseconds(15);
int32_t frameRate = CalculateCompositionFrameRate();
if (frameRate > 0) {
frameBudget = TimeDuration::FromSeconds(1.0 / frameRate);
}
if (executionTime > frameBudget) {
printf_stderr("Compositor: Composite execution took %4.1f ms\n",
executionTime.ToMilliseconds());
}
#endif
// 0 -> Full-tilt composite
if (StaticPrefs::layers_offmainthreadcomposition_frame_rate() == 0 ||
mLayerManager->AlwaysScheduleComposite()) {
// Special full-tilt composite mode for performance testing
ScheduleComposition();
}
// TODO(bug 1328602) Need an equivalent that works with the rende thread.
mLayerManager->SetCompositionTime(TimeStamp());
mozilla::Telemetry::AccumulateTimeDelta(mozilla::Telemetry::COMPOSITE_TIME,
start);
}
void CompositorBridgeParent::ForceComposeToTarget(DrawTarget* aTarget,
const gfx::IntRect* aRect) {
AUTO_PROFILER_LABEL("CompositorBridgeParent::ForceComposeToTarget", GRAPHICS);
@ -1116,68 +991,6 @@ void CompositorBridgeParent::ScheduleRotationOnCompositorThread(
}
}
void CompositorBridgeParent::ShadowLayersUpdated(
LayerTransactionParent* aLayerTree, const TransactionInfo& aInfo,
bool aHitTestUpdate) {
const TargetConfig& targetConfig = aInfo.targetConfig();
ScheduleRotationOnCompositorThread(targetConfig, aInfo.isFirstPaint());
// Instruct the LayerManager to update its render bounds now. Since all the
// orientation change, dimension change would be done at the stage, update the
// size here is free of race condition.
mLayerManager->UpdateRenderBounds(targetConfig.naturalBounds());
mLayerManager->SetRegionToClear(targetConfig.clearRegion());
if (mLayerManager->GetCompositor()) {
mLayerManager->GetCompositor()->SetScreenRotation(targetConfig.rotation());
}
mCompositionManager->Updated(aInfo.isFirstPaint(), targetConfig);
Layer* root = aLayerTree->GetRoot();
mLayerManager->SetRoot(root);
if (mApzUpdater && !aInfo.isRepeatTransaction()) {
mApzUpdater->UpdateFocusState(mRootLayerTreeID, mRootLayerTreeID,
aInfo.focusTarget());
if (aHitTestUpdate) {
AutoResolveRefLayers resolve(mCompositionManager);
mApzUpdater->UpdateHitTestingTree(root, aInfo.isFirstPaint(),
mRootLayerTreeID,
aInfo.paintSequenceNumber());
}
}
// The transaction ID might get reset to 1 if the page gets reloaded, see
// https://bugzilla.mozilla.org/show_bug.cgi?id=1145295#c41
// Otherwise, it should be continually increasing.
MOZ_ASSERT(aInfo.id() == TransactionId{1} || mPendingTransactions.IsEmpty() ||
aInfo.id() > mPendingTransactions.LastElement());
mPendingTransactions.AppendElement(aInfo.id());
mRefreshStartTime = aInfo.refreshStart();
mTxnStartTime = aInfo.transactionStart();
mFwdTime = aInfo.fwdTime();
RegisterPayloads(aLayerTree, aInfo.payload());
if (root) {
SetShadowProperties(root);
}
if (aInfo.scheduleComposite()) {
ScheduleComposition();
if (mPaused) {
TimeStamp now = TimeStamp::Now();
DidComposite(VsyncId(), now, now);
}
}
mLayerManager->NotifyShadowTreeTransaction();
}
void CompositorBridgeParent::ScheduleComposite(
LayerTransactionParent* aLayerTree) {
ScheduleComposition();
}
bool CompositorBridgeParent::SetTestSampleTime(const LayersId& aId,
const TimeStamp& aTime) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
@ -1222,34 +1035,6 @@ void CompositorBridgeParent::LeaveTestMode(const LayersId& aId) {
}
}
void CompositorBridgeParent::ApplyAsyncProperties(
LayerTransactionParent* aLayerTree, TransformsToSkip aSkip) {
// NOTE: This should only be used for testing. For example, when mTestTime is
// non-empty, or when called from test-only methods like
// LayerTransactionParent::RecvGetAnimationTransform.
// Synchronously update the layer tree
if (aLayerTree->GetRoot()) {
AutoResolveRefLayers resolve(mCompositionManager);
SetShadowProperties(mLayerManager->GetRoot());
SampleTime time;
if (mTestTime) {
time = SampleTime::FromTest(*mTestTime);
} else {
time = mCompositorScheduler->GetLastComposeTime();
}
bool requestNextFrame =
mCompositionManager->TransformShadowTree(time, mVsyncRate, aSkip);
if (!requestNextFrame) {
CancelCurrentCompositeTask();
// Pretend we composited in case someone is waiting for this event.
TimeStamp now = TimeStamp::Now();
DidComposite(VsyncId(), now, now);
}
}
}
CompositorAnimationStorage* CompositorBridgeParent::GetAnimationStorage() {
if (!mAnimationStorage) {
mAnimationStorage = new CompositorAnimationStorage(this);
@ -1347,8 +1132,8 @@ void CompositorBridgeParent::SetConfirmedTargetAPZC(
void CompositorBridgeParent::SetFixedLayerMargins(ScreenIntCoord aTop,
ScreenIntCoord aBottom) {
if (AsyncCompositionManager* manager = GetCompositionManager(nullptr)) {
manager->SetFixedLayerMargins(aTop, aBottom);
if (mCompositionManager) {
mCompositionManager->SetFixedLayerMargins(aTop, aBottom);
}
if (mApzcTreeManager) {
@ -1454,44 +1239,6 @@ RefPtr<Compositor> CompositorBridgeParent::NewCompositor(
return nullptr;
}
PLayerTransactionParent* CompositorBridgeParent::AllocPLayerTransactionParent(
const nsTArray<LayersBackend>& aBackendHints, const LayersId& aId) {
MOZ_ASSERT(!aId.IsValid());
#ifdef XP_WIN
// This is needed to avoid freezing the window on a device crash on double
// buffering, see bug 1549674.
if (gfxVars::UseDoubleBufferingWithCompositor() && XRE_IsGPUProcess() &&
aBackendHints.Contains(LayersBackend::LAYERS_D3D11)) {
mWidget->AsWindows()->EnsureCompositorWindow();
}
#endif
InitializeLayerManager(aBackendHints);
if (!mLayerManager) {
NS_WARNING("Failed to initialise Compositor");
LayerTransactionParent* p = new LayerTransactionParent(
/* aManager */ nullptr, this, /* aAnimStorage */ nullptr,
mRootLayerTreeID, mVsyncRate);
p->AddIPDLReference();
return p;
}
mCompositionManager = new AsyncCompositionManager(this, mLayerManager);
LayerTransactionParent* p = new LayerTransactionParent(
mLayerManager, this, GetAnimationStorage(), mRootLayerTreeID, mVsyncRate);
p->AddIPDLReference();
return p;
}
bool CompositorBridgeParent::DeallocPLayerTransactionParent(
PLayerTransactionParent* actor) {
static_cast<LayerTransactionParent*>(actor)->ReleaseIPDLReference();
return true;
}
CompositorBridgeParent* CompositorBridgeParent::GetCompositorBridgeParent(
uint64_t id) {
AssertIsInCompositorThread();
@ -1676,14 +1423,6 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvAdoptChild(
oldApzUpdater = sIndirectLayerTrees[child].mParent->mApzUpdater;
}
NotifyChildCreated(child);
if (sIndirectLayerTrees[child].mLayerTree) {
sIndirectLayerTrees[child].mLayerTree->SetLayerManager(
mLayerManager, GetAnimationStorage());
// Trigger composition to handle a case that mLayerTree was not composited
// yet by previous CompositorBridgeParent, since nsRefreshDriver might
// wait composition complete.
scheduleComposition = true;
}
if (mWrBridge) {
childWrBridge = sIndirectLayerTrees[child].mWrBridge;
}
@ -2145,22 +1884,6 @@ bool CompositorBridgeParent::DeallocPCompositorWidgetParent(
#endif
}
bool CompositorBridgeParent::IsPendingComposite() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
if (!mCompositor) {
return false;
}
return mCompositor->IsPendingComposite();
}
void CompositorBridgeParent::FinishPendingComposite() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
if (!mCompositor) {
return;
}
return mCompositor->FinishPendingComposite();
}
CompositorController*
CompositorBridgeParent::LayerTreeState::GetCompositorController() const {
return mParent;

View File

@ -90,7 +90,6 @@ class GeckoContentController;
class HostLayerManager;
class IAPZCTreeManager;
class Layer;
class LayerTransactionParent;
class OMTASampler;
class ContentCompositorBridgeParent;
class CompositorThreadHolder;
@ -122,25 +121,11 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
public:
explicit CompositorBridgeParentBase(CompositorManagerParent* aManager);
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const TransactionInfo& aInfo,
bool aHitTestUpdate) = 0;
virtual AsyncCompositionManager* GetCompositionManager(
LayerTransactionParent* aLayerTree) {
return nullptr;
}
virtual void NotifyClearCachedResources(LayerTransactionParent* aLayerTree) {}
virtual void ScheduleComposite(LayerTransactionParent* aLayerTree) {}
virtual bool SetTestSampleTime(const LayersId& aId, const TimeStamp& aTime) {
return true;
}
virtual void LeaveTestMode(const LayersId& aId) {}
enum class TransformsToSkip : uint8_t { NoneOfThem = 0, APZ = 1 };
virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree,
TransformsToSkip aSkip) = 0;
virtual void SetTestAsyncScrollOffset(
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) = 0;
@ -155,10 +140,6 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
virtual void SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
nsTArray<ScrollableLayerGuid>&& aTargets) = 0;
virtual void UpdatePaintTime(LayerTransactionParent* aLayerTree,
const TimeDuration& aPaintTime) {}
virtual void RegisterPayloads(LayerTransactionParent* aLayerTree,
const nsTArray<CompositionPayload>& aPayload) {}
IShmemAllocator* AsShmemAllocator() override { return this; }
@ -230,12 +211,6 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
virtual bool DeallocPAPZCTreeManagerParent(
PAPZCTreeManagerParent* aActor) = 0;
virtual PLayerTransactionParent* AllocPLayerTransactionParent(
const nsTArray<LayersBackend>& layersBackendHints,
const LayersId& id) = 0;
virtual bool DeallocPLayerTransactionParent(
PLayerTransactionParent* aActor) = 0;
virtual PTextureParent* AllocPTextureParent(
const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock,
const LayersBackend& aBackend, const TextureFlags& aTextureFlags,
@ -308,8 +283,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(
CompositorBridgeParentBase::TransformsToSkip)
class CompositorBridgeParent final : public CompositorBridgeParentBase,
public CompositorController,
public CompositorVsyncSchedulerOwner {
public CompositorController {
friend class CompositorThreadHolder;
friend class InProcessCompositorSession;
friend class gfx::GPUProcessManager;
@ -384,14 +358,8 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
void ActorDestroy(ActorDestroyReason why) override;
void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const TransactionInfo& aInfo,
bool aHitTestUpdate) override;
void ScheduleComposite(LayerTransactionParent* aLayerTree) override;
bool SetTestSampleTime(const LayersId& aId, const TimeStamp& aTime) override;
void LeaveTestMode(const LayersId& aId) override;
void ApplyAsyncProperties(LayerTransactionParent* aLayerTree,
TransformsToSkip aSkip) override;
CompositorAnimationStorage* GetAnimationStorage();
using JankedAnimations =
std::unordered_map<LayersId, nsTArray<uint64_t>, LayersId::HashFn>;
@ -410,10 +378,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
void SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
nsTArray<ScrollableLayerGuid>&& aTargets) override;
AsyncCompositionManager* GetCompositionManager(
LayerTransactionParent* aLayerTree) override {
return mCompositionManager;
}
void SetFixedLayerMargins(ScreenIntCoord aTop, ScreenIntCoord aBottom);
PTextureParent* AllocPTextureParent(
@ -479,11 +443,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
bool aIsRepeatTransaction,
bool aHitTestUpdate);
void UpdatePaintTime(LayerTransactionParent* aLayerTree,
const TimeDuration& aPaintTime) override;
void RegisterPayloads(LayerTransactionParent* aLayerTree,
const nsTArray<CompositionPayload>& aPayload) override;
/**
* Check rotation info and schedule a rendering task if needed.
* Only can be called from compositor thread.
@ -547,7 +506,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
// the PCompositorBridgeChild
ContentCompositorBridgeParent* mContentCompositorBridgeParent;
TargetConfig mTargetConfig;
LayerTransactionParent* mLayerTree;
CompositorController* GetCompositorController() const;
MetricsSharingController* CrossProcessSharingController() const;
@ -616,7 +574,7 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
CompositorOptions GetOptions() const { return mOptions; }
TimeDuration GetVsyncInterval() const override {
TimeDuration GetVsyncInterval() const {
// the variable is called "rate" but really it's an interval
return mVsyncRate;
}
@ -707,12 +665,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
void DeferredDestroy();
PLayerTransactionParent* AllocPLayerTransactionParent(
const nsTArray<LayersBackend>& aBackendHints,
const LayersId& aId) override;
bool DeallocPLayerTransactionParent(
PLayerTransactionParent* aLayers) override;
void SetEGLSurfaceRect(int x, int y, int width, int height);
void InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints);
@ -728,12 +680,6 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
void ForceComposition();
void CancelCurrentCompositeTask();
// CompositorVsyncSchedulerOwner
bool IsPendingComposite() override;
void FinishPendingComposite() override;
void CompositeToTarget(VsyncId aId, gfx::DrawTarget* aTarget,
const gfx::IntRect* aRect = nullptr) override;
RefPtr<Compositor> NewCompositor(
const nsTArray<LayersBackend>& aBackendHints);

View File

@ -8,7 +8,6 @@
#include <stdint.h> // for uint64_t
#include "LayerTransactionParent.h" // for LayerTransactionParent
#include "apz/src/APZCTreeManager.h" // for APZCTreeManager
#include "gfxUtils.h"
#ifdef XP_WIN
@ -25,7 +24,6 @@
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/LayerManagerComposite.h"
#include "mozilla/layers/LayerTreeOwnerTracker.h"
#include "mozilla/layers/PLayerTransactionParent.h"
#include "mozilla/layers/RemoteContentController.h"
#include "mozilla/layers/WebRenderBridgeParent.h"
#include "mozilla/layers/AsyncImagePipelineManager.h"
@ -63,57 +61,6 @@ void ContentCompositorBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
&ContentCompositorBridgeParent::DeferredDestroy));
}
PLayerTransactionParent*
ContentCompositorBridgeParent::AllocPLayerTransactionParent(
const nsTArray<LayersBackend>&, const LayersId& aId) {
MOZ_ASSERT(aId.IsValid());
// Check to see if this child process has access to this layer tree.
if (!LayerTreeOwnerTracker::Get()->IsMapped(aId, OtherPid())) {
NS_ERROR(
"Unexpected layers id in AllocPLayerTransactionParent; dropping "
"message...");
return nullptr;
}
MonitorAutoLock lock(*sIndirectLayerTreesLock);
CompositorBridgeParent::LayerTreeState* state = nullptr;
LayerTreeMap::iterator itr = sIndirectLayerTrees.find(aId);
if (sIndirectLayerTrees.end() != itr) {
state = &itr->second;
}
if (state && state->mLayerManager) {
state->mContentCompositorBridgeParent = this;
HostLayerManager* lm = state->mLayerManager;
CompositorAnimationStorage* animStorage =
state->mParent ? state->mParent->GetAnimationStorage() : nullptr;
TimeDuration vsyncRate =
state->mParent ? state->mParent->GetVsyncInterval() : TimeDuration();
LayerTransactionParent* p =
new LayerTransactionParent(lm, this, animStorage, aId, vsyncRate);
p->AddIPDLReference();
sIndirectLayerTrees[aId].mLayerTree = p;
return p;
}
NS_WARNING("Created child without a matching parent?");
LayerTransactionParent* p = new LayerTransactionParent(
/* aManager */ nullptr, this, /* aAnimStorage */ nullptr, aId,
TimeDuration());
p->AddIPDLReference();
return p;
}
bool ContentCompositorBridgeParent::DeallocPLayerTransactionParent(
PLayerTransactionParent* aLayers) {
LayerTransactionParent* slp = static_cast<LayerTransactionParent*>(aLayers);
EraseLayerState(slp->GetId());
static_cast<LayerTransactionParent*>(aLayers)->ReleaseIPDLReference();
return true;
}
PAPZCTreeManagerParent*
ContentCompositorBridgeParent::AllocPAPZCTreeManagerParent(
const LayersId& aLayersId) {
@ -320,104 +267,15 @@ mozilla::ipc::IPCResult ContentCompositorBridgeParent::RecvCheckContentOnlyTDR(
return IPC_OK();
};
void ContentCompositorBridgeParent::ShadowLayersUpdated(
LayerTransactionParent* aLayerTree, const TransactionInfo& aInfo,
bool aHitTestUpdate) {
LayersId id = aLayerTree->GetId();
MOZ_ASSERT(id.IsValid());
CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(id);
if (!state) {
return;
}
MOZ_ASSERT(state->mParent);
state->mParent->ScheduleRotationOnCompositorThread(aInfo.targetConfig(),
aInfo.isFirstPaint());
Layer* shadowRoot = aLayerTree->GetRoot();
if (shadowRoot) {
CompositorBridgeParent::SetShadowProperties(shadowRoot);
}
UpdateIndirectTree(id, shadowRoot, aInfo.targetConfig());
state->mParent->NotifyShadowTreeTransaction(
id, aInfo.isFirstPaint(), aInfo.focusTarget(), aInfo.scheduleComposite(),
aInfo.paintSequenceNumber(), aInfo.isRepeatTransaction(), aHitTestUpdate);
if (aLayerTree->ShouldParentObserveEpoch()) {
// Note that we send this through the window compositor, since this needs
// to reach the widget owning the tab.
Unused << state->mParent->SendObserveLayersUpdate(
id, aLayerTree->GetChildEpoch(), true);
}
auto endTime = TimeStamp::Now();
if (profiler_can_accept_markers()) {
profiler_add_marker(
"CONTENT_FULL_PAINT_TIME", geckoprofiler::category::GRAPHICS,
MarkerTiming::Interval(aInfo.transactionStart(), endTime),
baseprofiler::markers::ContentBuildMarker{});
}
Telemetry::Accumulate(
Telemetry::CONTENT_FULL_PAINT_TIME,
static_cast<uint32_t>(
(endTime - aInfo.transactionStart()).ToMilliseconds()));
RegisterPayloads(aLayerTree, aInfo.payload());
aLayerTree->SetPendingTransactionId(
aInfo.id(), aInfo.vsyncId(), aInfo.vsyncStart(), aInfo.refreshStart(),
aInfo.transactionStart(), endTime, aInfo.containsSVG(), aInfo.url(),
aInfo.fwdTime());
}
void ContentCompositorBridgeParent::DidCompositeLocked(
LayersId aId, const VsyncId& aVsyncId, TimeStamp& aCompositeStart,
TimeStamp& aCompositeEnd) {
sIndirectLayerTreesLock->AssertCurrentThreadOwns();
if (LayerTransactionParent* layerTree = sIndirectLayerTrees[aId].mLayerTree) {
nsTArray<TransactionId> transactions;
layerTree->FlushPendingTransactions(aVsyncId, aCompositeEnd, transactions);
if (!transactions.IsEmpty()) {
Unused << SendDidComposite(aId, transactions, aCompositeStart,
aCompositeEnd);
}
} else if (sIndirectLayerTrees[aId].mWrBridge) {
if (sIndirectLayerTrees[aId].mWrBridge) {
MOZ_ASSERT(false); // this should never get called for a WR compositor
}
}
void ContentCompositorBridgeParent::ScheduleComposite(
LayerTransactionParent* aLayerTree) {
LayersId id = aLayerTree->GetId();
MOZ_ASSERT(id.IsValid());
CompositorBridgeParent* parent;
{ // scope lock
MonitorAutoLock lock(*sIndirectLayerTreesLock);
parent = sIndirectLayerTrees[id].mParent;
}
if (parent) {
parent->ScheduleComposite(aLayerTree);
}
}
void ContentCompositorBridgeParent::NotifyClearCachedResources(
LayerTransactionParent* aLayerTree) {
LayersId id = aLayerTree->GetId();
MOZ_ASSERT(id.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(id);
if (state && state->mParent) {
// Note that we send this through the window compositor, since this needs
// to reach the widget owning the tab.
Unused << state->mParent->SendObserveLayersUpdate(
id, aLayerTree->GetChildEpoch(), false);
}
}
bool ContentCompositorBridgeParent::SetTestSampleTime(const LayersId& aId,
const TimeStamp& aTime) {
MOZ_ASSERT(aId.IsValid());
@ -443,20 +301,6 @@ void ContentCompositorBridgeParent::LeaveTestMode(const LayersId& aId) {
state->mParent->LeaveTestMode(aId);
}
void ContentCompositorBridgeParent::ApplyAsyncProperties(
LayerTransactionParent* aLayerTree, TransformsToSkip aSkip) {
LayersId id = aLayerTree->GetId();
MOZ_ASSERT(id.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(id);
if (!state) {
return;
}
MOZ_ASSERT(state->mParent);
state->mParent->ApplyAsyncProperties(aLayerTree, aSkip);
}
void ContentCompositorBridgeParent::SetTestAsyncScrollOffset(
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) {
@ -535,19 +379,6 @@ void ContentCompositorBridgeParent::SetConfirmedTargetAPZC(
std::move(aTargets));
}
AsyncCompositionManager* ContentCompositorBridgeParent::GetCompositionManager(
LayerTransactionParent* aLayerTree) {
LayersId id = aLayerTree->GetId();
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(id);
if (!state) {
return nullptr;
}
MOZ_ASSERT(state->mParent);
return state->mParent->GetCompositionManager(aLayerTree);
}
void ContentCompositorBridgeParent::DeferredDestroy() { mSelfRef = nullptr; }
ContentCompositorBridgeParent::~ContentCompositorBridgeParent() {
@ -624,35 +455,6 @@ bool ContentCompositorBridgeParent::IsSameProcess() const {
return OtherPid() == base::GetCurrentProcId();
}
void ContentCompositorBridgeParent::UpdatePaintTime(
LayerTransactionParent* aLayerTree, const TimeDuration& aPaintTime) {
LayersId id = aLayerTree->GetId();
MOZ_ASSERT(id.IsValid());
CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(id);
if (!state || !state->mParent) {
return;
}
state->mParent->UpdatePaintTime(aLayerTree, aPaintTime);
}
void ContentCompositorBridgeParent::RegisterPayloads(
LayerTransactionParent* aLayerTree,
const nsTArray<CompositionPayload>& aPayload) {
LayersId id = aLayerTree->GetId();
MOZ_ASSERT(id.IsValid());
CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(id);
if (!state || !state->mParent) {
return;
}
state->mParent->RegisterPayloads(aLayerTree, aPayload);
}
void ContentCompositorBridgeParent::ObserveLayersUpdate(
LayersId aLayersId, LayersObserverEpoch aEpoch, bool aActive) {
MOZ_ASSERT(aLayersId.IsValid());

View File

@ -108,22 +108,8 @@ class ContentCompositorBridgeParent final : public CompositorBridgeParentBase {
return IPC_OK();
}
PLayerTransactionParent* AllocPLayerTransactionParent(
const nsTArray<LayersBackend>& aBackendHints,
const LayersId& aId) override;
bool DeallocPLayerTransactionParent(
PLayerTransactionParent* aLayers) override;
void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
const TransactionInfo& aInfo,
bool aHitTestUpdate) override;
void ScheduleComposite(LayerTransactionParent* aLayerTree) override;
void NotifyClearCachedResources(LayerTransactionParent* aLayerTree) override;
bool SetTestSampleTime(const LayersId& aId, const TimeStamp& aTime) override;
void LeaveTestMode(const LayersId& aId) override;
void ApplyAsyncProperties(LayerTransactionParent* aLayerTree,
TransformsToSkip aSkip) override;
void SetTestAsyncScrollOffset(const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) override;
@ -139,9 +125,6 @@ class ContentCompositorBridgeParent final : public CompositorBridgeParentBase {
const LayersId& aLayersId, const uint64_t& aInputBlockId,
nsTArray<ScrollableLayerGuid>&& aTargets) override;
AsyncCompositionManager* GetCompositionManager(
LayerTransactionParent* aParent) override;
already_AddRefed<dom::PWebGLParent> AllocPWebGLParent() override;
// Use DidCompositeLocked if you already hold a lock on
@ -183,11 +166,6 @@ class ContentCompositorBridgeParent final : public CompositorBridgeParentBase {
PAPZParent* AllocPAPZParent(const LayersId& aLayersId) override;
bool DeallocPAPZParent(PAPZParent* aActor) override;
void UpdatePaintTime(LayerTransactionParent* aLayerTree,
const TimeDuration& aPaintTime) override;
void RegisterPayloads(LayerTransactionParent* aLayerTree,
const nsTArray<CompositionPayload>& aPayload) override;
PWebRenderBridgeParent* AllocPWebRenderBridgeParent(
const wr::PipelineId& aPipelineId, const LayoutDeviceIntSize& aSize,
const WindowKind& aWindowKind) override;

View File

@ -7,6 +7,7 @@
#include "KnowsCompositor.h"
#include "mozilla/layers/ImageDataSerializer.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/ipc/ProtocolUtils.h"
namespace mozilla {
namespace layers {

View File

@ -1,36 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "LayerTransactionChild.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsTArray.h" // for nsTArray
#include "mozilla/layers/TextureClient.h"
namespace mozilla {
namespace layers {
void LayerTransactionChild::Destroy() {
if (!IPCOpen()) {
return;
}
// mDestroyed is used to prevent calling Send__delete__() twice.
// When this function is called from CompositorBridgeChild::Destroy(),
// under Send__delete__() call, this function is called from
// ShadowLayerForwarder's destructor.
// When it happens, IPCOpen() is still true.
// See bug 1004191.
mDestroyed = true;
SendShutdown();
}
void LayerTransactionChild::ActorDestroy(ActorDestroyReason why) {
mDestroyed = true;
}
} // namespace layers
} // namespace mozilla

View File

@ -1,74 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
#define MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H
#include <stdint.h> // for uint32_t
#include "mozilla/Attributes.h" // for override
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/RefPtr.h"
namespace mozilla {
namespace layers {
class ShadowLayerForwarder;
class LayerTransactionChild : public PLayerTransactionChild {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LayerTransactionChild)
/**
* Clean this up, finishing with SendShutDown() which will cause __delete__
* to be sent from the parent side.
*
* It is expected (checked with an assert) that all shadow layers
* created by this have already been destroyed and
* Send__delete__()d by the time this method is called.
*/
void Destroy();
bool IPCOpen() const { return mIPCOpen && !mDestroyed; }
bool IsDestroyed() const { return mDestroyed; }
void SetForwarder(ShadowLayerForwarder* aForwarder) {
mForwarder = aForwarder;
}
LayersId GetId() const { return mId; }
void MarkDestroyed() { mDestroyed = true; }
protected:
explicit LayerTransactionChild(const LayersId& aId)
: mForwarder(nullptr), mIPCOpen(false), mDestroyed(false), mId(aId) {}
virtual ~LayerTransactionChild() = default;
void ActorDestroy(ActorDestroyReason why) override;
void AddIPDLReference() {
MOZ_ASSERT(mIPCOpen == false);
mIPCOpen = true;
AddRef();
}
void ReleaseIPDLReference() {
MOZ_ASSERT(mIPCOpen == true);
mIPCOpen = false;
Release();
}
friend class CompositorBridgeChild;
ShadowLayerForwarder* mForwarder;
bool mIPCOpen;
bool mDestroyed;
LayersId mId;
};
} // namespace layers
} // namespace mozilla
#endif // MOZILLA_LAYERS_LAYERTRANSACTIONCHILD_H

File diff suppressed because it is too large Load Diff

View File

@ -1,235 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MOZILLA_LAYERS_LAYERTRANSACTIONPARENT_H
#define MOZILLA_LAYERS_LAYERTRANSACTIONPARENT_H
#include <stddef.h> // for size_t
#include <stdint.h> // for uint64_t, uint32_t
#include "CompositableTransactionParent.h"
#include "mozilla/Attributes.h" // for override
#include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc
#include "mozilla/layers/PLayerTransactionParent.h"
#include "nsRefPtrHashtable.h"
#include "nsTArrayForwardDeclare.h" // for nsTArray
namespace mozilla {
namespace ipc {
class Shmem;
} // namespace ipc
namespace layers {
class Layer;
class HostLayerManager;
class ShadowLayerParent;
class CompositableParent;
class CompositorAnimationStorage;
class CompositorBridgeParentBase;
class LayerTransactionParent final : public PLayerTransactionParent,
public CompositableParentManager,
public mozilla::ipc::IShmemAllocator {
typedef nsTArray<Edit> EditArray;
typedef nsTArray<OpDestroy> OpDestroyArray;
friend class PLayerTransactionParent;
public:
LayerTransactionParent(HostLayerManager* aManager,
CompositorBridgeParentBase* aBridge,
CompositorAnimationStorage* aAnimStorage, LayersId aId,
TimeDuration aVsyncRate);
protected:
virtual ~LayerTransactionParent();
public:
void Destroy();
void SetLayerManager(HostLayerManager* aLayerManager,
CompositorAnimationStorage* aAnimStorage);
LayersId GetId() const { return mId; }
Layer* GetRoot() const { return mRoot; }
LayersObserverEpoch GetChildEpoch() const { return mChildEpoch; }
bool ShouldParentObserveEpoch();
IShmemAllocator* AsShmemAllocator() override { return this; }
bool AllocShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) override;
bool AllocUnsafeShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) override;
bool DeallocShmem(ipc::Shmem& aShmem) override;
bool IsSameProcess() const override;
void SetPendingTransactionId(TransactionId aId, const VsyncId& aVsyncId,
const TimeStamp& aVsyncStartTime,
const TimeStamp& aRefreshStartTime,
const TimeStamp& aTxnStartTime,
const TimeStamp& aTxnEndTime, bool aContainsSVG,
const nsCString& aURL,
const TimeStamp& aFwdTime);
void FlushPendingTransactions(const VsyncId& aId, TimeStamp& aCompositeEnd,
nsTArray<TransactionId>& aOutTransactions);
// CompositableParentManager
void SendAsyncMessage(
const nsTArray<AsyncParentMessageData>& aMessage) override;
void SendPendingAsyncMessages() override;
void SetAboutToSendAsyncMessages() override;
void NotifyNotUsed(PTextureParent* aTexture,
uint64_t aTransactionId) override;
base::ProcessId GetChildProcessId() override { return OtherPid(); }
protected:
mozilla::ipc::IPCResult RecvShutdown();
mozilla::ipc::IPCResult RecvShutdownSync();
mozilla::ipc::IPCResult RecvPaintTime(const TransactionId& aTransactionId,
const TimeDuration& aPaintTime);
mozilla::ipc::IPCResult RecvUpdate(const TransactionInfo& aInfo);
mozilla::ipc::IPCResult RecvSetLayersObserverEpoch(
const LayersObserverEpoch& aChildEpoch);
mozilla::ipc::IPCResult RecvNewCompositable(const CompositableHandle& aHandle,
const TextureInfo& aInfo);
mozilla::ipc::IPCResult RecvReleaseLayer(const LayerHandle& aHandle);
mozilla::ipc::IPCResult RecvReleaseCompositable(
const CompositableHandle& aHandle);
mozilla::ipc::IPCResult RecvClearCachedResources();
mozilla::ipc::IPCResult RecvScheduleComposite();
mozilla::ipc::IPCResult RecvSetTestSampleTime(const TimeStamp& aTime);
mozilla::ipc::IPCResult RecvLeaveTestMode();
mozilla::ipc::IPCResult RecvGetAnimationValue(
const uint64_t& aCompositorAnimationsId, OMTAValue* aValue);
mozilla::ipc::IPCResult RecvGetTransform(const LayerHandle& aHandle,
Maybe<Matrix4x4>* aTransform);
mozilla::ipc::IPCResult RecvSetAsyncScrollOffset(
const ScrollableLayerGuid::ViewID& aId, const float& aX, const float& aY);
mozilla::ipc::IPCResult RecvSetAsyncZoom(
const ScrollableLayerGuid::ViewID& aId, const float& aValue);
mozilla::ipc::IPCResult RecvFlushApzRepaints();
mozilla::ipc::IPCResult RecvGetAPZTestData(APZTestData* aOutData);
mozilla::ipc::IPCResult RecvGetFrameUniformity(FrameUniformityData* aOutData);
mozilla::ipc::IPCResult RecvRequestProperty(const nsString& aProperty,
float* aValue);
mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(
const uint64_t& aBlockId, nsTArray<ScrollableLayerGuid>&& aTargets);
mozilla::ipc::IPCResult RecvRecordPaintTimes(const PaintTiming& aTiming);
mozilla::ipc::IPCResult RecvGetTextureFactoryIdentifier(
TextureFactoryIdentifier* aIdentifier);
bool SetLayerAttributes(const OpSetLayerAttributes& aOp);
void ActorDestroy(ActorDestroyReason why) override;
template <typename T>
bool BindLayer(const RefPtr<Layer>& aLayer, const T& aCreateOp) {
return BindLayerToHandle(aLayer, aCreateOp.layer());
}
bool BindLayerToHandle(RefPtr<Layer> aLayer, const LayerHandle& aHandle);
Layer* AsLayer(const LayerHandle& aLayer);
bool Attach(Layer* aLayer, CompositableHost* aCompositable,
bool aIsAsyncVideo);
void AddIPDLReference() {
MOZ_ASSERT(mIPCOpen == false);
mIPCOpen = true;
AddRef();
}
void ReleaseIPDLReference() {
MOZ_ASSERT(mIPCOpen == true);
mIPCOpen = false;
Release();
}
friend class CompositorBridgeParent;
friend class ContentCompositorBridgeParent;
private:
// This is a function so we can log or breakpoint on why hit
// testing tree changes are made.
void UpdateHitTestingTree(Layer* aLayer, const char* aWhy) {
mUpdateHitTestingTree = true;
}
private:
RefPtr<HostLayerManager> mLayerManager;
CompositorBridgeParentBase* mCompositorBridge;
RefPtr<CompositorAnimationStorage> mAnimStorage;
// Hold the root because it might be grafted under various
// containers in the "real" layer tree
RefPtr<Layer> mRoot;
// Mapping from LayerHandles to Layers.
nsRefPtrHashtable<nsUint64HashKey, Layer> mLayerMap;
LayersId mId;
// These fields keep track of the latest epoch values in the child and the
// parent. mChildEpoch is the latest epoch value received from the child.
// mParentEpoch is the latest epoch value that we have told BrowserParent
// about (via ObserveLayerUpdate).
LayersObserverEpoch mChildEpoch;
LayersObserverEpoch mParentEpoch;
TimeDuration mVsyncRate;
struct PendingTransaction {
TransactionId mId;
VsyncId mTxnVsyncId;
TimeStamp mVsyncStartTime;
TimeStamp mRefreshStartTime;
TimeStamp mTxnStartTime;
TimeStamp mTxnEndTime;
TimeStamp mFwdTime;
nsCString mTxnURL;
bool mContainsSVG;
};
AutoTArray<PendingTransaction, 2> mPendingTransactions;
// When the widget/frame/browser stuff in this process begins its
// destruction process, we need to Disconnect() all the currently
// live shadow layers, because some of them might be orphaned from
// the layer tree. This happens in Destroy() above. After we
// Destroy() ourself, there's a window in which that information
// hasn't yet propagated back to the child side and it might still
// send us layer transactions. We want to ignore those transactions
// because they refer to "zombie layers" on this side. So, we track
// that state with |mDestroyed|. This is similar to, but separate
// from, |mLayerManager->IsDestroyed()|; we might have had Destroy()
// called on us but the mLayerManager might not be destroyed, or
// vice versa. In both cases though, we want to ignore shadow-layer
// transactions posted by the child.
bool mDestroyed;
bool mIPCOpen;
// This is set during RecvUpdate to track whether we'll need to update
// APZ's hit test regions.
bool mUpdateHitTestingTree;
};
} // namespace layers
} // namespace mozilla
#endif // MOZILLA_LAYERS_LAYERTRANSACTIONPARENT_H

View File

@ -15,7 +15,6 @@ include protocol PBrowser;
include protocol PCanvas;
include protocol PCompositorManager;
include protocol PCompositorWidget;
include protocol PLayerTransaction;
include protocol PTexture;
include protocol PWebGL;
include protocol PWebRenderBridge;
@ -99,7 +98,6 @@ struct FrameStats {
manages PAPZ;
manages PAPZCTreeManager;
// A Compositor manages a single Layer Manager (PLayerTransaction)
manages PLayerTransaction;
manages PTexture;
manages PCompositorWidget;
manages PWebRenderBridge;
@ -209,11 +207,6 @@ parent:
sync StopFrameTimeRecording(uint32_t startIndex)
returns (float[] intervals);
// layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored.
async PLayerTransaction(LayersBackend[] layersBackendHints, LayersId id);
// Notify the compositor that a region of the screen has been invalidated.
async NotifyRegionInvalidated(nsIntRegion region);

View File

@ -1,130 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
include LayersMessages;
include protocol PCompositorBridge;
include protocol PTexture;
include "mozilla/GfxMessageUtils.h";
include "mozilla/layers/LayersMessageUtils.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using struct mozilla::void_t from "mozilla/ipc/IPCCore.h";
using struct mozilla::null_t from "mozilla/ipc/IPCCore.h";
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
using mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
using mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
using mozilla::layers::LayerHandle from "mozilla/layers/LayersTypes.h";
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
/**
* The layers protocol is spoken between thread contexts that manage
* layer (sub)trees. The protocol comprises atomically publishing
* layer subtrees to a "shadow" thread context (which grafts the
* subtree into its own tree), and atomically updating a published
* subtree. ("Atomic" in this sense is wrt painting.)
*/
namespace mozilla {
namespace layers {
/**
* The PLayerTransaction protocol manages the layer tree for a single "browser".
* The "browser" can be a top-level browser window, in which case the PLayer-
* TransactionChild exists in the UI process. The "browser" can also be a content
* tab, in which case the PLayerTransactionChild exists in the content process.
* In either case, the PLayerTransactionParent exists in the GPU process (if
* there is one) or the UI process otherwise.
*/
sync protocol PLayerTransaction {
manager PCompositorBridge;
parent:
// The isFirstPaint flag can be used to indicate that this is the first update
// for a particular document.
async Update(TransactionInfo txn);
async PaintTime(TransactionId id, TimeDuration paintTime);
async SetLayersObserverEpoch(LayersObserverEpoch aChildEpoch);
// Create a new Compositable.
async NewCompositable(CompositableHandle handle, TextureInfo info);
// Release an object that is no longer in use.
async ReleaseLayer(LayerHandle layer);
async ReleaseCompositable(CompositableHandle compositable);
// Tell the compositor to notify APZ that a layer has been confirmed for an
// input event.
async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
// Testing APIs
// Enter test mode, set the sample time to sampleTime, and resample
// animations. sampleTime must not be null.
sync SetTestSampleTime(TimeStamp sampleTime);
// Leave test mode and resume normal compositing
sync LeaveTestMode();
// Returns |OMTAValue| applied to the layer.
sync GetAnimationValue(uint64_t aCompositorAnimationId) returns (OMTAValue value);
// Returns the value of the transform applied to the layer by animation and
// APZC.
sync GetTransform(LayerHandle layer) returns (Matrix4x4? transform);
// The next time the layer tree is composited, add this async scroll offset in
// CSS pixels for the given ViewID.
// Useful for testing rendering of async scrolling.
sync SetAsyncScrollOffset(ViewID id, float x, float y);
// The next time the layer tree is composited, include this async zoom in
// for the given ViewID.
// Useful for testing rendering of async zooming.
sync SetAsyncZoom(ViewID id, float zoom);
// Flush any pending APZ repaints to the main thread.
async FlushApzRepaints();
// Drop any front buffers that might be retained on the compositor
// side.
async ClearCachedResources();
// Schedule a composite if one isn't already scheduled.
async ScheduleComposite();
// Get a copy of the compositor-side APZ test data instance for this
// layers id.
sync GetAPZTestData() returns (APZTestData data);
// Child requests frame uniformity measurements
sync GetFrameUniformity() returns (FrameUniformityData data);
// Query a named property from the last frame
sync RequestProperty(nsString property) returns (float value);
// Return the TextureFactoryIdentifier for this compositor.
sync GetTextureFactoryIdentifier() returns (TextureFactoryIdentifier aIdentifier);
async RecordPaintTimes(PaintTiming timing);
async Shutdown();
sync ShutdownSync();
child:
async __delete__();
};
} // namespace layers
} // namespace mozilla

View File

@ -6,7 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces;
include protocol PLayerTransaction;
include protocol PCompositorBridge;
include protocol PImageBridge;
include protocol PVideoBridge;

View File

@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/gfx/Point.h"
#include "mozilla/layers/PLayerTransaction.h"
#include "mozilla/layers/LayerManagerComposite.h"
#include "mozilla/layers/CompositorTypes.h"

View File

@ -186,8 +186,6 @@ EXPORTS.mozilla.layers += [
"ipc/KnowsCompositor.h",
"ipc/LayerAnimationUtils.h",
"ipc/LayersMessageUtils.h",
"ipc/LayerTransactionChild.h",
"ipc/LayerTransactionParent.h",
"ipc/LayerTreeOwnerTracker.h",
"ipc/RefCountedShmem.h",
"ipc/RemoteContentController.h",
@ -443,8 +441,6 @@ UNIFIED_SOURCES += [
"ipc/ISurfaceAllocator.cpp",
"ipc/KnowsCompositor.cpp",
"ipc/LayerAnimationUtils.cpp",
"ipc/LayerTransactionChild.cpp",
"ipc/LayerTransactionParent.cpp",
"ipc/LayerTreeOwnerTracker.cpp",
"ipc/RefCountedShmem.cpp",
"ipc/RemoteContentController.cpp",
@ -537,7 +533,6 @@ IPDL_SOURCES += [
"ipc/PCompositorBridgeTypes.ipdlh",
"ipc/PCompositorManager.ipdl",
"ipc/PImageBridge.ipdl",
"ipc/PLayerTransaction.ipdl",
"ipc/PTexture.ipdl",
"ipc/PUiCompositorController.ipdl",
"ipc/PVideoBridge.ipdl",

View File

@ -8,8 +8,6 @@
segment_capacity = 16384
[PContent::AccumulateChildHistograms]
segment_capacity = 16384
[PLayerTransaction::Update]
segment_capacity = 8192
[PContent::StoreAndBroadcastBlobURLRegistration]
segment_capacity = 8192
[PHttpChannel::Redirect1Begin]

View File

@ -85,7 +85,6 @@
#include "mozilla/layers/APZPublicUtils.h"
#include "mozilla/layers/AxisPhysicsModel.h"
#include "mozilla/layers/AxisPhysicsMSDModel.h"
#include "mozilla/layers/LayerTransactionChild.h"
#include "mozilla/layers/ScrollLinkedEffectDetector.h"
#include "mozilla/Unused.h"
#include "MobileViewportManager.h"

View File

@ -11,7 +11,6 @@
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/layers/CompositorBridgeParent.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayerTransactionParent.h"
#include "nsFrameLoader.h"
#include "nsStyleStructInlines.h"
#include "nsSubDocumentFrame.h"

View File

@ -27,7 +27,6 @@
#include "mozilla/dom/SVGElement.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/layers/PLayerTransaction.h"
#include "mozilla/PresShell.h"
#include "mozilla/ShapeUtils.h"
#include "mozilla/StaticPrefs_apz.h"

View File

@ -14,7 +14,6 @@
#include "mozilla/Hal.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/layers/APZChild.h"
#include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"

View File

@ -123,7 +123,6 @@ using mozilla::java::GeckoSession;
#include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/CompositorSession.h"
#include "mozilla/layers/LayerTransactionParent.h"
#include "mozilla/layers/UiCompositorControllerChild.h"
#include "nsThreadUtils.h"

View File

@ -52,7 +52,6 @@
#include "mozilla/layers/IAPZCTreeManager.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "mozilla/layers/InputAPZContext.h"
#include "mozilla/layers/PLayerTransactionChild.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "nsAppDirectoryServiceDefs.h"

View File

@ -81,7 +81,6 @@ class CompositorBridgeChild;
struct FrameMetrics;
class LayerManager;
class LayerManagerComposite;
class PLayerTransactionChild;
class WebRenderBridgeChild;
} // namespace layers
namespace gfx {
@ -381,7 +380,6 @@ class nsIWidget : public nsISupports {
typedef mozilla::layers::LayerManagerComposite LayerManagerComposite;
typedef mozilla::layers::LayersBackend LayersBackend;
typedef mozilla::layers::LayersId LayersId;
typedef mozilla::layers::PLayerTransactionChild PLayerTransactionChild;
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
typedef mozilla::layers::ZoomConstraints ZoomConstraints;
typedef mozilla::widget::IMEEnabled IMEEnabled;