mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 854421 - Part 7: Allocate and return transaction id's from the refresh driver when using OMTC to prevent over-production. r=roc
This commit is contained in:
parent
8b3992ab79
commit
d78f4156e4
@ -296,6 +296,7 @@ ClientLayerManager::DidComposite(uint64_t aTransactionId)
|
||||
if (listener) {
|
||||
listener->DidCompositeWindow();
|
||||
}
|
||||
mTransactionIdAllocator->NotifyTransactionCompleted(aTransactionId);
|
||||
}
|
||||
|
||||
void
|
||||
@ -421,7 +422,7 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
||||
{
|
||||
mPhase = PHASE_FORWARD;
|
||||
|
||||
uint64_t pendingTransactionId = 1;
|
||||
uint64_t pendingTransactionId = mTransactionIdAllocator->GetTransactionId();
|
||||
|
||||
// forward this transaction's changeset to our LayerManagerComposite
|
||||
bool sent;
|
||||
@ -481,6 +482,12 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
||||
if (sent) {
|
||||
mNeedsComposite = false;
|
||||
}
|
||||
if (!sent || mForwarder->GetShadowManager()->HasNoCompositor()) {
|
||||
// Clear the transaction id so that it doesn't get returned
|
||||
// unless we forwarded to somewhere that doesn't actually
|
||||
// have a compositor.
|
||||
mTransactionIdAllocator->RevokeTransactionId(pendingTransactionId);
|
||||
}
|
||||
} else if (HasShadowManager()) {
|
||||
NS_WARNING("failed to forward Layers transaction");
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nsRect.h" // for nsIntRect
|
||||
#include "nsTArray.h" // for nsTArray
|
||||
#include "nscore.h" // for nsAString
|
||||
#include "mozilla/layers/TransactionIdAllocator.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
@ -210,6 +211,8 @@ public:
|
||||
// Get a copy of the compositor-side APZ test data for our layers ID.
|
||||
void GetCompositorSideAPZTestData(APZTestData* aData) const;
|
||||
|
||||
void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) { mTransactionIdAllocator = aAllocator; }
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
@ -256,6 +259,8 @@ private:
|
||||
// back to mShadowTarget.
|
||||
nsRefPtr<gfxContext> mShadowTarget;
|
||||
|
||||
nsRefPtr<TransactionIdAllocator> mTransactionIdAllocator;
|
||||
|
||||
// Sometimes we draw to targets that don't natively support
|
||||
// landscape/portrait orientation. When we need to implement that
|
||||
// ourselves, |mTargetRotation| describes the induced transform we
|
||||
|
@ -778,6 +778,8 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
mApzcTreeManager->UpdatePanZoomControllerTree(this, root, aIsFirstPaint,
|
||||
mRootLayerTreeID, aPaintSequenceNumber);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aTransactionId > mPendingTransaction);
|
||||
mPendingTransaction = aTransactionId;
|
||||
|
||||
if (root) {
|
||||
|
@ -62,6 +62,7 @@ using namespace mozilla;
|
||||
using namespace mozilla::css;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layout;
|
||||
typedef FrameMetrics::ViewID ViewID;
|
||||
|
||||
static inline nsIFrame*
|
||||
@ -1365,6 +1366,8 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
}
|
||||
|
||||
MaybeSetupTransactionIdAllocator(layerManager, view);
|
||||
|
||||
layerManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer,
|
||||
aBuilder, flags);
|
||||
aBuilder->SetIsCompositingCheap(temp);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsCSSColorUtils.h"
|
||||
#include "nsView.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
@ -78,6 +79,7 @@
|
||||
#include "UnitTransforms.h"
|
||||
#include "TiledLayerBuffer.h" // For TILEDLAYERBUFFER_TILE_SIZE
|
||||
#include "ClientLayerManager.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
@ -6635,3 +6637,19 @@ AutoMaybeDisableFontInflation::~AutoMaybeDisableFontInflation()
|
||||
mPresContext->mInflationDisabledForShrinkWrap = mOldValue;
|
||||
}
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace layout {
|
||||
|
||||
void
|
||||
MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager, nsView* aView)
|
||||
{
|
||||
if (aManager->GetBackendType() == layers::LayersBackend::LAYERS_CLIENT) {
|
||||
layers::ClientLayerManager *manager = static_cast<layers::ClientLayerManager*>(aManager);
|
||||
nsRefreshDriver *refresh = aView->GetViewManager()->GetPresShell()->GetPresContext()->RefreshDriver();
|
||||
manager->SetTransactionIdAllocator(refresh);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ class HTMLVideoElement;
|
||||
} // namespace dom
|
||||
namespace layers {
|
||||
class Layer;
|
||||
class ClientLayerManager;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2310,6 +2311,8 @@ namespace mozilla {
|
||||
bool mOldValue;
|
||||
};
|
||||
|
||||
void MaybeSetupTransactionIdAllocator(layers::LayerManager* aManager, nsView* aView);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,6 +189,7 @@ using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layout;
|
||||
|
||||
CapturingContentInfo nsIPresShell::gCaptureInfo =
|
||||
{ false /* mAllowed */, false /* mPointerLock */, false /* mRetargetToElement */,
|
||||
@ -5870,6 +5871,8 @@ PresShell::Paint(nsView* aViewToPaint,
|
||||
LayerProperties::CloneFrom(layerManager->GetRoot()) :
|
||||
nullptr);
|
||||
|
||||
MaybeSetupTransactionIdAllocator(layerManager, aViewToPaint);
|
||||
|
||||
if (layerManager->EndEmptyTransaction((aFlags & PAINT_COMPOSITE) ?
|
||||
LayerManager::END_DEFAULT : LayerManager::END_NO_COMPOSITE)) {
|
||||
nsIntRegion invalid;
|
||||
@ -5930,6 +5933,7 @@ PresShell::Paint(nsView* aViewToPaint,
|
||||
root->SetVisibleRegion(bounds);
|
||||
layerManager->SetRoot(root);
|
||||
}
|
||||
MaybeSetupTransactionIdAllocator(layerManager, aViewToPaint);
|
||||
layerManager->EndTransaction(nullptr, nullptr, (aFlags & PAINT_COMPOSITE) ?
|
||||
LayerManager::END_DEFAULT : LayerManager::END_NO_COMPOSITE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user