Bug 1728914 - Move payload handling from LayerManger to WebRenderLayerManager. r=gfx-reviewers,aosmond,jrmuizel

Depends on D124418

Differential Revision: https://phabricator.services.mozilla.com/D124419
This commit is contained in:
Matt Woodrow 2021-09-05 02:16:37 +00:00
Родитель de15de8fe8
Коммит 20dea375cb
5 изменённых файлов: 17 добавлений и 32 удалений

Просмотреть файл

@ -154,9 +154,5 @@ UniquePtr<LayerUserData> LayerManager::RemoveUserData(void* aKey) {
return d;
}
void LayerManager::PayloadPresented(const TimeStamp& aTimeStamp) {
RecordCompositionPayloadsPresented(aTimeStamp, mPayload);
}
} // namespace layers
} // namespace mozilla

Просмотреть файл

@ -523,18 +523,6 @@ class LayerManager : public WindowRenderer {
virtual TransactionId GetLastTransactionId() { return TransactionId{0}; }
void RegisterPayload(const CompositionPayload& aPayload) {
mPayload.AppendElement(aPayload);
MOZ_ASSERT(mPayload.Length() < 10000);
}
void RegisterPayloads(const nsTArray<CompositionPayload>& aPayload) {
mPayload.AppendElements(aPayload);
MOZ_ASSERT(mPayload.Length() < 10000);
}
virtual void PayloadPresented(const TimeStamp& aTimeStamp);
void SetContainsSVG(bool aContainsSVG) { mContainsSVG = aContainsSVG; }
protected:
@ -559,14 +547,6 @@ class LayerManager : public WindowRenderer {
bool mContainsSVG;
// The count of pixels that were painted in the current transaction.
uint32_t mPaintedPixelCount;
// The payload associated with currently pending painting work, for
// client layer managers that typically means payload that is part of the
// 'upcoming transaction', for HostLayerManagers this typically means
// what has been included in received transactions to be presented on the
// next composite.
// IMPORTANT: Clients should take care to clear this or risk it slowly
// growing out of control.
nsTArray<CompositionPayload> mPayload;
public:
/*

Просмотреть файл

@ -207,10 +207,6 @@ void WebRenderLayerManager::StopFrameTimeRecording(
}
}
void WebRenderLayerManager::PayloadPresented(const TimeStamp& aTimeStamp) {
MOZ_CRASH("WebRenderLayerManager::PayloadPresented should not be called");
}
void WebRenderLayerManager::TakeCompositionPayloads(
nsTArray<CompositionPayload>& aPayloads) {
aPayloads.Clear();

Просмотреть файл

@ -188,12 +188,15 @@ class WebRenderLayerManager final : public LayerManager {
RenderRootStateManager* GetRenderRootStateManager() { return &mStateManager; }
virtual void PayloadPresented(const TimeStamp& aTimeStamp) override;
void TakeCompositionPayloads(nsTArray<CompositionPayload>& aPayloads);
void GetFrameUniformity(FrameUniformityData* aOutData) override;
void RegisterPayloads(const nsTArray<CompositionPayload>& aPayload) {
mPayload.AppendElements(aPayload);
MOZ_ASSERT(mPayload.Length() < 10000);
}
private:
/**
* Take a snapshot of the parent context, and copy
@ -219,6 +222,15 @@ class WebRenderLayerManager final : public LayerManager {
bool mIsFirstPaint;
FocusTarget mFocusTarget;
// The payload associated with currently pending painting work, for
// client layer managers that typically means payload that is part of the
// 'upcoming transaction', for HostLayerManagers this typically means
// what has been included in received transactions to be presented on the
// next composite.
// IMPORTANT: Clients should take care to clear this or risk it slowly
// growing out of control.
nsTArray<CompositionPayload> mPayload;
// When we're doing a transaction in order to draw to a non-default
// target, the layers transaction is only performed in order to send
// a PLayers:Update. We save the original non-default target to

Просмотреть файл

@ -66,6 +66,7 @@
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/VsyncChild.h"
#include "mozilla/dom/WindowBinding.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/RestyleManager.h"
#include "mozilla/TaskController.h"
#include "Layers.h"
@ -2508,8 +2509,8 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
if (!mCompositionPayloads.IsEmpty()) {
nsIWidget* widget = mPresContext->GetRootWidget();
WindowRenderer* renderer = widget ? widget->GetWindowRenderer() : nullptr;
if (renderer && renderer->AsLayerManager()) {
renderer->AsLayerManager()->RegisterPayloads(mCompositionPayloads);
if (renderer && renderer->AsWebRender()) {
renderer->AsWebRender()->RegisterPayloads(mCompositionPayloads);
}
mCompositionPayloads.Clear();
}