mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 1455691 - Make the transaction id a struct instead of a uint64_t. r=mattwoodrow
MozReview-Commit-ID: 9yZknygQvFr --HG-- extra : rebase_source : 8b7a2398bdabf52f2de1c5dbd30b6868c1e0bed0
This commit is contained in:
parent
f8e7264177
commit
697a7719d0
@ -2474,7 +2474,7 @@ nsDOMWindowUtils::GetLastTransactionId(uint64_t *aLastTransactionId)
|
||||
}
|
||||
|
||||
nsRefreshDriver* driver = presContext->GetRootPresContext()->RefreshDriver();
|
||||
*aLastTransactionId = driver->LastTransactionId();
|
||||
*aLastTransactionId = uint64_t(driver->LastTransactionId());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3124,7 +3124,7 @@ TabChild::GetFrom(layers::LayersId aLayersId)
|
||||
}
|
||||
|
||||
void
|
||||
TabChild::DidComposite(uint64_t aTransactionId,
|
||||
TabChild::DidComposite(mozilla::layers::TransactionId aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd)
|
||||
{
|
||||
|
@ -541,7 +541,7 @@ public:
|
||||
layers::LayersId GetLayersId() { return mLayersId; }
|
||||
Maybe<bool> IsLayersConnected() { return mLayersConnected; }
|
||||
|
||||
void DidComposite(uint64_t aTransactionId,
|
||||
void DidComposite(mozilla::layers::TransactionId aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd);
|
||||
|
||||
|
@ -694,7 +694,7 @@ public:
|
||||
|
||||
virtual void SetLayerObserverEpoch(uint64_t aLayerObserverEpoch) {}
|
||||
|
||||
virtual void DidComposite(uint64_t aTransactionId,
|
||||
virtual void DidComposite(TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
const mozilla::TimeStamp& aCompositeEnd) {}
|
||||
|
||||
@ -710,7 +710,7 @@ public:
|
||||
|
||||
virtual void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) {}
|
||||
|
||||
virtual uint64_t GetLastTransactionId() { return 0; }
|
||||
virtual TransactionId GetLastTransactionId() { return TransactionId{0}; }
|
||||
|
||||
virtual CompositorBridgeChild* GetCompositorBridgeChild() { return nullptr; }
|
||||
|
||||
|
@ -88,6 +88,57 @@ struct LayersId {
|
||||
};
|
||||
};
|
||||
|
||||
struct TransactionId {
|
||||
uint64_t mId;
|
||||
|
||||
bool IsValid() const {
|
||||
return mId != 0;
|
||||
}
|
||||
|
||||
MOZ_MUST_USE TransactionId Next() const {
|
||||
return TransactionId{mId + 1};
|
||||
}
|
||||
|
||||
MOZ_MUST_USE TransactionId Prev() const {
|
||||
return TransactionId{mId - 1};
|
||||
}
|
||||
|
||||
int64_t operator-(const TransactionId& aOther) const {
|
||||
return mId - aOther.mId;
|
||||
}
|
||||
|
||||
// Allow explicit cast to a uint64_t for now
|
||||
explicit operator uint64_t() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
bool operator<(const TransactionId& aOther) const
|
||||
{
|
||||
return mId < aOther.mId;
|
||||
}
|
||||
|
||||
bool operator<=(const TransactionId& aOther) const
|
||||
{
|
||||
return mId <= aOther.mId;
|
||||
}
|
||||
|
||||
bool operator>(const TransactionId& aOther) const
|
||||
{
|
||||
return mId > aOther.mId;
|
||||
}
|
||||
|
||||
bool operator>=(const TransactionId& aOther) const
|
||||
{
|
||||
return mId >= aOther.mId;
|
||||
}
|
||||
|
||||
bool operator==(const TransactionId& aOther) const
|
||||
{
|
||||
return mId == aOther.mId;
|
||||
}
|
||||
};
|
||||
|
||||
enum class LayersBackend : int8_t {
|
||||
LAYERS_NONE = 0,
|
||||
LAYERS_BASIC,
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define GFX_TRANSACTION_ID_ALLOCATOR_H
|
||||
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -29,14 +30,14 @@ public:
|
||||
* "throttling" behaviour can be skipped by passing aThrottle=false.
|
||||
* Otherwise call sites should generally be passing aThrottle=true.
|
||||
*/
|
||||
virtual uint64_t GetTransactionId(bool aThrottle) = 0;
|
||||
virtual TransactionId GetTransactionId(bool aThrottle) = 0;
|
||||
|
||||
/**
|
||||
* Return the transaction id that for the last non-revoked transaction.
|
||||
* This allows the caller to tell whether a composite was triggered by
|
||||
* a paint that occurred after a call to TransactionId().
|
||||
*/
|
||||
virtual uint64_t LastTransactionId() const = 0;
|
||||
virtual TransactionId LastTransactionId() const = 0;
|
||||
|
||||
/**
|
||||
* Notify that all work (including asynchronous composites)
|
||||
@ -46,7 +47,7 @@ public:
|
||||
* of having too many outstanding id's, then this may
|
||||
* resume it.
|
||||
*/
|
||||
virtual void NotifyTransactionCompleted(uint64_t aTransactionId) = 0;
|
||||
virtual void NotifyTransactionCompleted(TransactionId aTransactionId) = 0;
|
||||
|
||||
/**
|
||||
* Revoke a transaction id that isn't needed to track
|
||||
@ -54,7 +55,7 @@ public:
|
||||
* to NotifyTransactionCompleted except avoids
|
||||
* return ordering issues.
|
||||
*/
|
||||
virtual void RevokeTransactionId(uint64_t aTransactionId) = 0;
|
||||
virtual void RevokeTransactionId(TransactionId aTransactionId) = 0;
|
||||
|
||||
/**
|
||||
* Stop waiting for pending transactions, if any.
|
||||
@ -73,7 +74,7 @@ public:
|
||||
* id to the last transaction id from previous refresh driver, so that all
|
||||
* completed transactions of previous refresh driver will be ignored.
|
||||
*/
|
||||
virtual void ResetInitialTransactionId(uint64_t aTransactionId) = 0;
|
||||
virtual void ResetInitialTransactionId(TransactionId aTransactionId) = 0;
|
||||
|
||||
/**
|
||||
* Get the start time of the current refresh tick.
|
||||
|
@ -93,7 +93,7 @@ NS_IMPL_ISUPPORTS(ClientLayerManager::MemoryPressureObserver, nsIObserver)
|
||||
ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
: mPhase(PHASE_NONE)
|
||||
, mWidget(aWidget)
|
||||
, mLatestTransactionId(0)
|
||||
, mLatestTransactionId{0}
|
||||
, mLastPaintTime(TimeDuration::Forever())
|
||||
, mTargetRotation(ROTATION_0)
|
||||
, mRepeatTransaction(false)
|
||||
@ -139,7 +139,7 @@ ClientLayerManager::Destroy()
|
||||
// pending transaction. Do this at the top of the event loop so we don't
|
||||
// cause a paint to occur during compositor shutdown.
|
||||
RefPtr<TransactionIdAllocator> allocator = mTransactionIdAllocator;
|
||||
uint64_t id = mLatestTransactionId;
|
||||
TransactionId id = mLatestTransactionId;
|
||||
|
||||
RefPtr<Runnable> task = NS_NewRunnableFunction(
|
||||
"TransactionIdAllocator::NotifyTransactionCompleted",
|
||||
@ -505,7 +505,7 @@ ClientLayerManager::ScheduleComposite()
|
||||
}
|
||||
|
||||
void
|
||||
ClientLayerManager::DidComposite(uint64_t aTransactionId,
|
||||
ClientLayerManager::DidComposite(TransactionId aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd)
|
||||
{
|
||||
@ -519,7 +519,7 @@ ClientLayerManager::DidComposite(uint64_t aTransactionId,
|
||||
|
||||
// |aTransactionId| will be > 0 if the compositor is acknowledging a shadow
|
||||
// layers transaction.
|
||||
if (aTransactionId) {
|
||||
if (aTransactionId.IsValid()) {
|
||||
nsIWidgetListener *listener = mWidget->GetWidgetListener();
|
||||
if (listener) {
|
||||
listener->DidCompositeWindow(aTransactionId, aCompositeStart, aCompositeEnd);
|
||||
|
@ -192,7 +192,7 @@ public:
|
||||
virtual void ScheduleComposite() override;
|
||||
virtual void GetFrameUniformity(FrameUniformityData* aFrameUniformityData) override;
|
||||
|
||||
virtual void DidComposite(uint64_t aTransactionId,
|
||||
virtual void DidComposite(TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
const mozilla::TimeStamp& aCompositeEnd) override;
|
||||
|
||||
@ -237,7 +237,7 @@ public:
|
||||
|
||||
virtual void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) override;
|
||||
|
||||
virtual uint64_t GetLastTransactionId() override { return mLatestTransactionId; }
|
||||
virtual TransactionId GetLastTransactionId() override { return mLatestTransactionId; }
|
||||
|
||||
float RequestProperty(const nsAString& aProperty) override;
|
||||
|
||||
@ -332,7 +332,7 @@ private:
|
||||
RefPtr<gfxContext> mShadowTarget;
|
||||
|
||||
RefPtr<TransactionIdAllocator> mTransactionIdAllocator;
|
||||
uint64_t mLatestTransactionId;
|
||||
TransactionId mLatestTransactionId;
|
||||
TimeDuration mLastPaintTime;
|
||||
|
||||
// Sometimes we draw to targets that don't natively support
|
||||
|
@ -528,7 +528,7 @@ CompositorBridgeChild::RecvHideAllPlugins(const uintptr_t& aParentWidget)
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
CompositorBridgeChild::RecvDidComposite(const LayersId& aId,
|
||||
const uint64_t& aTransactionId,
|
||||
const TransactionId& aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd)
|
||||
{
|
||||
|
@ -85,7 +85,8 @@ public:
|
||||
static bool CompositorIsInGPUProcess();
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvDidComposite(const LayersId& aId, const uint64_t& aTransactionId,
|
||||
RecvDidComposite(const LayersId& aId,
|
||||
const TransactionId& aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd) override;
|
||||
|
||||
|
@ -329,7 +329,7 @@ CompositorBridgeParent::CompositorBridgeParent(CompositorManagerParent* aManager
|
||||
, mWidget(nullptr)
|
||||
, mScale(aScale)
|
||||
, mVsyncRate(aVsyncRate)
|
||||
, mPendingTransaction(0)
|
||||
, mPendingTransaction{0}
|
||||
, mPaused(false)
|
||||
, mUseExternalSurfaceSize(aUseExternalSurfaceSize)
|
||||
, mEGLSurfaceSize(aSurfaceSize)
|
||||
@ -1265,7 +1265,7 @@ CompositorBridgeParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
// 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() == 1 || aInfo.id() > mPendingTransaction);
|
||||
MOZ_ASSERT(aInfo.id() == TransactionId{1} || aInfo.id() > mPendingTransaction);
|
||||
mPendingTransaction = aInfo.id();
|
||||
mTxnStartTime = aInfo.transactionStart();
|
||||
mFwdTime = aInfo.fwdTime();
|
||||
@ -2045,7 +2045,7 @@ CompositorBridgeParent::DidComposite(TimeStamp& aCompositeStart,
|
||||
} else {
|
||||
NotifyDidComposite(mPendingTransaction, aCompositeStart, aCompositeEnd);
|
||||
#if defined(ENABLE_FRAME_LATENCY_LOG)
|
||||
if (mPendingTransaction) {
|
||||
if (mPendingTransaction.IsValid()) {
|
||||
if (mTxnStartTime) {
|
||||
uint32_t latencyMs = round((aCompositeEnd - mTxnStartTime).ToMilliseconds());
|
||||
printf_stderr("From transaction start to end of generate frame latencyMs %d this %p\n", latencyMs, this);
|
||||
@ -2058,7 +2058,7 @@ CompositorBridgeParent::DidComposite(TimeStamp& aCompositeStart,
|
||||
mTxnStartTime = TimeStamp();
|
||||
mFwdTime = TimeStamp();
|
||||
#endif
|
||||
mPendingTransaction = 0;
|
||||
mPendingTransaction = TransactionId{0};
|
||||
}
|
||||
}
|
||||
|
||||
@ -2083,7 +2083,7 @@ CompositorBridgeParent::NotifyDidCompositeToPipeline(const wr::PipelineId& aPipe
|
||||
}
|
||||
|
||||
if (mWrBridge->PipelineId() == aPipelineId) {
|
||||
uint64_t transactionId = mWrBridge->FlushTransactionIdsForEpoch(aEpoch, aCompositeEnd);
|
||||
TransactionId transactionId = mWrBridge->FlushTransactionIdsForEpoch(aEpoch, aCompositeEnd);
|
||||
Unused << SendDidComposite(LayersId{0}, transactionId, aCompositeStart, aCompositeEnd);
|
||||
|
||||
nsTArray<ImageCompositeNotificationInfo> notifications;
|
||||
@ -2100,14 +2100,14 @@ CompositorBridgeParent::NotifyDidCompositeToPipeline(const wr::PipelineId& aPipe
|
||||
lts->mWrBridge &&
|
||||
lts->mWrBridge->PipelineId() == aPipelineId) {
|
||||
CrossProcessCompositorBridgeParent* cpcp = lts->mCrossProcessParent;
|
||||
uint64_t transactionId = lts->mWrBridge->FlushTransactionIdsForEpoch(aEpoch, aCompositeEnd);
|
||||
TransactionId transactionId = lts->mWrBridge->FlushTransactionIdsForEpoch(aEpoch, aCompositeEnd);
|
||||
Unused << cpcp->SendDidComposite(aLayersId, transactionId, aCompositeStart, aCompositeEnd);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
CompositorBridgeParent::NotifyDidComposite(uint64_t aTransactionId, TimeStamp& aCompositeStart, TimeStamp& aCompositeEnd)
|
||||
CompositorBridgeParent::NotifyDidComposite(TransactionId aTransactionId, TimeStamp& aCompositeStart, TimeStamp& aCompositeEnd)
|
||||
{
|
||||
Unused << SendDidComposite(LayersId{0}, aTransactionId, aCompositeStart, aCompositeEnd);
|
||||
|
||||
|
@ -586,7 +586,7 @@ protected:
|
||||
TimeStamp& aCompositeEnd) override;
|
||||
void NotifyPipelineRemoved(const wr::PipelineId& aPipelineId) override;
|
||||
|
||||
void NotifyDidComposite(uint64_t aTransactionId, TimeStamp& aCompositeStart, TimeStamp& aCompositeEnd);
|
||||
void NotifyDidComposite(TransactionId aTransactionId, TimeStamp& aCompositeStart, TimeStamp& aCompositeEnd);
|
||||
|
||||
// The indirect layer tree lock must be held before calling this function.
|
||||
// Callback should take (LayerTreeState* aState, const LayersId& aLayersId)
|
||||
@ -603,7 +603,7 @@ protected:
|
||||
CSSToLayoutDeviceScale mScale;
|
||||
TimeDuration mVsyncRate;
|
||||
|
||||
uint64_t mPendingTransaction;
|
||||
TransactionId mPendingTransaction;
|
||||
TimeStamp mTxnStartTime;
|
||||
TimeStamp mFwdTime;
|
||||
|
||||
|
@ -386,13 +386,13 @@ CrossProcessCompositorBridgeParent::DidCompositeLocked(
|
||||
{
|
||||
sIndirectLayerTreesLock->AssertCurrentThreadOwns();
|
||||
if (LayerTransactionParent *layerTree = sIndirectLayerTrees[aId].mLayerTree) {
|
||||
uint64_t transactionId = layerTree->FlushTransactionId(aCompositeEnd);
|
||||
if (transactionId) {
|
||||
TransactionId transactionId = layerTree->FlushTransactionId(aCompositeEnd);
|
||||
if (transactionId.IsValid()) {
|
||||
Unused << SendDidComposite(aId, transactionId, aCompositeStart, aCompositeEnd);
|
||||
}
|
||||
} else if (WebRenderBridgeParent* wrbridge = sIndirectLayerTrees[aId].mWrBridge) {
|
||||
uint64_t transactionId = wrbridge->FlushPendingTransactionIds();
|
||||
if (transactionId) {
|
||||
TransactionId transactionId = wrbridge->FlushPendingTransactionIds();
|
||||
if (transactionId.IsValid()) {
|
||||
Unused << SendDidComposite(aId, transactionId, aCompositeStart, aCompositeEnd);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ LayerTransactionParent::LayerTransactionParent(HostLayerManager* aManager,
|
||||
, mId(aId)
|
||||
, mChildEpoch(0)
|
||||
, mParentEpoch(0)
|
||||
, mPendingTransaction(0)
|
||||
, mPendingTransaction{0}
|
||||
, mDestroyed(false)
|
||||
, mIPCOpen(false)
|
||||
{
|
||||
@ -149,7 +149,7 @@ private:
|
||||
};
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
LayerTransactionParent::RecvPaintTime(const uint64_t& aTransactionId,
|
||||
LayerTransactionParent::RecvPaintTime(const TransactionId& aTransactionId,
|
||||
const TimeDuration& aPaintTime)
|
||||
{
|
||||
mCompositorBridge->UpdatePaintTime(this, aPaintTime);
|
||||
@ -891,11 +891,11 @@ bool LayerTransactionParent::IsSameProcess() const
|
||||
return OtherPid() == base::GetCurrentProcId();
|
||||
}
|
||||
|
||||
uint64_t
|
||||
TransactionId
|
||||
LayerTransactionParent::FlushTransactionId(TimeStamp& aCompositeEnd)
|
||||
{
|
||||
#if defined(ENABLE_FRAME_LATENCY_LOG)
|
||||
if (mPendingTransaction) {
|
||||
if (mPendingTransaction.IsValid()) {
|
||||
if (mTxnStartTime) {
|
||||
uint32_t latencyMs = round((aCompositeEnd - mTxnStartTime).ToMilliseconds());
|
||||
printf_stderr("From transaction start to end of generate frame latencyMs %d this %p\n", latencyMs, this);
|
||||
@ -908,8 +908,8 @@ LayerTransactionParent::FlushTransactionId(TimeStamp& aCompositeEnd)
|
||||
mTxnStartTime = TimeStamp();
|
||||
mFwdTime = TimeStamp();
|
||||
#endif
|
||||
uint64_t id = mPendingTransaction;
|
||||
mPendingTransaction = 0;
|
||||
TransactionId id = mPendingTransaction;
|
||||
mPendingTransaction = TransactionId{0};
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -78,14 +78,14 @@ public:
|
||||
|
||||
bool IsSameProcess() const override;
|
||||
|
||||
const uint64_t& GetPendingTransactionId() { return mPendingTransaction; }
|
||||
void SetPendingTransactionId(uint64_t aId, const TimeStamp& aTxnStartTime, const TimeStamp& aFwdTime)
|
||||
const TransactionId& GetPendingTransactionId() { return mPendingTransaction; }
|
||||
void SetPendingTransactionId(TransactionId aId, const TimeStamp& aTxnStartTime, const TimeStamp& aFwdTime)
|
||||
{
|
||||
mPendingTransaction = aId;
|
||||
mTxnStartTime = aTxnStartTime;
|
||||
mFwdTime = aFwdTime;
|
||||
}
|
||||
uint64_t FlushTransactionId(TimeStamp& aCompositeEnd);
|
||||
TransactionId FlushTransactionId(TimeStamp& aCompositeEnd);
|
||||
|
||||
// CompositableParentManager
|
||||
void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
|
||||
@ -105,7 +105,7 @@ protected:
|
||||
mozilla::ipc::IPCResult RecvShutdown() override;
|
||||
mozilla::ipc::IPCResult RecvShutdownSync() override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvPaintTime(const uint64_t& aTransactionId,
|
||||
mozilla::ipc::IPCResult RecvPaintTime(const TransactionId& aTransactionId,
|
||||
const TimeDuration& aPaintTime) override;
|
||||
|
||||
mozilla::ipc::IPCResult RecvUpdate(const TransactionInfo& aInfo) override;
|
||||
@ -194,7 +194,7 @@ private:
|
||||
uint64_t mChildEpoch;
|
||||
uint64_t mParentEpoch;
|
||||
|
||||
uint64_t mPendingTransaction;
|
||||
TransactionId mPendingTransaction;
|
||||
TimeStamp mTxnStartTime;
|
||||
TimeStamp mFwdTime;
|
||||
|
||||
|
@ -38,6 +38,11 @@ struct ParamTraits<mozilla::layers::LayersId>
|
||||
: public PlainOldDataSerializer<mozilla::layers::LayersId>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::TransactionId>
|
||||
: public PlainOldDataSerializer<mozilla::layers::TransactionId>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::LayersBackend>
|
||||
: public ContiguousEnumSerializer<
|
||||
|
@ -55,6 +55,7 @@ using mozilla::layers::SimpleLayerAttributes from "mozilla/layers/LayerAttribute
|
||||
using mozilla::CrossProcessSemaphoreHandle from "mozilla/ipc/CrossProcessSemaphore.h";
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -563,7 +564,7 @@ struct TransactionInfo
|
||||
CompositableOperation[] paints;
|
||||
OpDestroy[] toDestroy;
|
||||
uint64_t fwdTransactionId;
|
||||
uint64_t id;
|
||||
TransactionId id;
|
||||
TargetConfig targetConfig;
|
||||
PluginWindowData[] plugins;
|
||||
bool isFirstPaint;
|
||||
|
@ -43,6 +43,7 @@ using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
|
||||
using base::ProcessId from "base/process.h";
|
||||
using mozilla::wr::MaybeExternalImageId from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::wr::WebRenderError from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -96,7 +97,7 @@ child:
|
||||
// the root layer tree).
|
||||
// transactionId is the id of the transaction before this composite, or 0
|
||||
// if there was no transaction since the last composite.
|
||||
async DidComposite(LayersId id, uint64_t transactionId,
|
||||
async DidComposite(LayersId id, TransactionId transactionId,
|
||||
TimeStamp compositeStart, TimeStamp compositeEnd);
|
||||
|
||||
/**
|
||||
|
@ -23,6 +23,7 @@ using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/Comp
|
||||
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::TransactionId from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
/**
|
||||
* The layers protocol is spoken between thread contexts that manage
|
||||
@ -51,7 +52,7 @@ parent:
|
||||
// for a particular document.
|
||||
async Update(TransactionInfo txn);
|
||||
|
||||
async PaintTime(uint64_t id, TimeDuration paintTime);
|
||||
async PaintTime(TransactionId id, TimeDuration paintTime);
|
||||
|
||||
async SetLayerObserverEpoch(uint64_t layerObserverEpoch);
|
||||
|
||||
|
@ -22,6 +22,7 @@ using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_
|
||||
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
|
||||
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
|
||||
using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
|
||||
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
@ -36,13 +37,13 @@ parent:
|
||||
|
||||
sync Create(IntSize aSize);
|
||||
async DeleteCompositorAnimations(uint64_t[] aIds);
|
||||
async SetDisplayList(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
|
||||
async SetDisplayList(IntSize aSize, WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
|
||||
LayoutSize aContentSize, ByteBuf aDL, BuiltDisplayListDescriptor aDLDesc,
|
||||
WebRenderScrollData aScrollData,
|
||||
OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems,
|
||||
IdNamespace aIdNamespace, TimeStamp txnStartTime, TimeStamp fwdTime);
|
||||
async EmptyTransaction(FocusTarget focusTarget,
|
||||
WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, uint64_t transactionId,
|
||||
WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
|
||||
IdNamespace aIdNamespace, TimeStamp txnStartTime, TimeStamp fwdTime);
|
||||
async SetFocusTarget(FocusTarget focusTarget);
|
||||
async UpdateResources(OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems);
|
||||
|
@ -590,7 +590,7 @@ ShadowLayerForwarder::StorePluginWidgetConfigurations(const nsTArray<nsIWidget::
|
||||
}
|
||||
|
||||
void
|
||||
ShadowLayerForwarder::SendPaintTime(uint64_t aId, TimeDuration aPaintTime)
|
||||
ShadowLayerForwarder::SendPaintTime(TransactionId aId, TimeDuration aPaintTime)
|
||||
{
|
||||
if (!IPCOpen() ||
|
||||
!mShadowManager->SendPaintTime(aId, aPaintTime)) {
|
||||
@ -600,7 +600,7 @@ ShadowLayerForwarder::SendPaintTime(uint64_t aId, TimeDuration aPaintTime)
|
||||
|
||||
bool
|
||||
ShadowLayerForwarder::EndTransaction(const nsIntRegion& aRegionToClear,
|
||||
uint64_t aId,
|
||||
TransactionId aId,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction,
|
||||
@ -623,7 +623,7 @@ ShadowLayerForwarder::EndTransaction(const nsIntRegion& aRegionToClear,
|
||||
|
||||
GetCompositorBridgeChild()->WillEndTransaction();
|
||||
|
||||
MOZ_ASSERT(aId);
|
||||
MOZ_ASSERT(aId.IsValid());
|
||||
|
||||
AUTO_PROFILER_LABEL("ShadowLayerForwarder::EndTransaction", GRAPHICS);
|
||||
|
||||
|
@ -246,7 +246,7 @@ public:
|
||||
/**
|
||||
* Used for debugging to tell the compositor how long this frame took to paint.
|
||||
*/
|
||||
void SendPaintTime(uint64_t aId, TimeDuration aPaintTime);
|
||||
void SendPaintTime(TransactionId aId, TimeDuration aPaintTime);
|
||||
|
||||
/**
|
||||
* End the current transaction and forward it to LayerManagerComposite.
|
||||
@ -254,7 +254,7 @@ public:
|
||||
* caller of EndTransaction().
|
||||
*/
|
||||
bool EndTransaction(const nsIntRegion& aRegionToClear,
|
||||
uint64_t aId,
|
||||
TransactionId aId,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool aIsRepeatTransaction,
|
||||
|
@ -127,7 +127,7 @@ WebRenderBridgeChild::EndTransaction(const wr::LayoutSize& aContentSize,
|
||||
wr::BuiltDisplayList& aDL,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
const gfx::IntSize& aSize,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const WebRenderScrollData& aScrollData,
|
||||
const mozilla::TimeStamp& aTxnStartTime)
|
||||
{
|
||||
@ -161,7 +161,7 @@ WebRenderBridgeChild::EndTransaction(const wr::LayoutSize& aContentSize,
|
||||
|
||||
void
|
||||
WebRenderBridgeChild::EndEmptyTransaction(const FocusTarget& aFocusTarget,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aTxnStartTime)
|
||||
{
|
||||
MOZ_ASSERT(!mDestroyed);
|
||||
|
@ -73,11 +73,11 @@ public:
|
||||
wr::BuiltDisplayList& dl,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
const gfx::IntSize& aSize,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const WebRenderScrollData& aScrollData,
|
||||
const mozilla::TimeStamp& aTxnStartTime);
|
||||
void EndEmptyTransaction(const FocusTarget& aFocusTarget,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aTxnStartTime);
|
||||
void ProcessWebRenderParentCommands();
|
||||
|
||||
|
@ -557,7 +557,7 @@ WebRenderBridgeParent::RecvSetDisplayList(const gfx::IntSize& aSize,
|
||||
InfallibleTArray<WebRenderParentCommand>&& aCommands,
|
||||
InfallibleTArray<OpDestroy>&& aToDestroy,
|
||||
const uint64_t& aFwdTransactionId,
|
||||
const uint64_t& aTransactionId,
|
||||
const TransactionId& aTransactionId,
|
||||
const wr::LayoutSize& aContentSize,
|
||||
ipc::ByteBuf&& dl,
|
||||
const wr::BuiltDisplayListDescriptor& dlDesc,
|
||||
@ -649,7 +649,7 @@ WebRenderBridgeParent::RecvEmptyTransaction(const FocusTarget& aFocusTarget,
|
||||
InfallibleTArray<WebRenderParentCommand>&& aCommands,
|
||||
InfallibleTArray<OpDestroy>&& aToDestroy,
|
||||
const uint64_t& aFwdTransactionId,
|
||||
const uint64_t& aTransactionId,
|
||||
const TransactionId& aTransactionId,
|
||||
const wr::IdNamespace& aIdNamespace,
|
||||
const TimeStamp& aTxnStartTime,
|
||||
const TimeStamp& aFwdTime)
|
||||
@ -1275,7 +1275,7 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In
|
||||
|
||||
void
|
||||
WebRenderBridgeParent::HoldPendingTransactionId(const wr::Epoch& aWrEpoch,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const TimeStamp& aTxnStartTime,
|
||||
const TimeStamp& aFwdTime)
|
||||
{
|
||||
@ -1283,20 +1283,20 @@ WebRenderBridgeParent::HoldPendingTransactionId(const wr::Epoch& aWrEpoch,
|
||||
mPendingTransactionIds.push(PendingTransactionId(aWrEpoch, aTransactionId, aTxnStartTime, aFwdTime));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
TransactionId
|
||||
WebRenderBridgeParent::LastPendingTransactionId()
|
||||
{
|
||||
uint64_t id = 0;
|
||||
TransactionId id{0};
|
||||
if (!mPendingTransactionIds.empty()) {
|
||||
id = mPendingTransactionIds.back().mId;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
TransactionId
|
||||
WebRenderBridgeParent::FlushPendingTransactionIds()
|
||||
{
|
||||
uint64_t id = 0;
|
||||
TransactionId id{0};
|
||||
if (!mPendingTransactionIds.empty()) {
|
||||
id = mPendingTransactionIds.back().mId;
|
||||
std::queue<PendingTransactionId>().swap(mPendingTransactionIds); // clear queue
|
||||
@ -1304,10 +1304,10 @@ WebRenderBridgeParent::FlushPendingTransactionIds()
|
||||
return id;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
TransactionId
|
||||
WebRenderBridgeParent::FlushTransactionIdsForEpoch(const wr::Epoch& aEpoch, const TimeStamp& aEndTime)
|
||||
{
|
||||
uint64_t id = 0;
|
||||
TransactionId id{0};
|
||||
while (!mPendingTransactionIds.empty()) {
|
||||
if (aEpoch.mHandle < mPendingTransactionIds.front().mEpoch.mHandle) {
|
||||
break;
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
InfallibleTArray<WebRenderParentCommand>&& aCommands,
|
||||
InfallibleTArray<OpDestroy>&& aToDestroy,
|
||||
const uint64_t& aFwdTransactionId,
|
||||
const uint64_t& aTransactionId,
|
||||
const TransactionId& aTransactionId,
|
||||
const wr::LayoutSize& aContentSize,
|
||||
ipc::ByteBuf&& dl,
|
||||
const wr::BuiltDisplayListDescriptor& dlDesc,
|
||||
@ -93,7 +93,7 @@ public:
|
||||
InfallibleTArray<WebRenderParentCommand>&& aCommands,
|
||||
InfallibleTArray<OpDestroy>&& aToDestroy,
|
||||
const uint64_t& aFwdTransactionId,
|
||||
const uint64_t& aTransactionId,
|
||||
const TransactionId& aTransactionId,
|
||||
const wr::IdNamespace& aIdNamespace,
|
||||
const TimeStamp& aTxnStartTime,
|
||||
const TimeStamp& aFwdTime) override;
|
||||
@ -146,12 +146,12 @@ public:
|
||||
void SetAboutToSendAsyncMessages() override;
|
||||
|
||||
void HoldPendingTransactionId(const wr::Epoch& aWrEpoch,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const TimeStamp& aTxnStartTime,
|
||||
const TimeStamp& aFwdTime);
|
||||
uint64_t LastPendingTransactionId();
|
||||
uint64_t FlushPendingTransactionIds();
|
||||
uint64_t FlushTransactionIdsForEpoch(const wr::Epoch& aEpoch, const TimeStamp& aEndTime);
|
||||
TransactionId LastPendingTransactionId();
|
||||
TransactionId FlushPendingTransactionIds();
|
||||
TransactionId FlushTransactionIdsForEpoch(const wr::Epoch& aEpoch, const TimeStamp& aEndTime);
|
||||
|
||||
TextureFactoryIdentifier GetTextureFactoryIdentifier();
|
||||
|
||||
@ -227,14 +227,14 @@ private:
|
||||
|
||||
private:
|
||||
struct PendingTransactionId {
|
||||
PendingTransactionId(const wr::Epoch& aEpoch, uint64_t aId, const TimeStamp& aTxnStartTime, const TimeStamp& aFwdTime)
|
||||
PendingTransactionId(const wr::Epoch& aEpoch, TransactionId aId, const TimeStamp& aTxnStartTime, const TimeStamp& aFwdTime)
|
||||
: mEpoch(aEpoch)
|
||||
, mId(aId)
|
||||
, mTxnStartTime(aTxnStartTime)
|
||||
, mFwdTime(aFwdTime)
|
||||
{}
|
||||
wr::Epoch mEpoch;
|
||||
uint64_t mId;
|
||||
TransactionId mId;
|
||||
TimeStamp mTxnStartTime;
|
||||
TimeStamp mFwdTime;
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ namespace layers {
|
||||
|
||||
WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
|
||||
: mWidget(aWidget)
|
||||
, mLatestTransactionId(0)
|
||||
, mLatestTransactionId{0}
|
||||
, mWindowOverlayChanged(false)
|
||||
, mNeedsComposite(false)
|
||||
, mIsFirstPaint(false)
|
||||
@ -127,7 +127,7 @@ WebRenderLayerManager::DoDestroy(bool aIsSync)
|
||||
// pending transaction. Do this at the top of the event loop so we don't
|
||||
// cause a paint to occur during compositor shutdown.
|
||||
RefPtr<TransactionIdAllocator> allocator = mTransactionIdAllocator;
|
||||
uint64_t id = mLatestTransactionId;
|
||||
TransactionId id = mLatestTransactionId;
|
||||
|
||||
RefPtr<Runnable> task = NS_NewRunnableFunction(
|
||||
"TransactionIdAllocator::NotifyTransactionCompleted",
|
||||
@ -471,7 +471,7 @@ WebRenderLayerManager::SetLayerObserverEpoch(uint64_t aLayerObserverEpoch)
|
||||
}
|
||||
|
||||
void
|
||||
WebRenderLayerManager::DidComposite(uint64_t aTransactionId,
|
||||
WebRenderLayerManager::DidComposite(TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
const mozilla::TimeStamp& aCompositeEnd)
|
||||
{
|
||||
@ -485,7 +485,7 @@ WebRenderLayerManager::DidComposite(uint64_t aTransactionId,
|
||||
|
||||
// |aTransactionId| will be > 0 if the compositor is acknowledging a shadow
|
||||
// layers transaction.
|
||||
if (aTransactionId) {
|
||||
if (aTransactionId.IsValid()) {
|
||||
nsIWidgetListener *listener = mWidget->GetWidgetListener();
|
||||
if (listener) {
|
||||
listener->DidCompositeWindow(aTransactionId, aCompositeStart, aCompositeEnd);
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
|
||||
virtual void SetLayerObserverEpoch(uint64_t aLayerObserverEpoch) override;
|
||||
|
||||
virtual void DidComposite(uint64_t aTransactionId,
|
||||
virtual void DidComposite(TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
const mozilla::TimeStamp& aCompositeEnd) override;
|
||||
|
||||
@ -186,7 +186,7 @@ private:
|
||||
RefPtr<WebRenderBridgeChild> mWrChild;
|
||||
|
||||
RefPtr<TransactionIdAllocator> mTransactionIdAllocator;
|
||||
uint64_t mLatestTransactionId;
|
||||
TransactionId mLatestTransactionId;
|
||||
|
||||
nsTArray<DidCompositeObserver*> mDidCompositeObservers;
|
||||
|
||||
|
@ -144,7 +144,7 @@ nsPresContext::IsDOMPaintEventPending()
|
||||
// Since we're promising that there will be a MozAfterPaint event
|
||||
// fired, we record an empty invalidation in case display list
|
||||
// invalidation doesn't invalidate anything further.
|
||||
NotifyInvalidation(drpc->mRefreshDriver->LastTransactionId() + 1, nsRect(0, 0, 0, 0));
|
||||
NotifyInvalidation(drpc->mRefreshDriver->LastTransactionId().Next(), nsRect(0, 0, 0, 0));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -2331,7 +2331,8 @@ nsPresContext::EnsureSafeToHandOutCSSRules()
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::FireDOMPaintEvent(nsTArray<nsRect>* aList, uint64_t aTransactionId,
|
||||
nsPresContext::FireDOMPaintEvent(nsTArray<nsRect>* aList,
|
||||
TransactionId aTransactionId,
|
||||
mozilla::TimeStamp aTimeStamp /* = mozilla::TimeStamp() */)
|
||||
{
|
||||
nsPIDOMWindowInner* ourWindow = mDocument->GetInnerWindow();
|
||||
@ -2370,7 +2371,7 @@ nsPresContext::FireDOMPaintEvent(nsTArray<nsRect>* aList, uint64_t aTransactionI
|
||||
// it won't be blocking app execution though).
|
||||
RefPtr<NotifyPaintEvent> event =
|
||||
NS_NewDOMNotifyPaintEvent(eventTarget, this, nullptr, eAfterPaint, aList,
|
||||
aTransactionId, timeStamp);
|
||||
uint64_t(aTransactionId), timeStamp);
|
||||
|
||||
// Even if we're not telling the window about the event (so eventTarget is
|
||||
// the chrome event handler, not the window), the window is still
|
||||
@ -2460,7 +2461,7 @@ nsPresContext::MayHavePaintEventListenerInSubDocument()
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::NotifyInvalidation(uint64_t aTransactionId, const nsIntRect& aRect)
|
||||
nsPresContext::NotifyInvalidation(TransactionId aTransactionId, const nsIntRect& aRect)
|
||||
{
|
||||
// Prevent values from overflow after DevPixelsToAppUnits().
|
||||
//
|
||||
@ -2481,7 +2482,7 @@ nsPresContext::NotifyInvalidation(uint64_t aTransactionId, const nsIntRect& aRec
|
||||
}
|
||||
|
||||
nsPresContext::TransactionInvalidations*
|
||||
nsPresContext::GetInvalidations(uint64_t aTransactionId)
|
||||
nsPresContext::GetInvalidations(TransactionId aTransactionId)
|
||||
{
|
||||
for (TransactionInvalidations& t : mTransactions) {
|
||||
if (t.mTransactionId == aTransactionId) {
|
||||
@ -2492,7 +2493,7 @@ nsPresContext::GetInvalidations(uint64_t aTransactionId)
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::NotifyInvalidation(uint64_t aTransactionId, const nsRect& aRect)
|
||||
nsPresContext::NotifyInvalidation(TransactionId aTransactionId, const nsRect& aRect)
|
||||
{
|
||||
MOZ_ASSERT(GetContainerWeak(), "Invalidation in detached pres context");
|
||||
|
||||
@ -2535,7 +2536,7 @@ nsPresContext::NotifySubDocInvalidation(ContainerLayer* aContainer,
|
||||
return;
|
||||
}
|
||||
|
||||
uint64_t transactionId = aContainer->Manager()->GetLastTransactionId();
|
||||
TransactionId transactionId = aContainer->Manager()->GetLastTransactionId();
|
||||
IntRect visibleBounds = aContainer->GetVisibleRegion().GetBounds().ToUnknownRect();
|
||||
|
||||
if (!aRegion) {
|
||||
@ -2570,7 +2571,7 @@ nsPresContext::ClearNotifySubDocInvalidationData(ContainerLayer* aContainer)
|
||||
}
|
||||
|
||||
struct NotifyDidPaintSubdocumentCallbackClosure {
|
||||
uint64_t mTransactionId;
|
||||
TransactionId mTransactionId;
|
||||
const mozilla::TimeStamp& mTimeStamp;
|
||||
};
|
||||
/* static */ bool
|
||||
@ -2591,7 +2592,7 @@ public:
|
||||
DelayedFireDOMPaintEvent(
|
||||
nsPresContext* aPresContext,
|
||||
nsTArray<nsRect>* aList,
|
||||
uint64_t aTransactionId,
|
||||
TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aTimeStamp = mozilla::TimeStamp())
|
||||
: mozilla::Runnable("DelayedFireDOMPaintEvent")
|
||||
, mPresContext(aPresContext)
|
||||
@ -2613,13 +2614,13 @@ public:
|
||||
}
|
||||
|
||||
RefPtr<nsPresContext> mPresContext;
|
||||
uint64_t mTransactionId;
|
||||
TransactionId mTransactionId;
|
||||
const mozilla::TimeStamp mTimeStamp;
|
||||
nsTArray<nsRect> mList;
|
||||
};
|
||||
|
||||
void
|
||||
nsPresContext::NotifyDidPaintForSubtree(uint64_t aTransactionId,
|
||||
nsPresContext::NotifyDidPaintForSubtree(TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aTimeStamp)
|
||||
{
|
||||
if (IsRoot()) {
|
||||
@ -3285,7 +3286,7 @@ nsRootPresContext::CollectPluginGeometryUpdates(LayerManager* aLayerManager)
|
||||
}
|
||||
|
||||
void
|
||||
nsRootPresContext::EnsureEventualDidPaintEvent(uint64_t aTransactionId)
|
||||
nsRootPresContext::EnsureEventualDidPaintEvent(TransactionId aTransactionId)
|
||||
{
|
||||
for (NotifyDidPaintTimer& t : mNotifyDidPaintTimers) {
|
||||
if (t.mTransactionId == aTransactionId) {
|
||||
@ -3311,7 +3312,7 @@ nsRootPresContext::EnsureEventualDidPaintEvent(uint64_t aTransactionId)
|
||||
}
|
||||
|
||||
void
|
||||
nsRootPresContext::CancelDidPaintTimers(uint64_t aTransactionId)
|
||||
nsRootPresContext::CancelDidPaintTimers(TransactionId aTransactionId)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
while (i < mNotifyDidPaintTimers.Length()) {
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
typedef mozilla::LangGroupFontPrefs LangGroupFontPrefs;
|
||||
typedef mozilla::ScrollbarStyles ScrollbarStyles;
|
||||
typedef mozilla::StaticPresData StaticPresData;
|
||||
using TransactionId = mozilla::layers::TransactionId;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsPresContext)
|
||||
@ -1036,12 +1037,13 @@ public:
|
||||
// by nsRefreshDriver::GetTransactionId).
|
||||
// Invalidated regions will be dispatched to MozAfterPaint events when
|
||||
// NotifyDidPaintForSubtree is called for the transaction id (or any higher id).
|
||||
void NotifyInvalidation(uint64_t aTransactionId, const nsRect& aRect);
|
||||
void NotifyInvalidation(TransactionId aTransactionId, const nsRect& aRect);
|
||||
// aRect is in device pixels
|
||||
void NotifyInvalidation(uint64_t aTransactionId, const nsIntRect& aRect);
|
||||
void NotifyDidPaintForSubtree(uint64_t aTransactionId = 0,
|
||||
void NotifyInvalidation(TransactionId aTransactionId, const nsIntRect& aRect);
|
||||
void NotifyDidPaintForSubtree(TransactionId aTransactionId = TransactionId{0},
|
||||
const mozilla::TimeStamp& aTimeStamp = mozilla::TimeStamp());
|
||||
void FireDOMPaintEvent(nsTArray<nsRect>* aList, uint64_t aTransactionId,
|
||||
void FireDOMPaintEvent(nsTArray<nsRect>* aList,
|
||||
TransactionId aTransactionId,
|
||||
mozilla::TimeStamp aTimeStamp = mozilla::TimeStamp());
|
||||
|
||||
// Callback for catching invalidations in ContainerLayers
|
||||
@ -1275,10 +1277,10 @@ protected:
|
||||
uint32_t aDelay);
|
||||
|
||||
struct TransactionInvalidations {
|
||||
uint64_t mTransactionId;
|
||||
TransactionId mTransactionId;
|
||||
nsTArray<nsRect> mInvalidations;
|
||||
};
|
||||
TransactionInvalidations* GetInvalidations(uint64_t aTransactionId);
|
||||
TransactionInvalidations* GetInvalidations(TransactionId aTransactionId);
|
||||
|
||||
// IMPORTANT: The ownership implicit in the following member variables
|
||||
// has been explicitly checked. If you add any members to this class,
|
||||
@ -1531,13 +1533,13 @@ public:
|
||||
* Ensure that NotifyDidPaintForSubtree is eventually called on this
|
||||
* object after a timeout.
|
||||
*/
|
||||
void EnsureEventualDidPaintEvent(uint64_t aTransactionId);
|
||||
void EnsureEventualDidPaintEvent(TransactionId aTransactionId);
|
||||
|
||||
/**
|
||||
* Cancels any pending eventual did paint timer for transaction
|
||||
* ids up to and including aTransactionId.
|
||||
*/
|
||||
void CancelDidPaintTimers(uint64_t aTransactionId);
|
||||
void CancelDidPaintTimers(TransactionId aTransactionId);
|
||||
|
||||
/**
|
||||
* Cancel all pending eventual did paint timers.
|
||||
@ -1636,7 +1638,7 @@ protected:
|
||||
friend class nsPresContext;
|
||||
|
||||
struct NotifyDidPaintTimer {
|
||||
uint64_t mTransactionId;
|
||||
TransactionId mTransactionId;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
};
|
||||
AutoTArray<NotifyDidPaintTimer, 4> mNotifyDidPaintTimers;
|
||||
|
@ -1148,8 +1148,8 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
|
||||
: mActiveTimer(nullptr),
|
||||
mPresContext(aPresContext),
|
||||
mRootRefresh(nullptr),
|
||||
mPendingTransaction(0),
|
||||
mCompletedTransaction(0),
|
||||
mPendingTransaction{0},
|
||||
mCompletedTransaction{0},
|
||||
mFreezeCount(0),
|
||||
mThrottledFrameRequestInterval(TimeDuration::FromMilliseconds(
|
||||
GetThrottledTimerInterval())),
|
||||
@ -2164,13 +2164,13 @@ nsRefreshDriver::FinishedWaitingForTransaction()
|
||||
mWarningThreshold = 1;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
mozilla::layers::TransactionId
|
||||
nsRefreshDriver::GetTransactionId(bool aThrottle)
|
||||
{
|
||||
++mPendingTransaction;
|
||||
mPendingTransaction = mPendingTransaction.Next();
|
||||
|
||||
if (aThrottle &&
|
||||
mPendingTransaction >= mCompletedTransaction + 2 &&
|
||||
mPendingTransaction - mCompletedTransaction >= 2 &&
|
||||
!mWaitingForTransaction &&
|
||||
!mTestControllingRefreshes) {
|
||||
mWaitingForTransaction = true;
|
||||
@ -2181,22 +2181,22 @@ nsRefreshDriver::GetTransactionId(bool aThrottle)
|
||||
return mPendingTransaction;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
mozilla::layers::TransactionId
|
||||
nsRefreshDriver::LastTransactionId() const
|
||||
{
|
||||
return mPendingTransaction;
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::RevokeTransactionId(uint64_t aTransactionId)
|
||||
nsRefreshDriver::RevokeTransactionId(mozilla::layers::TransactionId aTransactionId)
|
||||
{
|
||||
MOZ_ASSERT(aTransactionId == mPendingTransaction);
|
||||
if (mPendingTransaction == mCompletedTransaction + 2 &&
|
||||
if (mPendingTransaction - mCompletedTransaction == 2 &&
|
||||
mWaitingForTransaction) {
|
||||
MOZ_ASSERT(!mSkippedPaints, "How did we skip a paint when we're in the middle of one?");
|
||||
FinishedWaitingForTransaction();
|
||||
}
|
||||
mPendingTransaction--;
|
||||
mPendingTransaction = mPendingTransaction.Prev();
|
||||
}
|
||||
|
||||
void
|
||||
@ -2207,7 +2207,7 @@ nsRefreshDriver::ClearPendingTransactions()
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::ResetInitialTransactionId(uint64_t aTransactionId)
|
||||
nsRefreshDriver::ResetInitialTransactionId(mozilla::layers::TransactionId aTransactionId)
|
||||
{
|
||||
mCompletedTransaction = mPendingTransaction = aTransactionId;
|
||||
}
|
||||
@ -2219,10 +2219,10 @@ nsRefreshDriver::GetTransactionStart()
|
||||
}
|
||||
|
||||
void
|
||||
nsRefreshDriver::NotifyTransactionCompleted(uint64_t aTransactionId)
|
||||
nsRefreshDriver::NotifyTransactionCompleted(mozilla::layers::TransactionId aTransactionId)
|
||||
{
|
||||
if (aTransactionId > mCompletedTransaction) {
|
||||
if (mPendingTransaction > mCompletedTransaction + 1 &&
|
||||
if (mPendingTransaction - mCompletedTransaction > 1 &&
|
||||
mWaitingForTransaction) {
|
||||
mCompletedTransaction = aTransactionId;
|
||||
FinishedWaitingForTransaction();
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
|
||||
public nsARefreshObserver
|
||||
{
|
||||
using TransactionId = mozilla::layers::TransactionId;
|
||||
|
||||
public:
|
||||
explicit nsRefreshDriver(nsPresContext *aPresContext);
|
||||
~nsRefreshDriver();
|
||||
@ -353,12 +355,12 @@ public:
|
||||
static bool GetJankLevels(mozilla::Vector<uint64_t>& aJank);
|
||||
|
||||
// mozilla::layers::TransactionIdAllocator
|
||||
uint64_t GetTransactionId(bool aThrottle) override;
|
||||
uint64_t LastTransactionId() const override;
|
||||
void NotifyTransactionCompleted(uint64_t aTransactionId) override;
|
||||
void RevokeTransactionId(uint64_t aTransactionId) override;
|
||||
TransactionId GetTransactionId(bool aThrottle) override;
|
||||
TransactionId LastTransactionId() const override;
|
||||
void NotifyTransactionCompleted(TransactionId aTransactionId) override;
|
||||
void RevokeTransactionId(TransactionId aTransactionId) override;
|
||||
void ClearPendingTransactions() override;
|
||||
void ResetInitialTransactionId(uint64_t aTransactionId) override;
|
||||
void ResetInitialTransactionId(TransactionId aTransactionId) override;
|
||||
mozilla::TimeStamp GetTransactionStart() override;
|
||||
|
||||
bool IsWaitingForPaint(mozilla::TimeStamp aTime);
|
||||
@ -453,9 +455,9 @@ private:
|
||||
RefPtr<nsRefreshDriver> mRootRefresh;
|
||||
|
||||
// The most recently allocated transaction id.
|
||||
uint64_t mPendingTransaction;
|
||||
TransactionId mPendingTransaction;
|
||||
// The most recently completed transaction id.
|
||||
uint64_t mCompletedTransaction;
|
||||
TransactionId mCompletedTransaction;
|
||||
|
||||
uint32_t mFreezeCount;
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ nsView::DidPaintWindow()
|
||||
}
|
||||
|
||||
void
|
||||
nsView::DidCompositeWindow(uint64_t aTransactionId,
|
||||
nsView::DidCompositeWindow(mozilla::layers::TransactionId aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ public:
|
||||
virtual bool PaintWindow(nsIWidget* aWidget,
|
||||
LayoutDeviceIntRegion aRegion) override;
|
||||
virtual void DidPaintWindow() override;
|
||||
virtual void DidCompositeWindow(uint64_t aTransactionId,
|
||||
virtual void DidCompositeWindow(mozilla::layers::TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
const mozilla::TimeStamp& aCompositeEnd) override;
|
||||
virtual void RequestRepaint() override;
|
||||
|
@ -122,7 +122,7 @@ nsIWidgetListener::DidPaintWindow()
|
||||
}
|
||||
|
||||
void
|
||||
nsIWidgetListener::DidCompositeWindow(uint64_t aTransactionId,
|
||||
nsIWidgetListener::DidCompositeWindow(mozilla::layers::TransactionId aTransactionId,
|
||||
const TimeStamp& aCompositeStart,
|
||||
const TimeStamp& aCompositeEnd)
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
#include "nsRegionFwd.h"
|
||||
@ -156,7 +157,7 @@ public:
|
||||
*/
|
||||
virtual void DidPaintWindow();
|
||||
|
||||
virtual void DidCompositeWindow(uint64_t aTransactionId,
|
||||
virtual void DidCompositeWindow(mozilla::layers::TransactionId aTransactionId,
|
||||
const mozilla::TimeStamp& aCompositeStart,
|
||||
const mozilla::TimeStamp& aCompositeEnd);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user