Backed out 7 changesets (bug 1441308)for causing webrender build bustages CLOSED TREE

Backed out changeset 1764701d11d1 (bug 1441308)
Backed out changeset 32f7793dfd1a (bug 1441308)
Backed out changeset d8b4d6ec9b40 (bug 1441308)
Backed out changeset e2f83e4816dd (bug 1441308)
Backed out changeset baee8ada680f (bug 1441308)
Backed out changeset c09a51622e98 (bug 1441308)
Backed out changeset 737807563dd5 (bug 1441308)
This commit is contained in:
Ciure Andrei 2019-03-22 10:52:44 +02:00
Родитель 24ea8124e6
Коммит 3de853018a
130 изменённых файлов: 1425 добавлений и 3539 удалений

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

@ -696,7 +696,7 @@
id="syncedTabsRefreshFilter"/>
</menupopup>
<hbox id="statuspanel" inactive="true" renderroot="content">
<hbox id="statuspanel" inactive="true" layer="true">
<hbox id="statuspanel-inner">
<label id="statuspanel-label"
role="status"
@ -1331,7 +1331,7 @@
<hbox id="fullscr-toggler" hidden="true"/>
<deck id="content-deck" flex="1" renderroot="content">
<deck id="content-deck" flex="1">
<hbox flex="1" id="browser">
<vbox id="browser-border-start" hidden="true" layer="true"/>
<vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
@ -1367,7 +1367,7 @@
#include ../../components/customizableui/content/customizeMode.inc.xul
</deck>
<html:div id="fullscreen-warning" class="pointerlockfswarning" hidden="true" renderroot="content">
<html:div id="fullscreen-warning" class="pointerlockfswarning" hidden="true">
<html:div class="pointerlockfswarning-domain-text">
&fullscreenWarning.beforeDomain.label;
<html:span class="pointerlockfswarning-domain"/>
@ -1386,7 +1386,7 @@
</html:button>
</html:div>
<html:div id="pointerlock-warning" class="pointerlockfswarning" hidden="true" renderroot="content">
<html:div id="pointerlock-warning" class="pointerlockfswarning" hidden="true">
<html:div class="pointerlockfswarning-domain-text">
&pointerlockWarning.beforeDomain.label;
<html:span class="pointerlockfswarning-domain"/>
@ -1397,7 +1397,8 @@
</html:div>
</html:div>
<vbox id="browser-bottombox" layer="true" renderroot="content">
<vbox id="browser-bottombox" layer="true">
<!-- gNotificationBox will be added here lazily. -->
</vbox>
</window>

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

@ -239,7 +239,6 @@ class BasePopup {
let stack = document.createXULElement("stack");
stack.setAttribute("class", "webextension-popup-stack");
stack.setAttribute("renderroot", "content");
let browser = document.createXULElement("browser");
browser.setAttribute("type", "content");

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

@ -32,7 +32,6 @@
#include "mozilla/dom/WindowProxyHolder.h"
#include "mozilla/dom/BrowserBridgeChild.h"
#include "mozilla/gfx/CrossProcessPaint.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/IMEStateManager.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/APZChild.h"
@ -479,7 +478,7 @@ void TabChild::ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
void TabChild::SetTargetAPZC(
uint64_t aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) const {
const nsTArray<ScrollableLayerGuid>& aTargets) const {
if (mApzcTreeManager) {
mApzcTreeManager->SetTargetAPZC(aInputBlockId, aTargets);
}
@ -500,8 +499,8 @@ bool TabChild::DoUpdateZoomConstraints(
return false;
}
SLGuidAndRenderRoot guid = SLGuidAndRenderRoot(
mLayersId, aPresShellId, aViewId, gfxUtils::GetContentRenderRoot());
ScrollableLayerGuid guid =
ScrollableLayerGuid(mLayersId, aPresShellId, aViewId);
mApzcTreeManager->UpdateZoomConstraints(guid, aConstraints);
return true;
@ -1239,8 +1238,7 @@ void TabChild::HandleDoubleTap(const CSSPoint& aPoint,
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
document->GetDocumentElement(), &presShellId, &viewId) &&
mApzcTreeManager) {
SLGuidAndRenderRoot guid(mLayersId, presShellId, viewId,
gfxUtils::GetContentRenderRoot());
ScrollableLayerGuid guid(mLayersId, presShellId, viewId);
mApzcTreeManager->ZoomToRect(guid, zoomToRect, DEFAULT_BEHAVIOR);
}
@ -1326,9 +1324,8 @@ bool TabChild::NotifyAPZStateChange(
void TabChild::StartScrollbarDrag(
const layers::AsyncDragMetrics& aDragMetrics) {
SLGuidAndRenderRoot guid(mLayersId, aDragMetrics.mPresShellId,
aDragMetrics.mViewId,
gfxUtils::GetContentRenderRoot());
ScrollableLayerGuid guid(mLayersId, aDragMetrics.mPresShellId,
aDragMetrics.mViewId);
if (mApzcTreeManager) {
mApzcTreeManager->StartScrollbarDrag(guid, aDragMetrics);
@ -1338,8 +1335,7 @@ void TabChild::StartScrollbarDrag(
void TabChild::ZoomToRect(const uint32_t& aPresShellId,
const ScrollableLayerGuid::ViewID& aViewId,
const CSSRect& aRect, const uint32_t& aFlags) {
SLGuidAndRenderRoot guid(mLayersId, aPresShellId, aViewId,
gfxUtils::GetContentRenderRoot());
ScrollableLayerGuid guid(mLayersId, aPresShellId, aViewId);
if (mApzcTreeManager) {
mApzcTreeManager->ZoomToRect(guid, aRect, aFlags);

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

@ -578,7 +578,7 @@ class TabChild final : public TabChildBase,
uint64_t aInputBlockId,
bool aPreventDefault) const;
void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<layers::SLGuidAndRenderRoot>& aTargets) const;
const nsTArray<ScrollableLayerGuid>& aTargets) const;
MOZ_CAN_RUN_SCRIPT_BOUNDARY
mozilla::ipc::IPCResult RecvHandleTap(
const layers::GeckoContentController::TapType& aType,

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

@ -91,7 +91,6 @@
#include "nsAuthInformationHolder.h"
#include "nsICancelable.h"
#include "gfxPrefs.h"
#include "gfxUtils.h"
#include "nsILoginManagerPrompter.h"
#include "nsPIWindowRoot.h"
#include "nsIAuthPrompt2.h"
@ -3440,8 +3439,7 @@ TabParent::StartApzAutoscroll(float aAnchorX, float aAnchorY,
if (mRenderFrame.IsInitialized()) {
layers::LayersId layersId = mRenderFrame.GetLayersId();
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
SLGuidAndRenderRoot guid(layersId, aPresShellId, aScrollId,
gfxUtils::GetContentRenderRoot());
ScrollableLayerGuid guid{layersId, aPresShellId, aScrollId};
// The anchor coordinates that are passed in are relative to the origin
// of the screen, but we are sending them to APZ which only knows about
@ -3470,9 +3468,7 @@ TabParent::StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId) {
if (mRenderFrame.IsInitialized()) {
layers::LayersId layersId = mRenderFrame.GetLayersId();
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
SLGuidAndRenderRoot guid(layersId, aPresShellId, aScrollId,
gfxUtils::GetContentRenderRoot());
ScrollableLayerGuid guid{layersId, aPresShellId, aScrollId};
widget->StopAsyncAutoscroll(guid);
}
}

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

@ -26,7 +26,6 @@ void CompositorAnimationStorage::Clear() {
mAnimatedValues.Clear();
mAnimations.Clear();
mAnimationRenderRoots.Clear();
}
void CompositorAnimationStorage::ClearById(const uint64_t& aId) {
@ -34,7 +33,6 @@ void CompositorAnimationStorage::ClearById(const uint64_t& aId) {
mAnimatedValues.Remove(aId);
mAnimations.Remove(aId);
mAnimationRenderRoots.Remove(aId);
}
AnimatedValue* CompositorAnimationStorage::GetAnimatedValue(
@ -136,12 +134,10 @@ nsTArray<PropertyAnimationGroup>* CompositorAnimationStorage::GetAnimations(
}
void CompositorAnimationStorage::SetAnimations(uint64_t aId,
const AnimationArray& aValue,
wr::RenderRoot aRenderRoot) {
const AnimationArray& aValue) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
mAnimations.Put(aId, new nsTArray<PropertyAnimationGroup>(
AnimationHelper::ExtractAnimations(aValue)));
mAnimationRenderRoots.Put(aId, aRenderRoot);
}
enum class CanSkipCompose {

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

@ -8,10 +8,9 @@
#define mozilla_layers_AnimationHelper_h
#include "mozilla/dom/Nullable.h"
#include "mozilla/ComputedTimingFunction.h" // for ComputedTimingFunction
#include "mozilla/layers/LayersMessages.h" // for TransformData, etc
#include "mozilla/webrender/WebRenderTypes.h" // for RenderRoot
#include "mozilla/TimeStamp.h" // for TimeStamp
#include "mozilla/ComputedTimingFunction.h" // for ComputedTimingFunction
#include "mozilla/layers/LayersMessages.h" // for TransformData, etc
#include "mozilla/TimeStamp.h" // for TimeStamp
#include "mozilla/TimingParams.h"
#include "X11UndefineNone.h"
@ -134,8 +133,6 @@ class CompositorAnimationStorage final {
typedef nsClassHashtable<nsUint64HashKey, AnimatedValue> AnimatedValueTable;
typedef nsClassHashtable<nsUint64HashKey, nsTArray<PropertyAnimationGroup>>
AnimationsTable;
typedef nsDataHashtable<nsUint64HashKey, wr::RenderRoot>
AnimationsRenderRootsTable;
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorAnimationStorage)
public:
@ -181,8 +178,7 @@ class CompositorAnimationStorage final {
/**
* Set the animations based on the unique id
*/
void SetAnimations(uint64_t aId, const AnimationArray& aAnimations,
wr::RenderRoot aRenderRoot);
void SetAnimations(uint64_t aId, const AnimationArray& aAnimations);
/**
* Return the animations if a given id can map to its animations
@ -198,10 +194,6 @@ class CompositorAnimationStorage final {
uint32_t AnimationsCount() const { return mAnimations.Count(); }
wr::RenderRoot AnimationRenderRoot(const uint64_t& aId) const {
return mAnimationRenderRoots.Get(aId);
}
/**
* Clear AnimatedValues and Animations data
*/
@ -214,7 +206,6 @@ class CompositorAnimationStorage final {
private:
AnimatedValueTable mAnimatedValues;
AnimationsTable mAnimations;
AnimationsRenderRootsTable mAnimationRenderRoots;
};
/**

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

@ -331,8 +331,6 @@ class MOZ_STACK_CLASS LayerMetricsWrapper {
return Nothing();
}
Maybe<wr::RenderRoot> GetReferentRenderRoot() const { return Nothing(); }
Maybe<ParentLayerIntRect> GetClipRect() const {
MOZ_ASSERT(IsValid());

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

@ -2234,40 +2234,28 @@ bool LayerManager::IsLogEnabled() {
bool LayerManager::SetPendingScrollUpdateForNextTransaction(
ScrollableLayerGuid::ViewID aScrollId,
const ScrollUpdateInfo& aUpdateInfo,
wr::RenderRoot aRenderRoot) {
const ScrollUpdateInfo& aUpdateInfo) {
Layer* withPendingTransform = DepthFirstSearch<ForwardIterator>(
GetRoot(), [](Layer* aLayer) { return aLayer->HasPendingTransform(); });
if (withPendingTransform) {
return false;
}
// If this is called on a LayerManager that's not a WebRenderLayerManager,
// then we don't actually need the aRenderRoot information. We force it to
// RenderRoot::Default so that we can make assumptions in
// GetPendingScrollInfoUpdate.
wr::RenderRoot renderRoot = (GetBackendType() == LayersBackend::LAYERS_WR)
? aRenderRoot : wr::RenderRoot::Default;
mPendingScrollUpdates[renderRoot][aScrollId] = aUpdateInfo;
mPendingScrollUpdates[aScrollId] = aUpdateInfo;
return true;
}
Maybe<ScrollUpdateInfo> LayerManager::GetPendingScrollInfoUpdate(
ScrollableLayerGuid::ViewID aScrollId) {
// This never gets called for WebRenderLayerManager, so we assume that all
// pending scroll info updates are stored under the default RenderRoot.
MOZ_ASSERT(GetBackendType() != LayersBackend::LAYERS_WR);
auto it = mPendingScrollUpdates[wr::RenderRoot::Default].find(aScrollId);
if (it != mPendingScrollUpdates[wr::RenderRoot::Default].end()) {
auto it = mPendingScrollUpdates.find(aScrollId);
if (it != mPendingScrollUpdates.end()) {
return Some(it->second);
}
return Nothing();
}
void LayerManager::ClearPendingScrollInfoUpdate() {
for (auto renderRoot : wr::kRenderRoots) {
mPendingScrollUpdates[renderRoot].clear();
}
mPendingScrollUpdates.clear();
}
void PrintInfo(std::stringstream& aStream, HostLayer* aLayerComposite) {

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

@ -791,14 +791,13 @@ class LayerManager : public FrameRecorder {
*/
virtual bool SetPendingScrollUpdateForNextTransaction(
ScrollableLayerGuid::ViewID aScrollId,
const ScrollUpdateInfo& aUpdateInfo,
wr::RenderRoot aRenderRoot);
const ScrollUpdateInfo& aUpdateInfo);
Maybe<ScrollUpdateInfo> GetPendingScrollInfoUpdate(
ScrollableLayerGuid::ViewID aScrollId);
void ClearPendingScrollInfoUpdate();
protected:
wr::RenderRootArray<ScrollUpdatesMap> mPendingScrollUpdates;
ScrollUpdatesMap mPendingScrollUpdates;
};
/**

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

@ -258,13 +258,6 @@ void AppendToString(std::stringstream& aStream, const ScrollableLayerGuid& s,
<< sfx;
}
void AppendToString(std::stringstream& aStream, const SLGuidAndRenderRoot& s,
const char* pfx, const char* sfx) {
aStream << pfx << "{ ";
AppendToString(aStream, s.mScrollableLayerGuid, "s=");
aStream << nsPrintfCString(", r=%d }", (int)s.mRenderRoot).get() << sfx;
}
void AppendToString(std::stringstream& aStream, const ZoomConstraints& z,
const char* pfx, const char* sfx) {
aStream << pfx

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

@ -12,7 +12,6 @@
#include "mozilla/gfx/Point.h" // for IntSize, etc
#include "mozilla/gfx/TiledRegion.h" // for TiledRegion
#include "mozilla/gfx/Types.h" // for SamplingFilter, SurfaceFormat
#include "mozilla/layers/APZTypes.h" // for SLGuidAndRenderRoot
#include "mozilla/layers/CompositorTypes.h" // for TextureFlags
#include "mozilla/layers/WebRenderLayersLogging.h"
#include "mozilla/layers/ZoomConstraints.h"
@ -182,9 +181,6 @@ void AppendToString(std::stringstream& aStream, const FrameMetrics& m,
void AppendToString(std::stringstream& aStream, const ScrollableLayerGuid& s,
const char* pfx = "", const char* sfx = "");
void AppendToString(std::stringstream& aStream, const SLGuidAndRenderRoot& s,
const char* pfx = "", const char* sfx = "");
void AppendToString(std::stringstream& aStream, const ZoomConstraints& z,
const char* pfx = "", const char* sfx = "");

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

@ -177,8 +177,7 @@ CanvasClient::CanvasClientType ShareableCanvasRenderer::GetCanvasClientType() {
return CanvasClient::CanvasClientSurface;
}
void ShareableCanvasRenderer::UpdateCompositableClient(
wr::RenderRoot aRenderRoot) {
void ShareableCanvasRenderer::UpdateCompositableClient() {
if (!CreateCompositable()) {
return;
}
@ -198,16 +197,14 @@ void ShareableCanvasRenderer::UpdateCompositableClient(
gfxCriticalNote << "BufferProvider::SetForwarder failed";
return;
}
mCanvasClient->UpdateFromTexture(mBufferProvider->GetTextureClient(),
aRenderRoot);
mCanvasClient->UpdateFromTexture(mBufferProvider->GetTextureClient());
} else {
mCanvasClient->Update(gfx::IntSize(mSize.width, mSize.height), this,
aRenderRoot);
mCanvasClient->Update(gfx::IntSize(mSize.width, mSize.height), this);
}
FireDidTransactionCallback();
mCanvasClient->Updated(aRenderRoot);
mCanvasClient->Updated();
}
} // namespace layers

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

@ -39,8 +39,7 @@ class ShareableCanvasRenderer : public CopyableCanvasRenderer {
void ClearCachedResources() override;
void Destroy() override;
void UpdateCompositableClient(
wr::RenderRoot aRenderRoot = wr::RenderRoot::Default);
void UpdateCompositableClient();
const TextureFlags& Flags() const { return mFlags; }

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

@ -52,7 +52,7 @@ class UpdateImageHelper {
return target.forget();
}
bool UpdateImage(wr::RenderRoot aRenderRoot) {
bool UpdateImage() {
if (!mTexture) {
return false;
}
@ -65,8 +65,7 @@ class UpdateImageHelper {
RefPtr<TextureWrapperImage> image = new TextureWrapperImage(
mTexture, gfx::IntRect(gfx::IntPoint(0, 0), mImageSize));
mImageContainer->SetCurrentImageInTransaction(image);
return mImageClient->UpdateImage(mImageContainer, /* unused */ 0,
Some(aRenderRoot));
return mImageClient->UpdateImage(mImageContainer, /* unused */ 0);
}
private:

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

@ -59,12 +59,10 @@ class APZSampler {
*/
static void SetSamplerThread(const wr::WrWindowId& aWindowId);
static void SampleForWebRender(const wr::WrWindowId& aWindowId,
wr::Transaction* aTxn,
const wr::DocumentId& aRenderRootId);
wr::Transaction* aTxn);
void SetSampleTime(const TimeStamp& aSampleTime);
void SampleForWebRender(wr::TransactionWrapper& aTxn,
wr::RenderRoot aRenderRoot);
void SampleForWebRender(wr::TransactionWrapper& aTxn);
bool SampleAnimations(const LayerMetricsWrapper& aLayer,
const TimeStamp& aSampleTime);

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

@ -1,122 +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_APZTypes_h
#define mozilla_layers_APZTypes_h
#include "LayersTypes.h"
#include "mozilla/layers/ScrollableLayerGuid.h"
#include "mozilla/webrender/WebRenderTypes.h"
namespace mozilla {
namespace layers {
// This struct provides a way to identify a specific "render root" within a
// specific layer subtree. With WebRender enabled, parts of a layer subtree
// may get split into different WebRender "documents" (aka "render roots"),
// and APZ often needs to know which "render root" a particular message is
// targeted at, so that it can use the correct WebRender document id when
// interfacing with WebRender. For codepaths that are never used with
// WebRender, the static WrRootId::NonWebRender constructor can be used to
// obtain an instance of this struct.
struct WRRootId {
LayersId mLayersId;
wr::RenderRoot mRenderRoot;
WRRootId() = default;
static WRRootId NonWebRender(LayersId aLayersId) {
return WRRootId(aLayersId, wr::RenderRoot::Default);
}
WRRootId(LayersId aLayersId, wr::RenderRoot aRenderRoot)
: mLayersId(aLayersId), mRenderRoot(aRenderRoot) {}
WRRootId(wr::PipelineId aLayersId, wr::DocumentId aRenderRootId)
: mLayersId(AsLayersId(aLayersId)),
mRenderRoot(RenderRootFromId(aRenderRootId)) {}
bool operator==(const WRRootId& aOther) const {
return mRenderRoot == aOther.mRenderRoot && mLayersId == aOther.mLayersId;
}
bool operator!=(const WRRootId& aOther) const { return !(*this == aOther); }
bool IsValid() const { return mLayersId.IsValid(); }
// Helper struct that allow this class to be used as a key in
// std::unordered_map like so:
// std::unordered_map<WRRootId, ValueType, WRRootId::HashFn> myMap;
struct HashFn {
std::size_t operator()(const WRRootId& aKey) const {
return HashGeneric((uint64_t)aKey.mLayersId, (uint8_t)aKey.mRenderRoot);
}
};
};
// This struct provides a way to select which APZUpdater queue a particular
// message is associated with. A layers subtree may have multiple render roots
// that are treated independently within WebRender, and each message that goes
// into the APZUpdater queue may deal with one or more of these render roots
// within a given layers subtree. This structure allows representing these
// relationships, and allows the APZUpdater to ensure that the ordering
// dependencies between messages are preserved and messages get processed in
// the correct order relative to each other.
struct UpdaterQueueSelector {
LayersId mLayersId;
wr::RenderRootSet mRenderRoots;
UpdaterQueueSelector() = default;
explicit UpdaterQueueSelector(LayersId aLayersId) : mLayersId(aLayersId) {}
UpdaterQueueSelector(LayersId aLayersId, wr::RenderRoot aRenderRoot)
: mLayersId(aLayersId), mRenderRoots(aRenderRoot) {}
explicit UpdaterQueueSelector(const WRRootId& aNodeId)
: mLayersId(aNodeId.mLayersId), mRenderRoots(aNodeId.mRenderRoot) {}
};
// This a simple structure that wraps a ScrollableLayerGuid and a RenderRoot.
// It is needed on codepaths shared with WebRender, where we need to propagate
// the RenderRoot information along with the ScrollableLayerGuid (as each
// scrollable frame belongs to exactly one RenderRoot, and APZ needs to record
// that information on the APZC instances).
struct SLGuidAndRenderRoot {
ScrollableLayerGuid mScrollableLayerGuid;
wr::RenderRoot mRenderRoot;
// needed for IPDL, but shouldn't be used otherwise!
SLGuidAndRenderRoot() : mRenderRoot(wr::RenderRoot::Default) {}
SLGuidAndRenderRoot(LayersId aLayersId, uint32_t aPresShellId,
ScrollableLayerGuid::ViewID aScrollId,
wr::RenderRoot aRenderRoot)
: mScrollableLayerGuid(aLayersId, aPresShellId, aScrollId),
mRenderRoot(aRenderRoot) {}
SLGuidAndRenderRoot(const ScrollableLayerGuid& other,
wr::RenderRoot aRenderRoot)
: mScrollableLayerGuid(other), mRenderRoot(aRenderRoot) {}
WRRootId GetWRRootId() const {
return WRRootId(mScrollableLayerGuid.mLayersId, mRenderRoot);
}
};
template <int LogLevel>
gfx::Log<LogLevel>& operator<<(gfx::Log<LogLevel>& log,
const SLGuidAndRenderRoot& aGuid) {
return log << '(' << aGuid.mScrollableLayerGuid << ','
<< (int)aGuid.mRenderRoot << ')';
}
} // namespace layers
} // namespace mozilla
#endif /* mozilla_layers_APZTypes_h */

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

@ -12,7 +12,6 @@
#include "base/platform_thread.h" // for PlatformThreadId
#include "LayersTypes.h"
#include "APZTypes.h"
#include "mozilla/layers/APZTestData.h"
#include "mozilla/layers/WebRenderScrollData.h"
#include "mozilla/StaticMutex.h"
@ -23,6 +22,10 @@
namespace mozilla {
namespace wr {
struct WrWindowId;
} // namespace wr
namespace layers {
class APZCTreeManager;
@ -60,7 +63,7 @@ class APZUpdater {
void ClearTree(LayersId aRootLayersId);
void UpdateFocusState(LayersId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
LayersId aOriginatingLayersId,
const FocusTarget& aFocusTarget);
void UpdateHitTestingTree(LayersId aRootLayerTreeId, Layer* aRoot,
bool aIsFirstPaint, LayersId aOriginatingLayersId,
@ -73,8 +76,8 @@ class APZUpdater {
* This function will store the new scroll data and update the focus state and
* hit-testing tree.
*/
void UpdateScrollDataAndTreeState(WRRootId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
void UpdateScrollDataAndTreeState(LayersId aRootLayerTreeId,
LayersId aOriginatingLayersId,
const wr::Epoch& aEpoch,
WebRenderScrollData&& aScrollData);
/**
@ -83,26 +86,26 @@ class APZUpdater {
* side). This function will update the stored scroll offsets and the
* hit-testing tree.
*/
void UpdateScrollOffsets(WRRootId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
void UpdateScrollOffsets(LayersId aRootLayerTreeId,
LayersId aOriginatingLayersId,
ScrollUpdatesMap&& aUpdates,
uint32_t aPaintSequenceNumber);
void NotifyLayerTreeAdopted(WRRootId aWrRootId,
void NotifyLayerTreeAdopted(LayersId aLayersId,
const RefPtr<APZUpdater>& aOldUpdater);
void NotifyLayerTreeRemoved(WRRootId aWrRootId);
void NotifyLayerTreeRemoved(LayersId aLayersId);
bool GetAPZTestData(WRRootId aWrRootId, APZTestData* aOutData);
bool GetAPZTestData(LayersId aLayersId, APZTestData* aOutData);
void SetTestAsyncScrollOffset(WRRootId aWrRootId,
void SetTestAsyncScrollOffset(LayersId aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aOffset);
void SetTestAsyncZoom(WRRootId aWrRootId,
void SetTestAsyncZoom(LayersId aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom);
// This can only be called on the updater thread.
const WebRenderScrollData* GetScrollData(WRRootId aWrRootId) const;
const WebRenderScrollData* GetScrollData(LayersId aLayersId) const;
/**
* This can be used to assert that the current thread is the
@ -115,20 +118,12 @@ class APZUpdater {
* Runs the given task on the APZ "updater thread" for this APZUpdater. If
* this function is called from the updater thread itself then the task is
* run immediately without getting queued.
*
* Conceptually each (layers tree, render root) tuple has a separate task
* queue. (In the case where WebRender is disabled, the render root is
* always the default render root). This makes it so that even if one
* (layers tree, render root) is blocked waiting for a scene build in
* WebRender, other tasks can still be processed. However, there may be
* tasks that are tied to multiple render roots within a given layers tree,
* and which would therefore block on all the associated (layers tree,
* render root) queues. The aSelector argument allows expressing the set of
* render roots the task is tied to so that this ordering dependency can be
* respected.
* The layers id argument should be the id of the layer tree that is
* requesting this task to be run. Conceptually each layer tree has a separate
* task queue, so that if one layer tree is blocked waiting for a scene build
* then tasks for the other layer trees can still be processed.
*/
void RunOnUpdaterThread(UpdaterQueueSelector aSelector,
already_AddRefed<Runnable> aTask);
void RunOnUpdaterThread(LayersId aLayersId, already_AddRefed<Runnable> aTask);
/**
* Returns true if currently on the APZUpdater's "updater thread".
@ -142,10 +137,11 @@ class APZUpdater {
* updater thread. When the updater thread runs it (or if this is called
* directly on the updater thread), that is when the task gets dispatched to
* the controller thread. The controller thread then actually runs the task.
*
* See the RunOnUpdaterThread method for details on the aSelector argument.
* The layers id argument should be the id of the layer tree that is
* requesting this task to be run; in most cases this will probably just be
* the root layers id of the compositor.
*/
void RunOnControllerThread(UpdaterQueueSelector aSelector,
void RunOnControllerThread(LayersId aLayersId,
already_AddRefed<Runnable> aTask);
protected:
@ -161,41 +157,40 @@ class APZUpdater {
RefPtr<APZCTreeManager> mApz;
bool mIsUsingWebRender;
// Map from WRRoot id to WebRenderScrollData. This can only be touched on
// Map from layers id to WebRenderScrollData. This can only be touched on
// the updater thread.
std::unordered_map<WRRootId, WebRenderScrollData, WRRootId::HashFn>
std::unordered_map<LayersId, WebRenderScrollData, LayersId::HashFn>
mScrollData;
// Stores epoch state for a particular WRRoot id. This structure is only
// Stores epoch state for a particular layers id. This structure is only
// accessed on the updater thread.
struct EpochState {
// The epoch for the most recent scroll data sent from the content side.
wr::Epoch mRequired;
// The epoch for the most recent scene built and swapped in on the WR side.
Maybe<wr::Epoch> mBuilt;
// True if and only if the WRRoot id is the root WRRoot id for the
// True if and only if the layers id is the root layers id for the
// compositor
bool mIsRoot;
EpochState();
// Whether or not the state for this WRRoot id is such that it blocks
// processing of tasks. This happens if the root tree or a "visible"
// render root has scroll data for an epoch newer than what has been
// built. A "visible" render root is one that is attached to the full
// Whether or not the state for this layers id is such that it blocks
// processing of tasks for the layer tree. This happens if the root layers
// id or a "visible" layers id has scroll data for an epoch newer than what
// has been built. A "visible" layers id is one that is attached to the full
// layer tree (i.e. there is a chain of reflayer items from the root layer
// tree to the relevant layer subtree) on a WR document whose scene has
// been built. This is not always the case; for instance a content process
// may send the compositor layers for a document before the chrome has
// attached the remote iframe to the root UI document. Since WR only
// builds pipelines for "visible" render roots, |mBuilt| being populated
// means that the render root is "visible".
// tree to the relevant layer subtree. This is not always the case; for
// instance a content process may send the compositor layers for a document
// before the chrome has attached the remote iframe to the root document.
// Since WR only builds pipelines for "visible" layers ids, |mBuilt| being
// populated means that the layers id is "visible".
bool IsBlocked() const;
};
// Map from WRRoot id to epoch state.
// Map from layers id to epoch state.
// This data structure can only be touched on the updater thread.
std::unordered_map<WRRootId, EpochState, WRRootId::HashFn> mEpochData;
std::unordered_map<LayersId, EpochState, LayersId::HashFn> mEpochData;
// Used to manage the mapping from a WR window id to APZUpdater. These are
// only used if WebRender is enabled. Both sWindowIdMap and mWindowId should
@ -216,28 +211,22 @@ class APZUpdater {
// care about the contents.
Maybe<PlatformThreadId> mUpdaterThreadId;
// Helper struct that pairs each queued runnable with the layers id and render
// roots that it is associated with. This allows us to easily implement the
// conceptual separation of mUpdaterQueue into independent queues per (layers
// id, render root) pair. Note that when the UpdaterQueueSelector has multiple
// render roots, the task blocks on *all* of the queues for the (layers
// id, render root) pairs.
// Helper struct that pairs each queued runnable with the layers id that it
// is associated with. This allows us to easily implement the conceptual
// separation of mUpdaterQueue into independent queues per layers id.
struct QueuedTask {
UpdaterQueueSelector mSelector;
LayersId mLayersId;
RefPtr<Runnable> mRunnable;
};
// Lock used to protect mUpdaterQueue
Mutex mQueueLock;
// Holds a queue of tasks to be run on the updater thread, when the updater
// thread is a WebRender thread, since it is conceptually separated into
// multiple ones, one per (layers id, render root). Tasks for a given
// conceptual queue will always run in FIFO order, and tasks that are tied
// to multiple queues (by virtue of having multiple render roots in their
// UpdaterQueueSelector) can cause one queue to be blocked on another in
// order to preserve FIFO ordering. In the common case, though, where there
// is exactly one render root per task, there is no guaranteed ordering for
// tasks with different render roots.
// Holds a queue of tasks to be run on the updater thread,
// when the updater thread is a WebRender thread, since it won't have a
// message loop we can dispatch to. Note that although this is a single queue
// it is conceptually separated into multiple ones, one per layers id. Tasks
// for a given layers id will always run in FIFO order, but there is no
// guaranteed ordering for tasks with different layers ids.
std::deque<QueuedTask> mUpdaterQueue;
};

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

@ -8,8 +8,6 @@
#define mozilla_layers_CompositorController_h
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
#include "mozilla/Maybe.h"
#include "mozilla/webrender/WebRenderTypes.h"
namespace mozilla {
namespace layers {
@ -18,8 +16,7 @@ class CompositorController {
public:
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
virtual void ScheduleRenderOnCompositorThread(
const Maybe<wr::RenderRoot>& aRenderRootid = Nothing()) = 0;
virtual void ScheduleRenderOnCompositorThread() = 0;
virtual void ScheduleHideAllPluginWindows() = 0;
virtual void ScheduleShowAllPluginWindows() = 0;

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

@ -55,7 +55,7 @@ class IAPZCTreeManager {
* up. |aRect| must be given in CSS pixels, relative to the document.
* |aFlags| is a combination of the ZoomToRectBehavior enum values.
*/
virtual void ZoomToRect(const SLGuidAndRenderRoot& aGuid,
virtual void ZoomToRect(const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t aFlags = DEFAULT_BEHAVIOR) = 0;
@ -81,7 +81,7 @@ class IAPZCTreeManager {
* should be set to ScrollableLayerGuid::NULL_SCROLL_ID.
*/
virtual void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) = 0;
const nsTArray<ScrollableLayerGuid>& aTargets) = 0;
/**
* Updates any zoom constraints contained in the <meta name="viewport"> tag.
@ -89,7 +89,7 @@ class IAPZCTreeManager {
* the given |aGuid| are cleared.
*/
virtual void UpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints) = 0;
virtual void SetDPI(float aDpiValue) = 0;
@ -106,13 +106,13 @@ class IAPZCTreeManager {
virtual void SetAllowedTouchBehavior(
uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aValues) = 0;
virtual void StartScrollbarDrag(const SLGuidAndRenderRoot& aGuid,
virtual void StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics) = 0;
virtual bool StartAutoscroll(const SLGuidAndRenderRoot& aGuid,
virtual bool StartAutoscroll(const ScrollableLayerGuid& aGuid,
const ScreenPoint& aAnchorLocation) = 0;
virtual void StopAutoscroll(const SLGuidAndRenderRoot& aGuid) = 0;
virtual void StopAutoscroll(const ScrollableLayerGuid& aGuid) = 0;
/**
* Function used to disable LongTap gestures.

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

@ -75,10 +75,10 @@ typedef CompositorBridgeParent::LayerTreeState LayerTreeState;
struct APZCTreeManager::TreeBuildingState {
TreeBuildingState(LayersId aRootLayersId, bool aIsFirstPaint,
WRRootId aOriginatingWrRootId, APZTestData* aTestData,
LayersId aOriginatingLayersId, APZTestData* aTestData,
uint32_t aPaintSequence)
: mIsFirstPaint(aIsFirstPaint),
mOriginatingWrRootId(aOriginatingWrRootId),
mOriginatingLayersId(aOriginatingLayersId),
mPaintLogger(aTestData, aPaintSequence) {
CompositorBridgeParent::CallWithIndirectShadowTree(
aRootLayersId, [this](LayerTreeState& aState) -> void {
@ -94,7 +94,7 @@ struct APZCTreeManager::TreeBuildingState {
RefPtr<CompositorController> mCompositorController;
RefPtr<MetricsSharingController> mInProcessSharingController;
const bool mIsFirstPaint;
const WRRootId mOriginatingWrRootId;
const LayersId mOriginatingLayersId;
const APZPaintLogHelper mPaintLogger;
// State that is updated as we perform the tree build
@ -331,10 +331,9 @@ void APZCTreeManager::NotifyLayerTreeRemoved(LayersId aLayersId) {
}
AsyncPanZoomController* APZCTreeManager::NewAPZCInstance(
LayersId aLayersId, GeckoContentController* aController,
wr::RenderRoot aRenderRoot) {
LayersId aLayersId, GeckoContentController* aController) {
return new AsyncPanZoomController(
aLayersId, this, mInputQueue, aController, aRenderRoot,
aLayersId, this, mInputQueue, aController,
AsyncPanZoomController::USE_GESTURE_DETECTOR);
}
@ -352,7 +351,7 @@ void // ScrollNode is a LayerMetricsWrapper or a WebRenderScrollDataWrapper
APZCTreeManager::UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId,
const ScrollNode& aRoot,
bool aIsFirstPaint,
WRRootId aOriginatingWrRootId,
LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber) {
RecursiveMutexAutoLock lock(mTreeLock);
@ -363,12 +362,12 @@ APZCTreeManager::UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId,
MutexAutoLock lock(mTestDataLock);
UniquePtr<APZTestData> ptr = MakeUnique<APZTestData>();
auto result =
mTestData.insert(std::make_pair(aOriginatingWrRootId.mLayersId, std::move(ptr)));
mTestData.insert(std::make_pair(aOriginatingLayersId, std::move(ptr)));
testData = result.first->second.get();
testData->StartNewPaint(aPaintSequenceNumber);
}
TreeBuildingState state(aRootLayerTreeId, aIsFirstPaint, aOriginatingWrRootId,
TreeBuildingState state(aRootLayerTreeId, aIsFirstPaint, aOriginatingLayersId,
testData, aPaintSequenceNumber);
// We do this business with collecting the entire tree into an array because
@ -401,7 +400,6 @@ APZCTreeManager::UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId,
HitTestingTreeNode* parent = nullptr;
HitTestingTreeNode* next = nullptr;
LayersId layersId = aRootLayerTreeId;
wr::RenderRoot renderRoot = wr::RenderRoot::Default;
ancestorTransforms.push(AncestorTransform());
state.mParentHasPerspective.push(false);
@ -428,7 +426,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId,
HitTestingTreeNode* node = PrepareNodeForLayer(
lock, aLayerMetrics, aLayerMetrics.Metrics(), layersId,
ancestorTransforms.top(), parent, next, state, renderRoot);
ancestorTransforms.top(), parent, next, state);
MOZ_ASSERT(node);
AsyncPanZoomController* apzc = node->GetApzc();
aLayerMetrics.SetApzc(apzc);
@ -471,14 +469,10 @@ APZCTreeManager::UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId,
parent = node;
next = nullptr;
// Update the layersId or renderroot if we have a new one
// Update the layersId if we have a new one
if (Maybe<LayersId> newLayersId = aLayerMetrics.GetReferentId()) {
layersId = *newLayersId;
}
if (Maybe<wr::RenderRoot> newRenderRoot =
aLayerMetrics.GetReferentRenderRoot()) {
renderRoot = *newRenderRoot;
}
indents.push(gfx::TreeAutoIndent<LOG_DEFAULT>(mApzcTreeLog));
state.mParentHasPerspective.push(
@ -609,22 +603,21 @@ void APZCTreeManager::UpdateHitTestingTree(LayersId aRootLayerTreeId,
LayerMetricsWrapper root(aRoot);
UpdateHitTestingTreeImpl(aRootLayerTreeId, root, aIsFirstPaint,
WRRootId::NonWebRender(aOriginatingLayersId), aPaintSequenceNumber);
aOriginatingLayersId, aPaintSequenceNumber);
}
void APZCTreeManager::UpdateHitTestingTree(
LayersId aRootLayerTreeId, const WebRenderScrollDataWrapper& aScrollWrapper,
bool aIsFirstPaint, WRRootId aOriginatingWrRootId,
bool aIsFirstPaint, LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber) {
AssertOnUpdaterThread();
UpdateHitTestingTreeImpl(aRootLayerTreeId, aScrollWrapper, aIsFirstPaint,
aOriginatingWrRootId, aPaintSequenceNumber);
aOriginatingLayersId, aPaintSequenceNumber);
}
void APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
const TimeStamp& aSampleTime,
wr::RenderRoot aRenderRoot) {
const TimeStamp& aSampleTime) {
AssertOnSamplerThread();
MutexAutoLock lock(mMapLock);
@ -633,10 +626,6 @@ void APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
// Sample async transforms on scrollable layers.
for (const auto& mapping : mApzcMap) {
AsyncPanZoomController* apzc = mapping.second;
if (apzc->GetRenderRoot() != aRenderRoot) {
// If this APZC belongs to a different render root, skip over it
continue;
}
// Apply any additional async scrolling for testing purposes (used for
// reftest-async-scroll and reftest-async-zoom).
@ -679,10 +668,6 @@ void APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
}
AsyncPanZoomController* scrollTargetApzc = it->second;
MOZ_ASSERT(scrollTargetApzc);
if (scrollTargetApzc->GetRenderRoot() != aRenderRoot) {
// If this APZC belongs to a different render root, skip over it
continue;
}
LayerToParentLayerMatrix4x4 transform =
scrollTargetApzc->CallWithLastContentPaintMetrics(
[&](const FrameMetrics& aMetrics) {
@ -703,10 +688,6 @@ void APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
bool activeAnimations = false;
for (const auto& mapping : mApzcMap) {
AsyncPanZoomController* apzc = mapping.second;
if (apzc->GetRenderRoot() != aRenderRoot) {
// If this APZC belongs to a different render root, skip over it
continue;
}
activeAnimations |= apzc->AdvanceAnimations(aSampleTime);
}
if (activeAnimations) {
@ -815,14 +796,13 @@ static EventRegionsOverride GetEventRegionsOverride(HitTestingTreeNode* aParent,
return result;
}
void APZCTreeManager::StartScrollbarDrag(const SLGuidAndRenderRoot& aGuid,
void APZCTreeManager::StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics) {
APZThreadUtils::AssertOnControllerThread();
RefPtr<AsyncPanZoomController> apzc =
GetTargetAPZC(aGuid.mScrollableLayerGuid);
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
if (!apzc) {
NotifyScrollbarDragRejected(aGuid.mScrollableLayerGuid);
NotifyScrollbarDragRejected(aGuid);
return;
}
@ -830,19 +810,18 @@ void APZCTreeManager::StartScrollbarDrag(const SLGuidAndRenderRoot& aGuid,
mInputQueue->ConfirmDragBlock(inputBlockId, apzc, aDragMetrics);
}
bool APZCTreeManager::StartAutoscroll(const SLGuidAndRenderRoot& aGuid,
bool APZCTreeManager::StartAutoscroll(const ScrollableLayerGuid& aGuid,
const ScreenPoint& aAnchorLocation) {
APZThreadUtils::AssertOnControllerThread();
RefPtr<AsyncPanZoomController> apzc =
GetTargetAPZC(aGuid.mScrollableLayerGuid);
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
if (!apzc) {
if (XRE_IsGPUProcess()) {
// If we're in the compositor process, the "return false" will be
// ignored because the query comes over the PAPZCTreeManager protocol
// via an async message. In this case, send an explicit rejection
// message to content.
NotifyAutoscrollRejected(aGuid.mScrollableLayerGuid);
NotifyAutoscrollRejected(aGuid);
}
return false;
}
@ -851,11 +830,10 @@ bool APZCTreeManager::StartAutoscroll(const SLGuidAndRenderRoot& aGuid,
return true;
}
void APZCTreeManager::StopAutoscroll(const SLGuidAndRenderRoot& aGuid) {
void APZCTreeManager::StopAutoscroll(const ScrollableLayerGuid& aGuid) {
APZThreadUtils::AssertOnControllerThread();
if (RefPtr<AsyncPanZoomController> apzc =
GetTargetAPZC(aGuid.mScrollableLayerGuid)) {
if (RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid)) {
apzc->StopAutoscroll();
}
}
@ -893,8 +871,7 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
const RecursiveMutexAutoLock& aProofOfTreeLock, const ScrollNode& aLayer,
const FrameMetrics& aMetrics, LayersId aLayersId,
const AncestorTransform& aAncestorTransform, HitTestingTreeNode* aParent,
HitTestingTreeNode* aNextSibling, TreeBuildingState& aState,
wr::RenderRoot aRenderRoot) {
HitTestingTreeNode* aNextSibling, TreeBuildingState& aState) {
bool needsApzc = true;
if (!aMetrics.IsScrollable()) {
needsApzc = false;
@ -1012,7 +989,7 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
// a destroyed APZC and so we need to throw that out and make a new one.
bool newApzc = (apzc == nullptr || apzc->IsDestroyed());
if (newApzc) {
apzc = NewAPZCInstance(aLayersId, geckoContentController, aRenderRoot);
apzc = NewAPZCInstance(aLayersId, geckoContentController);
apzc->SetCompositorController(aState.mCompositorController.get());
if (crossProcessSharingController) {
apzc->SetMetricsSharingController(crossProcessSharingController);
@ -1043,7 +1020,7 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
apzc, aLayer.GetLayer(), uint64_t(aLayersId), aMetrics.GetScrollId());
apzc->NotifyLayersUpdated(aLayer.Metadata(), aState.mIsFirstPaint,
WRRootId(aLayersId, aRenderRoot) == aState.mOriginatingWrRootId);
aLayersId == aState.mOriginatingLayersId);
// Since this is the first time we are encountering an APZC with this guid,
// the node holding it must be the primary holder. It may be newly-created
@ -1071,7 +1048,7 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
// that originated the update, because the only identifying information
// we are logging about APZCs is the scroll id, and otherwise we could
// confuse APZCs from different layer trees with the same scroll id.
if (aLayersId == aState.mOriginatingWrRootId.mLayersId) {
if (aLayersId == aState.mOriginatingLayersId) {
if (apzc->HasNoParentWithSameLayersId()) {
aState.mPaintLogger.LogTestData(aMetrics.GetScrollId(),
"hasNoParentWithSameLayersId", true);
@ -2099,15 +2076,14 @@ void APZCTreeManager::SetKeyboardMap(const KeyboardMap& aKeyboardMap) {
mKeyboardMap = aKeyboardMap;
}
void APZCTreeManager::ZoomToRect(const SLGuidAndRenderRoot& aGuid,
void APZCTreeManager::ZoomToRect(const ScrollableLayerGuid& aGuid,
const CSSRect& aRect, const uint32_t aFlags) {
// We could probably move this to run on the updater thread if needed, but
// either way we should restrict it to a single thread. For now let's use the
// controller thread.
APZThreadUtils::AssertOnControllerThread();
RefPtr<AsyncPanZoomController> apzc =
GetTargetAPZC(aGuid.mScrollableLayerGuid);
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
if (apzc) {
apzc->ZoomToRect(aRect, aFlags);
}
@ -2121,23 +2097,22 @@ void APZCTreeManager::ContentReceivedInputBlock(uint64_t aInputBlockId,
}
void APZCTreeManager::SetTargetAPZC(
uint64_t aInputBlockId, const nsTArray<SLGuidAndRenderRoot>& aTargets) {
uint64_t aInputBlockId, const nsTArray<ScrollableLayerGuid>& aTargets) {
APZThreadUtils::AssertOnControllerThread();
RefPtr<AsyncPanZoomController> target = nullptr;
if (aTargets.Length() > 0) {
target = GetTargetAPZC(aTargets[0].mScrollableLayerGuid);
target = GetTargetAPZC(aTargets[0]);
}
for (size_t i = 1; i < aTargets.Length(); i++) {
RefPtr<AsyncPanZoomController> apzc =
GetTargetAPZC(aTargets[i].mScrollableLayerGuid);
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aTargets[i]);
target = GetZoomableTarget(target, apzc);
}
mInputQueue->SetConfirmedTargetApzc(aInputBlockId, target);
}
void APZCTreeManager::UpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints) {
if (!GetUpdater()->IsUpdaterThread()) {
// This can happen if we're in the UI process and got a call directly from
@ -2147,8 +2122,8 @@ void APZCTreeManager::UpdateZoomConstraints(
// enabled, since the call will go over PAPZCTreeManager and arrive on the
// compositor thread in the GPU process.
GetUpdater()->RunOnUpdaterThread(
UpdaterQueueSelector(aGuid.GetWRRootId()),
NewRunnableMethod<SLGuidAndRenderRoot, Maybe<ZoomConstraints>>(
aGuid.mLayersId,
NewRunnableMethod<ScrollableLayerGuid, Maybe<ZoomConstraints>>(
"APZCTreeManager::UpdateZoomConstraints", this,
&APZCTreeManager::UpdateZoomConstraints, aGuid, aConstraints));
return;
@ -2156,9 +2131,8 @@ void APZCTreeManager::UpdateZoomConstraints(
AssertOnUpdaterThread();
ScrollableLayerGuid guid = aGuid.mScrollableLayerGuid;
RecursiveMutexAutoLock lock(mTreeLock);
RefPtr<HitTestingTreeNode> node = GetTargetNode(guid, nullptr);
RefPtr<HitTestingTreeNode> node = GetTargetNode(aGuid, nullptr);
MOZ_ASSERT(!node || node->GetApzc()); // any node returned must have an APZC
// Propagate the zoom constraints down to the subtree, stopping at APZCs
@ -2166,11 +2140,11 @@ void APZCTreeManager::UpdateZoomConstraints(
if (aConstraints) {
APZCTM_LOG("Recording constraints %s for guid %s\n",
Stringify(aConstraints.value()).c_str(),
Stringify(guid).c_str());
mZoomConstraints[guid] = aConstraints.ref();
Stringify(aGuid).c_str());
mZoomConstraints[aGuid] = aConstraints.ref();
} else {
APZCTM_LOG("Removing constraints for guid %s\n", Stringify(guid).c_str());
mZoomConstraints.erase(guid);
APZCTM_LOG("Removing constraints for guid %s\n", Stringify(aGuid).c_str());
mZoomConstraints.erase(aGuid);
}
if (node && aConstraints) {
ForEachNode<ReverseIterator>(
@ -2225,6 +2199,13 @@ void APZCTreeManager::FlushRepaintsToClearScreenToGeckoTransform() {
});
}
void APZCTreeManager::CancelAnimation(const ScrollableLayerGuid& aGuid) {
RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aGuid);
if (apzc) {
apzc->CancelAnimation();
}
}
void APZCTreeManager::AdjustScrollForSurfaceShift(const ScreenPoint& aShift) {
RecursiveMutexAutoLock lock(mTreeLock);
RefPtr<AsyncPanZoomController> apzc = FindRootContentOrRootApzc();
@ -2543,7 +2524,7 @@ already_AddRefed<AsyncPanZoomController> APZCTreeManager::GetAPZCAtPointWR(
MOZ_ASSERT(aOutScrollbarNode);
RefPtr<AsyncPanZoomController> result;
RefPtr<wr::WebRenderAPI> wr = GetWebRenderAPIAtPoint(aHitTestPoint);
RefPtr<wr::WebRenderAPI> wr = GetWebRenderAPI();
if (!wr) {
// If WebRender isn't running, fall back to the root APZC.
// This is mostly for the benefit of GTests which do not
@ -3190,26 +3171,12 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForNode(
return aNode->GetTransform() * AsyncTransformMatrix();
}
already_AddRefed<wr::WebRenderAPI> APZCTreeManager::GetWebRenderAPI(
wr::RenderRoot aRenderRoot) const {
already_AddRefed<wr::WebRenderAPI> APZCTreeManager::GetWebRenderAPI() const {
RefPtr<wr::WebRenderAPI> api;
CompositorBridgeParent::CallWithIndirectShadowTree(
mRootLayersId, [&](LayerTreeState& aState) -> void {
if (aState.mWrBridge) {
api = aState.mWrBridge->GetWebRenderAPI(aRenderRoot);
}
});
return api.forget();
}
already_AddRefed<wr::WebRenderAPI> APZCTreeManager::GetWebRenderAPIAtPoint(
const ScreenPoint& aPoint) const {
RefPtr<wr::WebRenderAPI> api;
CompositorBridgeParent::CallWithIndirectShadowTree(
mRootLayersId, [&](LayerTreeState& aState) -> void {
if (aState.mWrBridge) {
IntPoint point = RoundedToInt(aPoint).ToUnknownPoint();
api = aState.mWrBridge->GetWebRenderAPIAtPoint(point);
api = aState.mWrBridge->GetWebRenderAPI();
}
});
return api.forget();

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

@ -19,14 +19,14 @@
#include "mozilla/layers/APZTestData.h" // for APZTestData
#include "mozilla/layers/IAPZCTreeManager.h" // for IAPZCTreeManager
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/KeyboardMap.h" // for KeyboardMap
#include "mozilla/layers/TouchCounter.h" // for TouchCounter
#include "mozilla/layers/KeyboardMap.h" // for KeyboardMap
#include "mozilla/layers/TouchCounter.h" // for TouchCounter
#include "mozilla/layers/ZoomConstraints.h" // for ZoomConstraints
#include "mozilla/RecursiveMutex.h" // for RecursiveMutex
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "mozilla/RecursiveMutex.h" // for RecursiveMutex
#include "mozilla/RefPtr.h" // for RefPtr
#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp
#include "mozilla/UniquePtr.h" // for UniquePtr
#include "nsCOMPtr.h" // for already_AddRefed
#if defined(MOZ_WIDGET_ANDROID)
# include "mozilla/layers/AndroidDynamicToolbarAnimator.h"
@ -209,7 +209,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
*/
void UpdateHitTestingTree(LayersId aRootLayerTreeId,
const WebRenderScrollDataWrapper& aScrollWrapper,
bool aIsFirstPaint, WRRootId aOriginatingWrRootId,
bool aIsFirstPaint, LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber);
/**
@ -219,14 +219,9 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* another composite if there are still active animations.
* In effect it is the webrender equivalent of (part of) the code in
* AsyncCompositionManager.
* In the WebRender world a single "layer tree" might get split into multiple
* render roots; the aRenderRoot argument indicates which render root we are
* sampling in this call. The transaction should only be updated with samples
* from APZC instances in that render root.
*/
void SampleForWebRender(wr::TransactionWrapper& aTxn,
const TimeStamp& aSampleTime,
wr::RenderRoot aRenderRoot);
const TimeStamp& aSampleTime);
/**
* General handler for incoming input events. Manipulates the frame metrics
@ -277,7 +272,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* up. |aRect| must be given in CSS pixels, relative to the document.
* |aFlags| is a combination of the ZoomToRectBehavior enum values.
*/
void ZoomToRect(const SLGuidAndRenderRoot& aGuid, const CSSRect& aRect,
void ZoomToRect(const ScrollableLayerGuid& aGuid, const CSSRect& aRect,
const uint32_t aFlags = DEFAULT_BEHAVIOR) override;
/**
@ -309,7 +304,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* arrive.
*/
void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) override;
const nsTArray<ScrollableLayerGuid>& aTargets) override;
/**
* Updates any zoom constraints contained in the <meta name="viewport"> tag.
@ -317,9 +312,14 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* the given |aGuid| are cleared.
*/
void UpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints) override;
/**
* Cancels any currently running animation.
*/
void CancelAnimation(const ScrollableLayerGuid& aGuid);
/**
* Adjusts the root APZC to compensate for a shift in the surface. See the
* documentation on AsyncPanZoomController::AdjustScrollForSurfaceShift for
@ -463,13 +463,13 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
ParentLayerPoint DispatchFling(AsyncPanZoomController* aApzc,
const FlingHandoffState& aHandoffState);
void StartScrollbarDrag(const SLGuidAndRenderRoot& aGuid,
void StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics) override;
bool StartAutoscroll(const SLGuidAndRenderRoot& aGuid,
bool StartAutoscroll(const ScrollableLayerGuid& aGuid,
const ScreenPoint& aAnchorLocation) override;
void StopAutoscroll(const SLGuidAndRenderRoot& aGuid) override;
void StopAutoscroll(const ScrollableLayerGuid& aGuid) override;
/*
* Build the chain of APZCs that will handle overscroll for a pan starting at
@ -549,20 +549,10 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
// Assert that the current thread is the updater thread for this APZCTM.
void AssertOnUpdaterThread();
// Returns a pointer to the WebRenderAPI this APZCTreeManager is for, for
// the provided RenderRoot (since an APZCTreeManager can cover multiple
// RenderRoots). This might be null (for example, if WebRender is not
// enabled).
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI(
wr::RenderRoot aRenderRoot) const;
// Returns a pointer to the root WebRenderAPI for the RenderRoot that owns
// the given point. For example, if aPoint is in the content area and
// RenderRoot splitting is enabled, this will return the WebRenderAPI for
// the Content RenderRoot.
// This might be null (for example, if WebRender is not enabled).
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPIAtPoint(
const ScreenPoint& aPoint) const;
// Returns a pointer to the WebRenderAPI for the root layers id this
// APZCTreeManager is for. This might be null (for example, if WebRender is
// not enabled).
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI() const;
protected:
// Protected destructor, to discourage deletion outside of Release():
@ -581,8 +571,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
// Protected hooks for gtests subclass
virtual AsyncPanZoomController* NewAPZCInstance(
LayersId aLayersId, GeckoContentController* aController,
wr::RenderRoot aRenderRoot);
LayersId aLayersId, GeckoContentController* aController);
public:
// Public hooks for gtests subclass
@ -636,7 +625,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
template <class ScrollNode>
void UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId,
const ScrollNode& aRoot, bool aIsFirstPaint,
WRRootId aOriginatingWrRootId,
LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber);
void AttachNodeToTree(HitTestingTreeNode* aNode, HitTestingTreeNode* aParent,
@ -739,8 +728,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
const RecursiveMutexAutoLock& aProofOfTreeLock, const ScrollNode& aLayer,
const FrameMetrics& aMetrics, LayersId aLayersId,
const AncestorTransform& aAncestorTransform, HitTestingTreeNode* aParent,
HitTestingTreeNode* aNextSibling, TreeBuildingState& aState,
wr::RenderRoot aRenderRoot);
HitTestingTreeNode* aNextSibling, TreeBuildingState& aState);
template <class ScrollNode>
void PrintAPZCInfo(const ScrollNode& aLayer,

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

@ -66,11 +66,10 @@ void APZSampler::SetSamplerThread(const wr::WrWindowId& aWindowId) {
/*static*/
void APZSampler::SampleForWebRender(const wr::WrWindowId& aWindowId,
wr::Transaction* aTransaction,
const wr::DocumentId& aRenderRootId) {
wr::Transaction* aTransaction) {
if (RefPtr<APZSampler> sampler = GetSampler(aWindowId)) {
wr::TransactionWrapper txn(aTransaction);
sampler->SampleForWebRender(txn, wr::RenderRootFromId(aRenderRootId));
sampler->SampleForWebRender(txn);
}
}
@ -80,8 +79,7 @@ void APZSampler::SetSampleTime(const TimeStamp& aSampleTime) {
mSampleTime = aSampleTime;
}
void APZSampler::SampleForWebRender(wr::TransactionWrapper& aTxn,
wr::RenderRoot aRenderRoot) {
void APZSampler::SampleForWebRender(wr::TransactionWrapper& aTxn) {
AssertOnSamplerThread();
TimeStamp sampleTime;
{ // scope lock
@ -93,7 +91,7 @@ void APZSampler::SampleForWebRender(wr::TransactionWrapper& aTxn,
// anyway, so using Timestamp::Now() should be fine.
sampleTime = mSampleTime.IsNull() ? TimeStamp::Now() : mSampleTime;
}
mApz->SampleForWebRender(aTxn, sampleTime, aRenderRoot);
mApz->SampleForWebRender(aTxn, sampleTime);
}
bool APZSampler::SampleAnimations(const LayerMetricsWrapper& aLayer,
@ -272,10 +270,8 @@ void apz_register_sampler(mozilla::wr::WrWindowId aWindowId) {
}
void apz_sample_transforms(mozilla::wr::WrWindowId aWindowId,
mozilla::wr::Transaction* aTransaction,
mozilla::wr::DocumentId aDocumentId) {
mozilla::layers::APZSampler::SampleForWebRender(aWindowId, aTransaction,
aDocumentId);
mozilla::wr::Transaction* aTransaction) {
mozilla::layers::APZSampler::SampleForWebRender(aWindowId, aTransaction);
}
void apz_deregister_sampler(mozilla::wr::WrWindowId aWindowId) {}

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

@ -89,8 +89,7 @@ void APZUpdater::CompleteSceneSwap(const wr::WrWindowId& aWindowId,
}
for (uintptr_t i = 0; i < aInfo.removed_pipelines.length; i++) {
WRRootId layersId = WRRootId(aInfo.removed_pipelines.data[i].pipeline_id,
aInfo.removed_pipelines.data[i].document_id);
LayersId layersId = wr::AsLayersId(aInfo.removed_pipelines.data[i]);
updater->mEpochData.erase(layersId);
}
// Reset the built info for all pipelines, then put it back for the ones
@ -99,8 +98,7 @@ void APZUpdater::CompleteSceneSwap(const wr::WrWindowId& aWindowId,
i.second.mBuilt = Nothing();
}
for (uintptr_t i = 0; i < aInfo.epochs.length; i++) {
WRRootId layersId = WRRootId(aInfo.epochs.data[i].pipeline_id,
aInfo.epochs.data[i].document_id);
LayersId layersId = wr::AsLayersId(aInfo.epochs.data[i].pipeline_id);
updater->mEpochData[layersId].mBuilt = Some(aInfo.epochs.data[i].epoch);
}
@ -133,53 +131,46 @@ void APZUpdater::ProcessPendingTasks(const wr::WrWindowId& aWindowId) {
void APZUpdater::ClearTree(LayersId aRootLayersId) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZUpdater> self = this;
RunOnUpdaterThread(
UpdaterQueueSelector(aRootLayersId, wr::RenderRoot::Default),
NS_NewRunnableFunction("APZUpdater::ClearTree", [=]() {
self->mApz->ClearTree();
RunOnUpdaterThread(aRootLayersId,
NS_NewRunnableFunction("APZUpdater::ClearTree", [=]() {
self->mApz->ClearTree();
// Once ClearTree is called on the APZCTreeManager, we
// are in a shutdown phase. After this point it's ok if
// WebRender cannot get a hold of the updater via the
// window id, and it's a good point to remove the mapping
// and avoid leaving a dangling pointer to this object.
StaticMutexAutoLock lock(sWindowIdLock);
if (self->mWindowId) {
MOZ_ASSERT(sWindowIdMap);
sWindowIdMap->erase(wr::AsUint64(*(self->mWindowId)));
}
}));
// Once ClearTree is called on the APZCTreeManager, we
// are in a shutdown phase. After this point it's ok if
// WebRender cannot get a hold of the updater via the
// window id, and it's a good point to remove the mapping
// and avoid leaving a dangling pointer to this object.
StaticMutexAutoLock lock(sWindowIdLock);
if (self->mWindowId) {
MOZ_ASSERT(sWindowIdMap);
sWindowIdMap->erase(wr::AsUint64(*(self->mWindowId)));
}
}));
}
void APZUpdater::UpdateFocusState(LayersId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
LayersId aOriginatingLayersId,
const FocusTarget& aFocusTarget) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
UpdaterQueueSelector selector(aOriginatingWrRootId);
if (aFocusTarget.mData.is<FocusTarget::ScrollTargets>()) {
const FocusTarget::ScrollTargets& targets = aFocusTarget.mData.as<FocusTarget::ScrollTargets>();
selector.mRenderRoots += targets.mHorizontalRenderRoot;
selector.mRenderRoots += targets.mVerticalRenderRoot;
}
RunOnUpdaterThread(selector,
RunOnUpdaterThread(aOriginatingLayersId,
NewRunnableMethod<LayersId, LayersId, FocusTarget>(
"APZUpdater::UpdateFocusState", mApz,
&APZCTreeManager::UpdateFocusState, aRootLayerTreeId,
aOriginatingWrRootId.mLayersId, aFocusTarget));
aOriginatingLayersId, aFocusTarget));
}
void APZUpdater::UpdateHitTestingTree(LayersId aRootLayerTreeId, Layer* aRoot,
bool aIsFirstPaint,
LayersId aOriginatingWrRootId,
LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
AssertOnUpdaterThread();
mApz->UpdateHitTestingTree(aRootLayerTreeId, aRoot, aIsFirstPaint,
aOriginatingWrRootId, aPaintSequenceNumber);
aOriginatingLayersId, aPaintSequenceNumber);
}
void APZUpdater::UpdateScrollDataAndTreeState(
WRRootId aRootLayerTreeId, WRRootId aOriginatingWrRootId,
LayersId aRootLayerTreeId, LayersId aOriginatingLayersId,
const wr::Epoch& aEpoch, WebRenderScrollData&& aScrollData) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZUpdater> self = this;
@ -189,92 +180,91 @@ void APZUpdater::UpdateScrollDataAndTreeState(
// UpdateHitTestingTree call below needs to wait until the epoch requirement
// is satisfied, which is why it is a separate task in the queue.
RunOnUpdaterThread(
UpdaterQueueSelector(aOriginatingWrRootId),
aOriginatingLayersId,
NS_NewRunnableFunction("APZUpdater::UpdateEpochRequirement", [=]() {
if (aRootLayerTreeId == aOriginatingWrRootId) {
self->mEpochData[aOriginatingWrRootId].mIsRoot = true;
if (aRootLayerTreeId == aOriginatingLayersId) {
self->mEpochData[aOriginatingLayersId].mIsRoot = true;
}
self->mEpochData[aOriginatingWrRootId].mRequired = aEpoch;
self->mEpochData[aOriginatingLayersId].mRequired = aEpoch;
}));
RunOnUpdaterThread(
UpdaterQueueSelector(aOriginatingWrRootId),
aOriginatingLayersId,
NS_NewRunnableFunction(
"APZUpdater::UpdateHitTestingTree",
[=, aScrollData = std::move(aScrollData)]() {
self->mScrollData[aOriginatingWrRootId] = aScrollData;
self->mApz->UpdateFocusState(aRootLayerTreeId, aOriginatingLayersId,
aScrollData.GetFocusTarget());
self->mScrollData[aOriginatingLayersId] = aScrollData;
auto root = self->mScrollData.find(aRootLayerTreeId);
if (root == self->mScrollData.end()) {
return;
}
self->mApz->UpdateHitTestingTree(
aRootLayerTreeId.mLayersId,
WebRenderScrollDataWrapper(*self, aRootLayerTreeId,
&(root->second)),
aScrollData.IsFirstPaint(), aOriginatingWrRootId,
aRootLayerTreeId,
WebRenderScrollDataWrapper(*self, &(root->second)),
aScrollData.IsFirstPaint(), aOriginatingLayersId,
aScrollData.GetPaintSequenceNumber());
}));
}
void APZUpdater::UpdateScrollOffsets(WRRootId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
void APZUpdater::UpdateScrollOffsets(LayersId aRootLayerTreeId,
LayersId aOriginatingLayersId,
ScrollUpdatesMap&& aUpdates,
uint32_t aPaintSequenceNumber) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZUpdater> self = this;
RunOnUpdaterThread(UpdaterQueueSelector(aOriginatingWrRootId),
NS_NewRunnableFunction(
"APZUpdater::UpdateScrollOffsets",
[=, updates = std::move(aUpdates)]() {
self->mScrollData[aOriginatingWrRootId].ApplyUpdates(
updates, aPaintSequenceNumber);
auto root = self->mScrollData.find(aRootLayerTreeId);
if (root == self->mScrollData.end()) {
return;
}
self->mApz->UpdateHitTestingTree(
aRootLayerTreeId.mLayersId,
WebRenderScrollDataWrapper(
*self, aRootLayerTreeId, &(root->second)),
/*isFirstPaint*/ false,
aOriginatingWrRootId,
aPaintSequenceNumber);
}));
RunOnUpdaterThread(
aOriginatingLayersId,
NS_NewRunnableFunction(
"APZUpdater::UpdateScrollOffsets",
[=, updates = std::move(aUpdates)]() {
self->mScrollData[aOriginatingLayersId].ApplyUpdates(
updates, aPaintSequenceNumber);
auto root = self->mScrollData.find(aRootLayerTreeId);
if (root == self->mScrollData.end()) {
return;
}
self->mApz->UpdateHitTestingTree(
aRootLayerTreeId,
WebRenderScrollDataWrapper(*self, &(root->second)),
/*isFirstPaint*/ false, aOriginatingLayersId,
aPaintSequenceNumber);
}));
}
void APZUpdater::NotifyLayerTreeAdopted(WRRootId aWrRootId,
void APZUpdater::NotifyLayerTreeAdopted(LayersId aLayersId,
const RefPtr<APZUpdater>& aOldUpdater) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RunOnUpdaterThread(
UpdaterQueueSelector(aWrRootId),
NewRunnableMethod<LayersId, RefPtr<APZCTreeManager>>(
"APZUpdater::NotifyLayerTreeAdopted", mApz,
&APZCTreeManager::NotifyLayerTreeAdopted, aWrRootId.mLayersId,
aOldUpdater ? aOldUpdater->mApz : nullptr));
RunOnUpdaterThread(aLayersId,
NewRunnableMethod<LayersId, RefPtr<APZCTreeManager>>(
"APZUpdater::NotifyLayerTreeAdopted", mApz,
&APZCTreeManager::NotifyLayerTreeAdopted, aLayersId,
aOldUpdater ? aOldUpdater->mApz : nullptr));
}
void APZUpdater::NotifyLayerTreeRemoved(WRRootId aWrRootId) {
void APZUpdater::NotifyLayerTreeRemoved(LayersId aLayersId) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZUpdater> self = this;
RunOnUpdaterThread(
UpdaterQueueSelector(aWrRootId),
aLayersId,
NS_NewRunnableFunction("APZUpdater::NotifyLayerTreeRemoved", [=]() {
self->mEpochData.erase(aWrRootId);
self->mScrollData.erase(aWrRootId);
self->mApz->NotifyLayerTreeRemoved(aWrRootId.mLayersId);
self->mEpochData.erase(aLayersId);
self->mScrollData.erase(aLayersId);
self->mApz->NotifyLayerTreeRemoved(aLayersId);
}));
}
bool APZUpdater::GetAPZTestData(WRRootId aWrRootId, APZTestData* aOutData) {
bool APZUpdater::GetAPZTestData(LayersId aLayersId, APZTestData* aOutData) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZCTreeManager> apz = mApz;
bool ret = false;
SynchronousTask waiter("APZUpdater::GetAPZTestData");
RunOnUpdaterThread(
UpdaterQueueSelector(aWrRootId),
NS_NewRunnableFunction("APZUpdater::GetAPZTestData", [&]() {
aLayersId, NS_NewRunnableFunction("APZUpdater::GetAPZTestData", [&]() {
AutoCompleteTask notifier(&waiter);
ret = apz->GetAPZTestData(aWrRootId.mLayersId, aOutData);
ret = apz->GetAPZTestData(aLayersId, aOutData);
}));
// Wait until the task posted above has run and populated aOutData and ret
@ -284,15 +274,15 @@ bool APZUpdater::GetAPZTestData(WRRootId aWrRootId, APZTestData* aOutData) {
}
void APZUpdater::SetTestAsyncScrollOffset(
WRRootId aWrRootId, const ScrollableLayerGuid::ViewID& aScrollId,
LayersId aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aOffset) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZCTreeManager> apz = mApz;
RunOnUpdaterThread(
UpdaterQueueSelector(aWrRootId),
aLayersId,
NS_NewRunnableFunction("APZUpdater::SetTestAsyncScrollOffset", [=]() {
RefPtr<AsyncPanZoomController> apzc =
apz->GetTargetAPZC(aWrRootId.mLayersId, aScrollId);
apz->GetTargetAPZC(aLayersId, aScrollId);
if (apzc) {
apzc->SetTestAsyncScrollOffset(aOffset);
} else {
@ -301,16 +291,15 @@ void APZUpdater::SetTestAsyncScrollOffset(
}));
}
void APZUpdater::SetTestAsyncZoom(WRRootId aWrRootId,
void APZUpdater::SetTestAsyncZoom(LayersId aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<APZCTreeManager> apz = mApz;
RunOnUpdaterThread(
UpdaterQueueSelector(aWrRootId),
NS_NewRunnableFunction("APZUpdater::SetTestAsyncZoom", [=]() {
aLayersId, NS_NewRunnableFunction("APZUpdater::SetTestAsyncZoom", [=]() {
RefPtr<AsyncPanZoomController> apzc =
apz->GetTargetAPZC(aWrRootId.mLayersId, aScrollId);
apz->GetTargetAPZC(aLayersId, aScrollId);
if (apzc) {
apzc->SetTestAsyncZoom(aZoom);
} else {
@ -319,9 +308,9 @@ void APZUpdater::SetTestAsyncZoom(WRRootId aWrRootId,
}));
}
const WebRenderScrollData* APZUpdater::GetScrollData(WRRootId aWrRootId) const {
const WebRenderScrollData* APZUpdater::GetScrollData(LayersId aLayersId) const {
AssertOnUpdaterThread();
auto it = mScrollData.find(aWrRootId);
auto it = mScrollData.find(aLayersId);
return (it == mScrollData.end() ? nullptr : &(it->second));
}
@ -331,7 +320,7 @@ void APZUpdater::AssertOnUpdaterThread() const {
}
}
void APZUpdater::RunOnUpdaterThread(UpdaterQueueSelector aSelector,
void APZUpdater::RunOnUpdaterThread(LayersId aLayersId,
already_AddRefed<Runnable> aTask) {
RefPtr<Runnable> task = aTask;
@ -356,61 +345,22 @@ void APZUpdater::RunOnUpdaterThread(UpdaterQueueSelector aSelector,
bool sendWakeMessage = true;
{ // scope lock
MutexAutoLock lock(mQueueLock);
wr::RenderRootSet alreadyWoken;
// What we're doing here is trying to avoid sending redundant
// WakeSceneBuilder messages. If another task exists with our
// layersId/renderRoots combination, then we know that either that message
// is going to be processed soon, or it's blocked on an epoch update, and
// in both of those cases sending a WakeSceneBuilder message won't do
// anything, and our message is destined to be blocked behind it. However,
// imagine the following queue (assume everything as the same layersId):
//
// q[0] (A)
// q[1] (A,B)
// q[2] -> (B,C) // This is what we want to put in the queue
//
// We could go two routes in this case: (I) elide the WakeSceneBuilder
// message if *any* of our renderRoots are already present in q, since we
// won't go until they're all unblocked, or (II) elide it only if *all* of
// our renderRoots are already present in q.
//
// If we go with (I), then if A needs an epoch update, adding (B,C)
// wouldn't send a WakeSceneBuilder message because (A,B) is in the queue
// (intersecting on B). But since (A,B) is only blocked on an epoch update
// for A, (B,C) *could* run if we sent a wake message. Thus, (I) means:
// - Fewer spurious WakeSceneBuilder messages
// - Potential for unnecessarily blocking certain messages
//
// If we went with (II), then (B,C) would run as early as possible, but we
// would send WakeSceneBuilder messages for all three items in the queue.
// Thus, (II) means:
// - More spurious WakeSceneBuilderMessages
// - Potential for violating people's ordering assumptions (i.e., that
// q[2] would run
// after q[1])
//
// We're electing to go with option (II), but we might revisit it if/when
// we have more than two documents. (Because it doesn't matter much before
// then.)
for (const auto& queuedTask : mUpdaterQueue) {
if (queuedTask.mSelector.mLayersId == aSelector.mLayersId) {
alreadyWoken +=
(queuedTask.mSelector.mRenderRoots & aSelector.mRenderRoots);
if (queuedTask.mLayersId == aLayersId) {
// If there's already a task in the queue with this layers id, then
// we must have previously sent a WakeSceneBuilder message (when
// adding the first task with this layers id to the queue). Either
// that hasn't been fully processed yet, or the layers id is blocked
// waiting for an epoch - in either case there's no point in sending
// another WakeSceneBuilder message.
sendWakeMessage = false;
break;
}
}
if (alreadyWoken == aSelector.mRenderRoots) {
sendWakeMessage = false;
}
mUpdaterQueue.push_back(QueuedTask{aSelector, task});
mUpdaterQueue.push_back(QueuedTask{aLayersId, task});
}
if (sendWakeMessage) {
// All the RenderRoots share a single scene builder thread, so we can
// just send the message to the default RenderRoot's API instead of
// sending one for each unwoken RenderRoot.
RefPtr<wr::WebRenderAPI> api =
mApz->GetWebRenderAPI(wr::RenderRoot::Default);
RefPtr<wr::WebRenderAPI> api = mApz->GetWebRenderAPI();
if (api) {
api->WakeSceneBuilder();
} else {
@ -445,13 +395,13 @@ bool APZUpdater::IsUpdaterThread() const {
return CompositorThreadHolder::IsInCompositorThread();
}
void APZUpdater::RunOnControllerThread(UpdaterQueueSelector aSelector,
void APZUpdater::RunOnControllerThread(LayersId aLayersId,
already_AddRefed<Runnable> aTask) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
RefPtr<Runnable> task = aTask;
RunOnUpdaterThread(aSelector,
RunOnUpdaterThread(aLayersId,
NewRunnableFunction("APZUpdater::RunOnControllerThread",
&APZThreadUtils::RunOnControllerThread,
std::move(task)));
@ -500,22 +450,14 @@ void APZUpdater::ProcessQueue() {
}
// We check the task to see if it is blocked. Note that while this
// ProcessQueue function is executing, a particular WRRoot id cannot go
// ProcessQueue function is executing, a particular layers is cannot go
// from blocked to unblocked, because only CompleteSceneSwap can unblock
// a WRRoot id, and that also runs on the updater thread. If somehow
// a WRRoot id gets unblocked while we're processing the queue, then it
// a layers id, and that also runs on the updater thread. If somehow
// a layers id gets unblocked while we're processing the queue, then it
// might result in tasks getting executed out of order.
bool blocked = false;
for (wr::RenderRoot root : task.mSelector.mRenderRoots) {
WRRootId selector = WRRootId(task.mSelector.mLayersId, root);
auto it = mEpochData.find(selector);
if (it != mEpochData.end() && it->second.IsBlocked()) {
blocked = true;
break;
}
}
if (blocked) {
auto it = mEpochData.find(task.mLayersId);
if (it != mEpochData.end() && it->second.IsBlocked()) {
// If this task is blocked, put it into the blockedTasks queue that
// we will replace mUpdaterQueue with
blockedTasks.push_back(task);

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

@ -795,10 +795,8 @@ void AsyncPanZoomController::InitializeGlobalState() {
AsyncPanZoomController::AsyncPanZoomController(
LayersId aLayersId, APZCTreeManager* aTreeManager,
const RefPtr<InputQueue>& aInputQueue,
GeckoContentController* aGeckoContentController, wr::RenderRoot aRenderRoot,
GestureBehavior aGestures)
GeckoContentController* aGeckoContentController, GestureBehavior aGestures)
: mLayersId(aLayersId),
mRenderRoot(aRenderRoot),
mGeckoContentController(aGeckoContentController),
mRefPtrMonitor("RefPtrMonitor"),
// mTreeManager must be initialized before GetFrameTime() is called

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

@ -46,7 +46,6 @@ namespace layers {
class AsyncDragMetrics;
class APZCTreeManager;
struct ScrollableLayerGuid;
struct SLGuidAndRenderRoot;
class CompositorController;
class MetricsSharingController;
class GestureEventListener;
@ -195,7 +194,6 @@ class AsyncPanZoomController {
AsyncPanZoomController(LayersId aLayersId, APZCTreeManager* aTreeManager,
const RefPtr<InputQueue>& aInputQueue,
GeckoContentController* aController,
wr::RenderRoot aRenderRoot,
GestureBehavior aGestures = DEFAULT_GESTURES);
// --------------------------------------------------------------------------
@ -898,7 +896,6 @@ class AsyncPanZoomController {
void OnTouchEndOrCancel();
LayersId mLayersId;
wr::RenderRoot mRenderRoot;
RefPtr<CompositorController> mCompositorController;
RefPtr<MetricsSharingController> mMetricsSharingController;
@ -1601,8 +1598,6 @@ class AsyncPanZoomController {
LayersId GetLayersId() const { return mLayersId; }
wr::RenderRoot GetRenderRoot() const { return mRenderRoot; }
private:
// Extra offset to add to the async scroll position for testing
CSSPoint mTestAsyncScrollOffset;

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

@ -221,19 +221,6 @@ FocusTarget::FocusTarget(nsIPresShell* aRootPresShell,
ScrollTargets target;
target.mHorizontal = nsLayoutUtils::FindIDForScrollableFrame(horizontal);
target.mVertical = nsLayoutUtils::FindIDForScrollableFrame(vertical);
if (XRE_IsContentProcess()) {
target.mHorizontalRenderRoot = gfxUtils::GetContentRenderRoot();
target.mVerticalRenderRoot = gfxUtils::GetContentRenderRoot();
} else {
target.mHorizontalRenderRoot =
horizontal ? gfxUtils::RecursivelyGetRenderRootForFrame(
horizontal->GetScrolledFrame())
: wr::RenderRoot::Default;
target.mVerticalRenderRoot =
vertical ? gfxUtils::RecursivelyGetRenderRootForFrame(
vertical->GetScrolledFrame())
: wr::RenderRoot::Default;
}
mData = AsVariant(target);
FT_LOG("Creating scroll target with seq=%" PRIu64 ", kl=%d, h=%" PRIu64

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

@ -11,7 +11,6 @@
#include "mozilla/DefineEnum.h" // for MOZ_DEFINE_ENUM
#include "mozilla/layers/ScrollableLayerGuid.h" // for ViewID
#include "mozilla/webrender/WebRenderTypes.h" // for RenderRoot
#include "mozilla/Variant.h" // for Variant
class nsIPresShell;
@ -29,21 +28,10 @@ class FocusTarget final {
public:
struct ScrollTargets {
ScrollableLayerGuid::ViewID mHorizontal;
wr::RenderRoot mHorizontalRenderRoot;
ScrollableLayerGuid::ViewID mVertical;
wr::RenderRoot mVerticalRenderRoot;
bool operator==(const ScrollTargets& aRhs) const {
bool ret =
(mHorizontal == aRhs.mHorizontal && mVertical == aRhs.mVertical);
if (ret) {
// The render root is a function of where the scrollable frame is in
// the DOM/layout tree, so if the ViewIDs match then the render roots
// should also match.
MOZ_ASSERT(mHorizontalRenderRoot == aRhs.mHorizontalRenderRoot &&
mVerticalRenderRoot == aRhs.mVerticalRenderRoot);
}
return ret;
return mHorizontal == aRhs.mHorizontal && mVertical == aRhs.mVertical;
}
};

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

@ -33,9 +33,7 @@ class APZCBasicTester : public APZCTesterBase {
updater = new APZUpdater(tm, false);
sampler = new APZSampler(tm, false);
apzc =
new TestAsyncPanZoomController(LayersId{0}, mcc, tm,
wr::RenderRoot::Default,
mGestureBehavior);
new TestAsyncPanZoomController(LayersId{0}, mcc, tm, mGestureBehavior);
apzc->SetFrameMetrics(TestFrameMetrics());
apzc->GetScrollMetadata().SetIsLayersIdRoot(true);
}

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

@ -221,21 +221,9 @@ class TestAPZCTreeManager : public APZCTreeManager {
**/
void CancelAnimation() { EXPECT_TRUE(false); }
using APZCTreeManager::SetTargetAPZC; // silence clang warning about overload
void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<ScrollableLayerGuid>& aTargets) {
nsTArray<SLGuidAndRenderRoot> wrapped;
for (const ScrollableLayerGuid& target : aTargets) {
wrapped.AppendElement(
SLGuidAndRenderRoot(target, wr::RenderRoot::Default));
}
this->SetTargetAPZC(aInputBlockId, wrapped);
}
protected:
AsyncPanZoomController* NewAPZCInstance(LayersId aLayersId,
GeckoContentController* aController,
wr::RenderRoot aRenderRoot) override;
AsyncPanZoomController* NewAPZCInstance(
LayersId aLayersId, GeckoContentController* aController) override;
TimeStamp GetFrameTime() override { return mcc->Time(); }
@ -248,11 +236,9 @@ class TestAsyncPanZoomController : public AsyncPanZoomController {
TestAsyncPanZoomController(LayersId aLayersId,
MockContentControllerDelayed* aMcc,
TestAPZCTreeManager* aTreeManager,
wr::RenderRoot aRenderRoot,
GestureBehavior aBehavior = DEFAULT_GESTURES)
: AsyncPanZoomController(aLayersId, aTreeManager,
aTreeManager->GetInputQueue(), aMcc, aRenderRoot,
aBehavior),
aTreeManager->GetInputQueue(), aMcc, aBehavior),
mWaitForMainThread(false),
mcc(aMcc) {}
@ -887,13 +873,11 @@ void APZCTesterBase::PinchWithPinchInputAndCheckStatus(
}
AsyncPanZoomController* TestAPZCTreeManager::NewAPZCInstance(
LayersId aLayersId, GeckoContentController* aController,
wr::RenderRoot aRenderRoot) {
LayersId aLayersId, GeckoContentController* aController) {
MockContentControllerDelayed* mcc =
static_cast<MockContentControllerDelayed*>(aController);
return new TestAsyncPanZoomController(
aLayersId, mcc, this, aRenderRoot,
AsyncPanZoomController::USE_GESTURE_DETECTOR);
aLayersId, mcc, this, AsyncPanZoomController::USE_GESTURE_DETECTOR);
}
inline FrameMetrics TestFrameMetrics() {

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

@ -59,8 +59,7 @@ TEST_F(APZCBasicTester, ComplexTransform) {
// sides.
RefPtr<TestAsyncPanZoomController> childApzc =
new TestAsyncPanZoomController(LayersId{0}, mcc, tm,
wr::RenderRoot::Default);
new TestAsyncPanZoomController(LayersId{0}, mcc, tm);
const char* layerTreeSyntax = "c(c)";
// LayerID 0 1

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

@ -666,10 +666,9 @@ using FrameForPointOption = nsLayoutUtils::FrameForPointOption;
static bool PrepareForSetTargetAPZCNotification(
nsIWidget* aWidget, const ScrollableLayerGuid& aGuid, nsIFrame* aRootFrame,
const LayoutDeviceIntPoint& aRefPoint,
nsTArray<SLGuidAndRenderRoot>* aTargets) {
SLGuidAndRenderRoot guid(aGuid.mLayersId, 0,
ScrollableLayerGuid::NULL_SCROLL_ID,
wr::RenderRoot::Default);
nsTArray<ScrollableLayerGuid>* aTargets) {
ScrollableLayerGuid guid(aGuid.mLayersId, 0,
ScrollableLayerGuid::NULL_SCROLL_ID);
nsPoint point = nsLayoutUtils::GetEventCoordinatesRelativeTo(
aWidget, aRefPoint, aRootFrame);
EnumSet<FrameForPointOption> options;
@ -692,12 +691,6 @@ static bool PrepareForSetTargetAPZCNotification(
scrollAncestor ? GetDisplayportElementFor(scrollAncestor)
: GetRootDocumentElementFor(aWidget);
if (XRE_IsContentProcess()) {
guid.mRenderRoot = gfxUtils::GetContentRenderRoot();
} else {
guid.mRenderRoot = gfxUtils::RecursivelyGetRenderRootForElement(dpElement);
}
#ifdef APZCCH_LOGGING
nsAutoString dpElementDesc;
if (dpElement) {
@ -709,8 +702,7 @@ static bool PrepareForSetTargetAPZCNotification(
#endif
bool guidIsValid = APZCCallbackHelper::GetOrCreateScrollIdentifiers(
dpElement, &(guid.mScrollableLayerGuid.mPresShellId),
&(guid.mScrollableLayerGuid.mScrollId));
dpElement, &(guid.mPresShellId), &(guid.mScrollId));
aTargets->AppendElement(guid);
if (!guidIsValid || nsLayoutUtils::HasDisplayPort(dpElement)) {
@ -744,7 +736,7 @@ static bool PrepareForSetTargetAPZCNotification(
static void SendLayersDependentApzcTargetConfirmation(
nsIPresShell* aShell, uint64_t aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) {
const nsTArray<ScrollableLayerGuid>& aTargets) {
LayerManager* lm = aShell->GetLayerManager();
if (!lm) {
return;
@ -774,7 +766,7 @@ static void SendLayersDependentApzcTargetConfirmation(
DisplayportSetListener::DisplayportSetListener(
nsIWidget* aWidget, nsIPresShell* aPresShell, const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets)
const nsTArray<ScrollableLayerGuid>& aTargets)
: mWidget(aWidget),
mPresShell(aPresShell),
mInputBlockId(aInputBlockId),
@ -843,7 +835,7 @@ APZCCallbackHelper::SendSetTargetAPZCNotification(
rootFrame = UpdateRootFrameForTouchTargetDocument(rootFrame);
bool waitForRefresh = false;
nsTArray<SLGuidAndRenderRoot> targets;
nsTArray<ScrollableLayerGuid> targets;
if (const WidgetTouchEvent* touchEvent = aEvent.AsTouchEvent()) {
for (size_t i = 0; i < touchEvent->mTouches.Length(); i++) {

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

@ -37,7 +37,7 @@ class DisplayportSetListener : public nsAPostRefreshObserver {
public:
DisplayportSetListener(nsIWidget* aWidget, nsIPresShell* aPresShell,
const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets);
const nsTArray<ScrollableLayerGuid>& aTargets);
virtual ~DisplayportSetListener();
bool Register();
void DidRefresh() override;
@ -46,7 +46,7 @@ class DisplayportSetListener : public nsAPostRefreshObserver {
RefPtr<nsIWidget> mWidget;
RefPtr<nsIPresShell> mPresShell;
uint64_t mInputBlockId;
nsTArray<SLGuidAndRenderRoot> mTargets;
nsTArray<ScrollableLayerGuid> mTargets;
};
/* This class contains some helper methods that facilitate implementing the

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

@ -151,11 +151,10 @@ void ChromeProcessController::HandleDoubleTap(
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
document->GetDocumentElement(), &presShellId, &viewId)) {
APZThreadUtils::RunOnControllerThread(
NewRunnableMethod<SLGuidAndRenderRoot, CSSRect, uint32_t>(
NewRunnableMethod<ScrollableLayerGuid, CSSRect, uint32_t>(
"IAPZCTreeManager::ZoomToRect", mAPZCTreeManager,
&IAPZCTreeManager::ZoomToRect,
SLGuidAndRenderRoot(aGuid.mLayersId, presShellId, viewId,
wr::RenderRoot::Default),
ScrollableLayerGuid(aGuid.mLayersId, presShellId, viewId),
zoomToRect, ZoomToRectBehavior::DEFAULT_BEHAVIOR));
}
}

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

@ -63,8 +63,7 @@ void CanvasClientBridge::UpdateAsync(AsyncCanvasRenderer* aRenderer) {
mAsyncHandle = asyncID;
}
void CanvasClient2D::UpdateFromTexture(TextureClient* aTexture,
wr::RenderRoot aRenderRoot) {
void CanvasClient2D::UpdateFromTexture(TextureClient* aTexture) {
MOZ_ASSERT(aTexture);
if (!aTexture->IsSharedWithCompositor()) {
@ -83,16 +82,15 @@ void CanvasClient2D::UpdateFromTexture(TextureClient* aTexture,
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), aTexture->GetSize());
t->mFrameID = mFrameID;
GetForwarder()->UseTextures(this, textures, Some(aRenderRoot));
GetForwarder()->UseTextures(this, textures);
aTexture->SyncWithObject(GetForwarder()->GetSyncObject());
}
void CanvasClient2D::Update(gfx::IntSize aSize,
ShareableCanvasRenderer* aCanvasRenderer,
wr::RenderRoot aRenderRoot) {
ShareableCanvasRenderer* aCanvasRenderer) {
mBufferProviderTexture = nullptr;
AutoRemoveTexture autoRemove(this, aRenderRoot);
AutoRemoveTexture autoRemove(this);
if (mBackBuffer &&
(mBackBuffer->IsReadLocked() || mBackBuffer->GetSize() != aSize)) {
autoRemove.mTexture = mBackBuffer;
@ -152,7 +150,7 @@ void CanvasClient2D::Update(gfx::IntSize aSize,
t->mTextureClient = mBackBuffer;
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mBackBuffer->GetSize());
t->mFrameID = mFrameID;
GetForwarder()->UseTextures(this, textures, Some(aRenderRoot));
GetForwarder()->UseTextures(this, textures);
mBackBuffer->SyncWithObject(GetForwarder()->GetSyncObject());
}
@ -360,9 +358,8 @@ static already_AddRefed<SharedSurfaceTextureClient> CloneSurface(
return dest.forget();
}
void CanvasClientSharedSurface::Update(gfx::IntSize aSize,
ShareableCanvasRenderer* aCanvasRenderer,
wr::RenderRoot aRenderRoot) {
void CanvasClientSharedSurface::Update(
gfx::IntSize aSize, ShareableCanvasRenderer* aCanvasRenderer) {
Renderer renderer;
renderer.construct<ShareableCanvasRenderer*>(aCanvasRenderer);
UpdateRenderer(aSize, renderer);
@ -471,7 +468,7 @@ void CanvasClientSharedSurface::UpdateRenderer(gfx::IntSize aSize,
mNewFront = newFront;
}
void CanvasClientSharedSurface::Updated(wr::RenderRoot aRenderRoot) {
void CanvasClientSharedSurface::Updated() {
if (!mNewFront) {
return;
}
@ -491,7 +488,7 @@ void CanvasClientSharedSurface::Updated(wr::RenderRoot aRenderRoot) {
t->mTextureClient = mFront;
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
t->mFrameID = mFrameID;
forwarder->UseTextures(this, textures, Some(aRenderRoot));
forwarder->UseTextures(this, textures);
}
void CanvasClientSharedSurface::OnDetach() { ClearSurfaces(); }

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

@ -63,8 +63,7 @@ class CanvasClient : public CompositableClient {
virtual void Clear(){};
virtual void Update(gfx::IntSize aSize,
ShareableCanvasRenderer* aCanvasRenderer,
wr::RenderRoot aRenderRoot) = 0;
ShareableCanvasRenderer* aCanvasRenderer) = 0;
virtual bool AddTextureClient(TextureClient* aTexture) override {
++mFrameID;
@ -73,10 +72,9 @@ class CanvasClient : public CompositableClient {
virtual void UpdateAsync(AsyncCanvasRenderer* aRenderer) {}
virtual void UpdateFromTexture(TextureClient* aTexture,
wr::RenderRoot aRenderRoot) {}
virtual void UpdateFromTexture(TextureClient* aTexture) {}
virtual void Updated(wr::RenderRoot aRenderRoot) {}
virtual void Updated() {}
protected:
int32_t mFrameID;
@ -98,11 +96,9 @@ class CanvasClient2D : public CanvasClient {
}
virtual void Update(gfx::IntSize aSize,
ShareableCanvasRenderer* aCanvasRenderer,
wr::RenderRoot aRenderRoot) override;
ShareableCanvasRenderer* aCanvasRenderer) override;
virtual void UpdateFromTexture(TextureClient* aBuffer,
wr::RenderRoot aRenderRoot) override;
virtual void UpdateFromTexture(TextureClient* aBuffer) override;
virtual bool AddTextureClient(TextureClient* aTexture) override {
return CanvasClient::AddTextureClient(aTexture);
@ -149,13 +145,12 @@ class CanvasClientSharedSurface : public CanvasClient {
virtual void Clear() override { ClearSurfaces(); }
virtual void Update(gfx::IntSize aSize,
ShareableCanvasRenderer* aCanvasRenderer,
wr::RenderRoot aRenderRoot) override;
ShareableCanvasRenderer* aCanvasRenderer) override;
void UpdateRenderer(gfx::IntSize aSize, Renderer& aRenderer);
virtual void UpdateAsync(AsyncCanvasRenderer* aRenderer) override;
virtual void Updated(wr::RenderRoot aRenderRoot) override;
virtual void Updated() override;
virtual void OnDetach() override;
};
@ -176,8 +171,7 @@ class CanvasClientBridge final : public CanvasClient {
}
virtual void Update(gfx::IntSize aSize,
ShareableCanvasRenderer* aCanvasRenderer,
wr::RenderRoot aRenderRoot) override {}
ShareableCanvasRenderer* aCanvasRenderer) override {}
virtual void UpdateAsync(AsyncCanvasRenderer* aRenderer) override;

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

@ -120,8 +120,8 @@ void ClientImageLayer::RenderLayer() {
return;
}
if (!mImageClient || !mImageClient->UpdateImage(mContainer, GetContentFlags(),
Nothing())) {
if (!mImageClient ||
!mImageClient->UpdateImage(mContainer, GetContentFlags())) {
CompositableType type = GetImageClientType();
if (type == CompositableType::UNKNOWN) {
return;
@ -137,8 +137,7 @@ void ClientImageLayer::RenderLayer() {
mImageClient->Connect();
ClientManager()->AsShadowForwarder()->Attach(mImageClient, this);
}
if (!mImageClient->UpdateImage(mContainer, GetContentFlags(),
Nothing())) {
if (!mImageClient->UpdateImage(mContainer, GetContentFlags())) {
return;
}
}

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

@ -125,9 +125,8 @@ void CompositableClient::HandleMemoryPressure() {
}
}
void CompositableClient::RemoveTexture(
TextureClient* aTexture, const Maybe<wr::RenderRoot>& aRenderRoot) {
mForwarder->RemoveTextureFromCompositable(this, aTexture, aRenderRoot);
void CompositableClient::RemoveTexture(TextureClient* aTexture) {
mForwarder->RemoveTextureFromCompositable(this, aTexture);
}
TextureClientRecycleAllocator* CompositableClient::GetTextureClientRecycler() {
@ -199,7 +198,7 @@ void CompositableClient::DumpTextureClient(std::stringstream& aStream,
AutoRemoveTexture::~AutoRemoveTexture() {
if (mCompositable && mTexture && mCompositable->IsConnected()) {
mCompositable->RemoveTexture(mTexture, Some(mRenderRoot));
mCompositable->RemoveTexture(mTexture);
}
}

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

@ -16,8 +16,7 @@
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayersTypes.h" // for LayersBackend, TextureDumpMode
#include "mozilla/layers/TextureClient.h" // for TextureClient
#include "mozilla/webrender/WebRenderTypes.h" // for RenderRoot
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
namespace mozilla {
namespace layers {
@ -157,8 +156,7 @@ class CompositableClient {
*
* See AutoRemoveTexture to automatically invoke this at the end of a scope.
*/
virtual void RemoveTexture(TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot);
virtual void RemoveTexture(TextureClient* aTexture);
void InitIPDL(const CompositableHandle& aHandle);
@ -190,11 +188,8 @@ class CompositableClient {
*/
struct AutoRemoveTexture {
explicit AutoRemoveTexture(CompositableClient* aCompositable,
wr::RenderRoot aRenderRoot,
TextureClient* aTexture = nullptr)
: mTexture(aTexture),
mCompositable(aCompositable),
mRenderRoot(aRenderRoot) {}
: mTexture(aTexture), mCompositable(aCompositable) {}
~AutoRemoveTexture();
@ -202,7 +197,6 @@ struct AutoRemoveTexture {
private:
CompositableClient* mCompositable;
wr::RenderRoot mRenderRoot;
};
} // namespace layers

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

@ -715,8 +715,7 @@ void ContentClientRemoteBuffer::Updated(const nsIntRegion& aRegionToDraw,
t->mTextureClient = remoteBuffer->GetClient();
IntSize size = remoteBuffer->GetClient()->GetSize();
t->mPictureRect = nsIntRect(0, 0, size.width, size.height);
GetForwarder()->UseTextures(this, textures, Nothing());
GetForwarder()->UseTextures(this, textures);
}
// This forces a synchronous transaction, so we can swap buffers now

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

@ -64,9 +64,8 @@ already_AddRefed<ImageClient> ImageClient::CreateImageClient(
return result.forget();
}
void ImageClient::RemoveTexture(TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) {
GetForwarder()->RemoveTextureFromCompositable(this, aTexture, aRenderRoot);
void ImageClient::RemoveTexture(TextureClient* aTexture) {
GetForwarder()->RemoveTextureFromCompositable(this, aTexture);
}
ImageClientSingle::ImageClientSingle(CompositableForwarder* aFwd,
@ -80,11 +79,7 @@ TextureInfo ImageClientSingle::GetTextureInfo() const {
void ImageClientSingle::FlushAllImages() {
for (auto& b : mBuffers) {
// It should be safe to just assume a default render root here, even if
// the texture actually presents in a content render root, as the only
// risk would be if the content render root has not / is not going to
// generate a frame before the texture gets cleared.
RemoveTexture(b.mTextureClient, Some(wr::RenderRoot::Default));
RemoveTexture(b.mTextureClient);
}
mBuffers.Clear();
}
@ -162,8 +157,7 @@ already_AddRefed<TextureClient> ImageClient::CreateTextureClientForImage(
}
bool ImageClientSingle::UpdateImage(ImageContainer* aContainer,
uint32_t aContentFlags,
const Maybe<wr::RenderRoot>& aRenderRoot) {
uint32_t aContentFlags) {
AutoTArray<ImageContainer::OwningImage, 4> images;
uint32_t generationCounter;
aContainer->GetCurrentImages(&images, &generationCounter);
@ -187,7 +181,7 @@ bool ImageClientSingle::UpdateImage(ImageContainer* aContainer,
// We return true because the caller would attempt to recreate the
// ImageClient otherwise, and that isn't going to help.
for (auto& b : mBuffers) {
RemoveTexture(b.mTextureClient, aRenderRoot);
RemoveTexture(b.mTextureClient);
}
mBuffers.Clear();
return true;
@ -251,10 +245,10 @@ bool ImageClientSingle::UpdateImage(ImageContainer* aContainer,
texture->SyncWithObject(GetForwarder()->GetSyncObject());
}
GetForwarder()->UseTextures(this, textures, aRenderRoot);
GetForwarder()->UseTextures(this, textures);
for (auto& b : mBuffers) {
RemoveTexture(b.mTextureClient, aRenderRoot);
RemoveTexture(b.mTextureClient);
}
mBuffers.SwapElements(newBuffers);
@ -287,8 +281,7 @@ ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
: ImageClient(aFwd, aFlags, CompositableType::IMAGE_BRIDGE) {}
bool ImageClientBridge::UpdateImage(ImageContainer* aContainer,
uint32_t aContentFlags,
const Maybe<wr::RenderRoot>& aRenderRoot) {
uint32_t aContentFlags) {
if (!GetForwarder() || !mLayer) {
return false;
}

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

@ -53,8 +53,8 @@ class ImageClient : public CompositableClient {
* returns false if this is the wrong kind of ImageClient for aContainer.
* Note that returning true does not necessarily imply success
*/
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags,
const Maybe<wr::RenderRoot>& aRenderRoot) = 0;
virtual bool UpdateImage(ImageContainer* aContainer,
uint32_t aContentFlags) = 0;
void SetLayer(ClientLayer* aLayer) { mLayer = aLayer; }
ClientLayer* GetLayer() const { return mLayer; }
@ -65,8 +65,7 @@ class ImageClient : public CompositableClient {
*/
virtual void FlushAllImages() {}
virtual void RemoveTexture(TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual void RemoveTexture(TextureClient* aTexture) override;
virtual ImageClientSingle* AsImageClientSingle() { return nullptr; }
@ -96,8 +95,8 @@ class ImageClientSingle : public ImageClient {
ImageClientSingle(CompositableForwarder* aFwd, TextureFlags aFlags,
CompositableType aType);
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual bool UpdateImage(ImageContainer* aContainer,
uint32_t aContentFlags) override;
virtual void OnDetach() override;
@ -130,8 +129,8 @@ class ImageClientBridge : public ImageClient {
public:
ImageClientBridge(CompositableForwarder* aFwd, TextureFlags aFlags);
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual bool UpdateImage(ImageContainer* aContainer,
uint32_t aContentFlags) override;
virtual bool Connect(ImageContainer* aImageContainer) override {
return false;
}

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

@ -48,7 +48,7 @@ void APZCTreeManagerChild::SetKeyboardMap(const KeyboardMap& aKeyboardMap) {
SendSetKeyboardMap(aKeyboardMap);
}
void APZCTreeManagerChild::ZoomToRect(const SLGuidAndRenderRoot& aGuid,
void APZCTreeManagerChild::ZoomToRect(const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t aFlags) {
SendZoomToRect(aGuid, aRect, aFlags);
@ -60,12 +60,12 @@ void APZCTreeManagerChild::ContentReceivedInputBlock(uint64_t aInputBlockId,
}
void APZCTreeManagerChild::SetTargetAPZC(
uint64_t aInputBlockId, const nsTArray<SLGuidAndRenderRoot>& aTargets) {
uint64_t aInputBlockId, const nsTArray<ScrollableLayerGuid>& aTargets) {
SendSetTargetAPZC(aInputBlockId, aTargets);
}
void APZCTreeManagerChild::UpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints) {
if (mIPCOpen) {
SendUpdateZoomConstraints(aGuid, aConstraints);
@ -80,16 +80,16 @@ void APZCTreeManagerChild::SetAllowedTouchBehavior(
}
void APZCTreeManagerChild::StartScrollbarDrag(
const SLGuidAndRenderRoot& aGuid, const AsyncDragMetrics& aDragMetrics) {
const ScrollableLayerGuid& aGuid, const AsyncDragMetrics& aDragMetrics) {
SendStartScrollbarDrag(aGuid, aDragMetrics);
}
bool APZCTreeManagerChild::StartAutoscroll(const SLGuidAndRenderRoot& aGuid,
bool APZCTreeManagerChild::StartAutoscroll(const ScrollableLayerGuid& aGuid,
const ScreenPoint& aAnchorLocation) {
return SendStartAutoscroll(aGuid, aAnchorLocation);
}
void APZCTreeManagerChild::StopAutoscroll(const SLGuidAndRenderRoot& aGuid) {
void APZCTreeManagerChild::StopAutoscroll(const ScrollableLayerGuid& aGuid) {
SendStopAutoscroll(aGuid);
}

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

@ -30,17 +30,17 @@ class APZCTreeManagerChild : public IAPZCTreeManager,
void SetKeyboardMap(const KeyboardMap& aKeyboardMap) override;
void ZoomToRect(const SLGuidAndRenderRoot& aGuid, const CSSRect& aRect,
void ZoomToRect(const ScrollableLayerGuid& aGuid, const CSSRect& aRect,
const uint32_t aFlags = DEFAULT_BEHAVIOR) override;
void ContentReceivedInputBlock(uint64_t aInputBlockId,
bool aPreventDefault) override;
void SetTargetAPZC(uint64_t aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) override;
const nsTArray<ScrollableLayerGuid>& aTargets) override;
void UpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const Maybe<ZoomConstraints>& aConstraints) override;
void SetDPI(float aDpiValue) override;
@ -49,13 +49,13 @@ class APZCTreeManagerChild : public IAPZCTreeManager,
uint64_t aInputBlockId,
const nsTArray<TouchBehaviorFlags>& aValues) override;
void StartScrollbarDrag(const SLGuidAndRenderRoot& aGuid,
void StartScrollbarDrag(const ScrollableLayerGuid& aGuid,
const AsyncDragMetrics& aDragMetrics) override;
bool StartAutoscroll(const SLGuidAndRenderRoot& aGuid,
bool StartAutoscroll(const ScrollableLayerGuid& aGuid,
const ScreenPoint& aAnchorLocation) override;
void StopAutoscroll(const SLGuidAndRenderRoot& aGuid) override;
void StopAutoscroll(const ScrollableLayerGuid& aGuid) override;
void SetLongTapEnabled(bool aTapGestureEnabled) override;

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

@ -14,9 +14,9 @@ namespace mozilla {
namespace layers {
APZCTreeManagerParent::APZCTreeManagerParent(
WRRootId aWrRootId, RefPtr<APZCTreeManager> aAPZCTreeManager,
LayersId aLayersId, RefPtr<APZCTreeManager> aAPZCTreeManager,
RefPtr<APZUpdater> aAPZUpdater)
: mWrRootId(aWrRootId),
: mLayersId(aLayersId),
mTreeManager(std::move(aAPZCTreeManager)),
mUpdater(std::move(aAPZUpdater)) {
MOZ_ASSERT(mTreeManager != nullptr);
@ -38,54 +38,54 @@ void APZCTreeManagerParent::ChildAdopted(
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetKeyboardMap(
const KeyboardMap& aKeyboardMap) {
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
NewRunnableMethod<KeyboardMap>(
"layers::IAPZCTreeManager::SetKeyboardMap", mTreeManager,
&IAPZCTreeManager::SetKeyboardMap, aKeyboardMap));
mLayersId, NewRunnableMethod<KeyboardMap>(
"layers::IAPZCTreeManager::SetKeyboardMap", mTreeManager,
&IAPZCTreeManager::SetKeyboardMap, aKeyboardMap));
return IPC_OK();
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvZoomToRect(
const SLGuidAndRenderRoot& aGuid, const CSSRect& aRect,
const ScrollableLayerGuid& aGuid, const CSSRect& aRect,
const uint32_t& aFlags) {
if (!IsGuidValid(aGuid)) {
if (aGuid.mLayersId != mLayersId) {
// Guard against bad data from hijacked child processes
NS_ERROR("Unexpected layers id in RecvZoomToRect; dropping message...");
return IPC_FAIL_NO_REASON(this);
}
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(aGuid.GetWRRootId()),
NewRunnableMethod<SLGuidAndRenderRoot, CSSRect, uint32_t>(
"layers::IAPZCTreeManager::ZoomToRect", mTreeManager,
&IAPZCTreeManager::ZoomToRect, aGuid, aRect, aFlags));
mLayersId, NewRunnableMethod<ScrollableLayerGuid, CSSRect, uint32_t>(
"layers::IAPZCTreeManager::ZoomToRect", mTreeManager,
&IAPZCTreeManager::ZoomToRect, aGuid, aRect, aFlags));
return IPC_OK();
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvContentReceivedInputBlock(
const uint64_t& aInputBlockId, const bool& aPreventDefault) {
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
NewRunnableMethod<uint64_t, bool>(
"layers::IAPZCTreeManager::ContentReceivedInputBlock", mTreeManager,
&IAPZCTreeManager::ContentReceivedInputBlock, aInputBlockId,
aPreventDefault));
mLayersId, NewRunnableMethod<uint64_t, bool>(
"layers::IAPZCTreeManager::ContentReceivedInputBlock",
mTreeManager, &IAPZCTreeManager::ContentReceivedInputBlock,
aInputBlockId, aPreventDefault));
return IPC_OK();
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetTargetAPZC(
const uint64_t& aInputBlockId, nsTArray<SLGuidAndRenderRoot>&& aTargets) {
UpdaterQueueSelector selector(mWrRootId.mLayersId);
const uint64_t& aInputBlockId, nsTArray<ScrollableLayerGuid>&& aTargets) {
for (size_t i = 0; i < aTargets.Length(); i++) {
if (!IsGuidValid(aTargets[i])) {
if (aTargets[i].mLayersId != mLayersId) {
// Guard against bad data from hijacked child processes
NS_ERROR(
"Unexpected layers id in RecvSetTargetAPZC; dropping message...");
return IPC_FAIL_NO_REASON(this);
}
selector.mRenderRoots += aTargets[i].mRenderRoot;
}
mUpdater->RunOnControllerThread(
selector,
mLayersId,
NewRunnableMethod<uint64_t,
StoreCopyPassByRRef<nsTArray<SLGuidAndRenderRoot>>>(
StoreCopyPassByRRef<nsTArray<ScrollableLayerGuid>>>(
"layers::IAPZCTreeManager::SetTargetAPZC", mTreeManager,
&IAPZCTreeManager::SetTargetAPZC, aInputBlockId, aTargets));
@ -93,9 +93,13 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetTargetAPZC(
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvUpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const MaybeZoomConstraints& aConstraints) {
if (!IsGuidValid(aGuid)) {
if (aGuid.mLayersId != mLayersId) {
// Guard against bad data from hijacked child processes
NS_ERROR(
"Unexpected layers id in RecvUpdateZoomConstraints; dropping "
"message...");
return IPC_FAIL_NO_REASON(this);
}
@ -106,7 +110,7 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvUpdateZoomConstraints(
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetDPI(
const float& aDpiValue) {
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
mLayersId,
NewRunnableMethod<float>("layers::IAPZCTreeManager::SetDPI", mTreeManager,
&IAPZCTreeManager::SetDPI, aDpiValue));
return IPC_OK();
@ -115,7 +119,7 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetDPI(
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
const uint64_t& aInputBlockId, nsTArray<TouchBehaviorFlags>&& aValues) {
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
mLayersId,
NewRunnableMethod<uint64_t,
StoreCopyPassByRRef<nsTArray<TouchBehaviorFlags>>>(
"layers::IAPZCTreeManager::SetAllowedTouchBehavior", mTreeManager,
@ -126,14 +130,17 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartScrollbarDrag(
const SLGuidAndRenderRoot& aGuid, const AsyncDragMetrics& aDragMetrics) {
if (!IsGuidValid(aGuid)) {
const ScrollableLayerGuid& aGuid, const AsyncDragMetrics& aDragMetrics) {
if (aGuid.mLayersId != mLayersId) {
// Guard against bad data from hijacked child processes
NS_ERROR(
"Unexpected layers id in RecvStartScrollbarDrag; dropping message...");
return IPC_FAIL_NO_REASON(this);
}
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(aGuid.GetWRRootId()),
NewRunnableMethod<SLGuidAndRenderRoot, AsyncDragMetrics>(
mLayersId,
NewRunnableMethod<ScrollableLayerGuid, AsyncDragMetrics>(
"layers::IAPZCTreeManager::StartScrollbarDrag", mTreeManager,
&IAPZCTreeManager::StartScrollbarDrag, aGuid, aDragMetrics));
@ -141,17 +148,17 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartScrollbarDrag(
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartAutoscroll(
const SLGuidAndRenderRoot& aGuid, const ScreenPoint& aAnchorLocation) {
const ScrollableLayerGuid& aGuid, const ScreenPoint& aAnchorLocation) {
// Unlike RecvStartScrollbarDrag(), this message comes from the parent
// process (via nsBaseWidget::mAPZC) rather than from the child process
// (via TabChild::mApzcTreeManager), so there is no need to check the
// layers id against mWrRootId (and in any case, it wouldn't match, because
// mWrRootId stores the parent process's layers id, while nsBaseWidget is
// layers id against mLayersId (and in any case, it wouldn't match, because
// mLayersId stores the parent process's layers id, while nsBaseWidget is
// sending the child process's layers id).
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
NewRunnableMethod<SLGuidAndRenderRoot, ScreenPoint>(
mLayersId,
NewRunnableMethod<ScrollableLayerGuid, ScreenPoint>(
"layers::IAPZCTreeManager::StartAutoscroll", mTreeManager,
&IAPZCTreeManager::StartAutoscroll, aGuid, aAnchorLocation));
@ -159,14 +166,13 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStartAutoscroll(
}
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStopAutoscroll(
const SLGuidAndRenderRoot& aGuid) {
const ScrollableLayerGuid& aGuid) {
// See RecvStartAutoscroll() for why we don't check the layers id.
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
NewRunnableMethod<SLGuidAndRenderRoot>(
"layers::IAPZCTreeManager::StopAutoscroll", mTreeManager,
&IAPZCTreeManager::StopAutoscroll, aGuid));
mLayersId, NewRunnableMethod<ScrollableLayerGuid>(
"layers::IAPZCTreeManager::StopAutoscroll", mTreeManager,
&IAPZCTreeManager::StopAutoscroll, aGuid));
return IPC_OK();
}
@ -174,7 +180,7 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvStopAutoscroll(
mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetLongTapEnabled(
const bool& aLongTapEnabled) {
mUpdater->RunOnControllerThread(
UpdaterQueueSelector(mWrRootId),
mLayersId,
NewRunnableMethod<bool>(
"layers::IAPZCTreeManager::SetLongTapEnabled", mTreeManager,
&IAPZCTreeManager::SetLongTapEnabled, aLongTapEnabled));
@ -182,22 +188,5 @@ mozilla::ipc::IPCResult APZCTreeManagerParent::RecvSetLongTapEnabled(
return IPC_OK();
}
bool APZCTreeManagerParent::IsGuidValid(const SLGuidAndRenderRoot& aGuid) {
if (aGuid.mScrollableLayerGuid.mLayersId != mWrRootId.mLayersId) {
NS_ERROR("Unexpected layers id");
return false;
}
if (mWrRootId.mRenderRoot == wr::RenderRoot::Content) {
// If this APZCTreeManagerParent is for a content process IPDL bridge, then
// all the render root references that come over the bridge must be for
// the content render root.
if (aGuid.mRenderRoot != wr::RenderRoot::Content) {
NS_ERROR("Unexpected render root");
return false;
}
}
return true;
}
} // namespace layers
} // namespace mozilla

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

@ -17,12 +17,12 @@ class APZUpdater;
class APZCTreeManagerParent : public PAPZCTreeManagerParent {
public:
APZCTreeManagerParent(WRRootId aWrRootId,
APZCTreeManagerParent(LayersId aLayersId,
RefPtr<APZCTreeManager> aAPZCTreeManager,
RefPtr<APZUpdater> mAPZUpdater);
virtual ~APZCTreeManagerParent();
LayersId GetLayersId() const { return mWrRootId.mLayersId; }
LayersId GetLayersId() const { return mLayersId; }
/**
* Called when the layer tree that this protocol is connected to
@ -33,7 +33,7 @@ class APZCTreeManagerParent : public PAPZCTreeManagerParent {
mozilla::ipc::IPCResult RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap);
mozilla::ipc::IPCResult RecvZoomToRect(const SLGuidAndRenderRoot& aGuid,
mozilla::ipc::IPCResult RecvZoomToRect(const ScrollableLayerGuid& aGuid,
const CSSRect& aRect,
const uint32_t& aFlags);
@ -41,10 +41,10 @@ class APZCTreeManagerParent : public PAPZCTreeManagerParent {
const uint64_t& aInputBlockId, const bool& aPreventDefault);
mozilla::ipc::IPCResult RecvSetTargetAPZC(
const uint64_t& aInputBlockId, nsTArray<SLGuidAndRenderRoot>&& aTargets);
const uint64_t& aInputBlockId, nsTArray<ScrollableLayerGuid>&& aTargets);
mozilla::ipc::IPCResult RecvUpdateZoomConstraints(
const SLGuidAndRenderRoot& aGuid,
const ScrollableLayerGuid& aGuid,
const MaybeZoomConstraints& aConstraints);
mozilla::ipc::IPCResult RecvSetDPI(const float& aDpiValue);
@ -53,21 +53,19 @@ class APZCTreeManagerParent : public PAPZCTreeManagerParent {
const uint64_t& aInputBlockId, nsTArray<TouchBehaviorFlags>&& aValues);
mozilla::ipc::IPCResult RecvStartScrollbarDrag(
const SLGuidAndRenderRoot& aGuid, const AsyncDragMetrics& aDragMetrics);
const ScrollableLayerGuid& aGuid, const AsyncDragMetrics& aDragMetrics);
mozilla::ipc::IPCResult RecvStartAutoscroll(
const SLGuidAndRenderRoot& aGuid, const ScreenPoint& aAnchorLocation);
const ScrollableLayerGuid& aGuid, const ScreenPoint& aAnchorLocation);
mozilla::ipc::IPCResult RecvStopAutoscroll(const SLGuidAndRenderRoot& aGuid);
mozilla::ipc::IPCResult RecvStopAutoscroll(const ScrollableLayerGuid& aGuid);
mozilla::ipc::IPCResult RecvSetLongTapEnabled(const bool& aTapGestureEnabled);
void ActorDestroy(ActorDestroyReason aWhy) override {}
private:
bool IsGuidValid(const SLGuidAndRenderRoot& aGuid);
WRRootId mWrRootId;
LayersId mLayersId;
RefPtr<APZCTreeManager> mTreeManager;
RefPtr<APZUpdater> mUpdater;
};

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

@ -81,15 +81,9 @@ class CompositableForwarder : public KnowsCompositor {
* TextureClient passed in parameter.
* When the TextureClient has TEXTURE_DEALLOCATE_CLIENT flag,
* the transaction becomes synchronous.
*
* aRenderRoot can be ignored if not using WebRender - since webrender
* splits the chrome and content areas into different documents which are
* updated separately, we need to know which command buffer to route this
* into.
*/
virtual void RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) = 0;
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) = 0;
struct TimedTextureClient {
TimedTextureClient()
@ -104,15 +98,9 @@ class CompositableForwarder : public KnowsCompositor {
/**
* Tell the CompositableHost on the compositor side what textures to use for
* the next composition.
*
* aRenderRoot can be ignored if not using WebRender - since webrender
* splits the chrome and content areas into different documents which are
* updated separately, we need to know which command buffer to route this
* into.
*/
virtual void UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) = 0;
const nsTArray<TimedTextureClient>& aTextures) = 0;
virtual void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) = 0;

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

@ -471,8 +471,7 @@ void CompositorBridgeParent::StopAndClearResources() {
}
indirectBridgeParents.clear();
RefPtr<wr::WebRenderAPI> api =
mWrBridge->GetWebRenderAPI(wr::RenderRoot::Default);
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
// Ensure we are not holding the sIndirectLayerTreesLock here because we
// are going to block on WR threads in order to shut it down properly.
mWrBridge->Destroy();
@ -648,12 +647,11 @@ void CompositorBridgeParent::ActorDestroy(ActorDestroyReason why) {
&CompositorBridgeParent::DeferredDestroy));
}
void CompositorBridgeParent::ScheduleRenderOnCompositorThread(
const Maybe<wr::RenderRoot>& aRenderRoot) {
void CompositorBridgeParent::ScheduleRenderOnCompositorThread() {
MOZ_ASSERT(CompositorLoop());
CompositorLoop()->PostTask(NewRunnableMethod<Maybe<wr::RenderRoot>>(
"layers::CompositorBridgeParent::ScheduleComposition", this,
&CompositorBridgeParent::ScheduleComposition, aRenderRoot));
CompositorLoop()->PostTask(
NewRunnableMethod("layers::CompositorBridgeParent::ScheduleComposition",
this, &CompositorBridgeParent::ScheduleComposition));
}
void CompositorBridgeParent::InvalidateOnCompositorThread() {
@ -846,8 +844,7 @@ void CompositorBridgeParent::NotifyShadowTreeTransaction(
#endif
if (mApzUpdater) {
mApzUpdater->UpdateFocusState(mRootLayerTreeID,
WRRootId::NonWebRender(aId), aFocusTarget);
mApzUpdater->UpdateFocusState(mRootLayerTreeID, aId, aFocusTarget);
if (aHitTestUpdate) {
mApzUpdater->UpdateHitTestingTree(
mRootLayerTreeID, mLayerManager->GetRoot(), aIsFirstPaint, aId,
@ -862,19 +859,14 @@ void CompositorBridgeParent::NotifyShadowTreeTransaction(
}
}
void CompositorBridgeParent::ScheduleComposition(
const Maybe<wr::RenderRoot>& aRenderRoot) {
void CompositorBridgeParent::ScheduleComposition() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
if (mPaused) {
return;
}
if (mWrBridge) {
if (aRenderRoot.isSome()) {
mWrBridge->ScheduleGenerateFrame(aRenderRoot);
} else {
mWrBridge->ScheduleGenerateFrameAllRenderRoots();
}
mWrBridge->ScheduleGenerateFrame();
} else {
mCompositorScheduler->ScheduleComposition();
}
@ -1105,8 +1097,7 @@ PAPZCTreeManagerParent* CompositorBridgeParent::AllocPAPZCTreeManagerParent(
MOZ_ASSERT(state.mParent.get() == this);
MOZ_ASSERT(!state.mApzcTreeManagerParent);
state.mApzcTreeManagerParent = new APZCTreeManagerParent(
WRRootId(mRootLayerTreeID, wr::RenderRoot::Default), mApzcTreeManager,
mApzUpdater);
mRootLayerTreeID, mApzcTreeManager, mApzUpdater);
return state.mApzcTreeManagerParent;
}
@ -1119,13 +1110,13 @@ bool CompositorBridgeParent::DeallocPAPZCTreeManagerParent(
void CompositorBridgeParent::AllocateAPZCTreeManagerParent(
const MonitorAutoLock& aProofOfLayerTreeStateLock,
const WRRootId& aWrRootId, LayerTreeState& aState) {
const LayersId& aLayersId, LayerTreeState& aState) {
MOZ_ASSERT(aState.mParent == this);
MOZ_ASSERT(mApzcTreeManager);
MOZ_ASSERT(mApzUpdater);
MOZ_ASSERT(!aState.mApzcTreeManagerParent);
aState.mApzcTreeManagerParent =
new APZCTreeManagerParent(aWrRootId, mApzcTreeManager, mApzUpdater);
new APZCTreeManagerParent(aLayersId, mApzcTreeManager, mApzUpdater);
}
PAPZParent* CompositorBridgeParent::AllocPAPZParent(const LayersId& aLayersId) {
@ -1191,8 +1182,7 @@ CompositorBridgeParent::GetCompositorBridgeParentFromWindowId(
// state->mWrBridge might be a root WebRenderBridgeParent or one of a
// content process, but in either case the state->mParent will be the same.
// So we don't need to distinguish between the two.
if (RefPtr<wr::WebRenderAPI> api =
state->mWrBridge->GetWebRenderAPI(wr::RenderRoot::Default)) {
if (RefPtr<wr::WebRenderAPI> api = state->mWrBridge->GetWebRenderAPI()) {
if (api->GetId() == aWindowId) {
return state->mParent;
}
@ -1243,8 +1233,7 @@ void CompositorBridgeParent::ShadowLayersUpdated(
mLayerManager->SetRoot(root);
if (mApzUpdater && !aInfo.isRepeatTransaction()) {
mApzUpdater->UpdateFocusState(mRootLayerTreeID,
WRRootId::NonWebRender(mRootLayerTreeID),
mApzUpdater->UpdateFocusState(mRootLayerTreeID, mRootLayerTreeID,
aInfo.focusTarget());
if (aHitTestUpdate) {
@ -1361,60 +1350,55 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvGetFrameUniformity(
}
void CompositorBridgeParent::SetTestAsyncScrollOffset(
const WRRootId& aWrRootId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) {
if (mApzUpdater) {
MOZ_ASSERT(aWrRootId.IsValid());
mApzUpdater->SetTestAsyncScrollOffset(aWrRootId, aScrollId, aPoint);
MOZ_ASSERT(aLayersId.IsValid());
mApzUpdater->SetTestAsyncScrollOffset(aLayersId, aScrollId, aPoint);
}
}
void CompositorBridgeParent::SetTestAsyncZoom(
const WRRootId& aWrRootId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom) {
if (mApzUpdater) {
MOZ_ASSERT(aWrRootId.IsValid());
mApzUpdater->SetTestAsyncZoom(aWrRootId, aScrollId, aZoom);
MOZ_ASSERT(aLayersId.IsValid());
mApzUpdater->SetTestAsyncZoom(aLayersId, aScrollId, aZoom);
}
}
void CompositorBridgeParent::FlushApzRepaints(const WRRootId& aWrRootId) {
void CompositorBridgeParent::FlushApzRepaints(const LayersId& aLayersId) {
MOZ_ASSERT(mApzUpdater);
MOZ_ASSERT(aWrRootId.IsValid());
MOZ_ASSERT(aLayersId.IsValid());
mApzUpdater->RunOnControllerThread(
UpdaterQueueSelector(aWrRootId),
NS_NewRunnableFunction(
"layers::CompositorBridgeParent::FlushApzRepaints",
[=]() { APZCTreeManager::FlushApzRepaints(aWrRootId.mLayersId); }));
aLayersId, NS_NewRunnableFunction(
"layers::CompositorBridgeParent::FlushApzRepaints",
[=]() { APZCTreeManager::FlushApzRepaints(aLayersId); }));
}
void CompositorBridgeParent::GetAPZTestData(const WRRootId& aWrRootId,
void CompositorBridgeParent::GetAPZTestData(const LayersId& aLayersId,
APZTestData* aOutData) {
if (mApzUpdater) {
MOZ_ASSERT(aWrRootId.IsValid());
mApzUpdater->GetAPZTestData(aWrRootId, aOutData);
MOZ_ASSERT(aLayersId.IsValid());
mApzUpdater->GetAPZTestData(aLayersId, aOutData);
}
}
void CompositorBridgeParent::SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) {
const nsTArray<ScrollableLayerGuid>& aTargets) {
if (!mApzcTreeManager || !mApzUpdater) {
return;
}
// Need to specifically bind this since it's overloaded.
void (APZCTreeManager::*setTargetApzcFunc)(
uint64_t, const nsTArray<SLGuidAndRenderRoot>&) =
uint64_t, const nsTArray<ScrollableLayerGuid>&) =
&APZCTreeManager::SetTargetAPZC;
RefPtr<Runnable> task = NewRunnableMethod<
uint64_t, StoreCopyPassByConstLRef<nsTArray<SLGuidAndRenderRoot>>>(
uint64_t, StoreCopyPassByConstLRef<nsTArray<ScrollableLayerGuid>>>(
"layers::CompositorBridgeParent::SetConfirmedTargetAPZC",
mApzcTreeManager.get(), setTargetApzcFunc, aInputBlockId, aTargets);
UpdaterQueueSelector selector(aLayersId);
for (size_t i = 0; i < aTargets.Length(); i++) {
selector.mRenderRoots += aTargets[i].mRenderRoot;
}
mApzUpdater->RunOnControllerThread(selector, task.forget());
mApzUpdater->RunOnControllerThread(aLayersId, task.forget());
}
void CompositorBridgeParent::InitializeLayerManager(
@ -1707,13 +1691,11 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvAdoptChild(
if (childWrBridge) {
MOZ_ASSERT(mWrBridge);
nsTArray<RefPtr<wr::WebRenderAPI>> apis;
DebugOnly<bool> cloneSuccess = mWrBridge->CloneWebRenderAPIs(apis);
MOZ_ASSERT(cloneSuccess);
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
api = api->Clone();
wr::Epoch newEpoch = childWrBridge->UpdateWebRender(
mWrBridge->CompositorScheduler(), std::move(apis),
mWrBridge->AsyncImageManager(), GetAnimationStorage(),
mWrBridge->GetTextureFactoryIdentifier());
mWrBridge->CompositorScheduler(), api, mWrBridge->AsyncImageManager(),
GetAnimationStorage(), mWrBridge->GetTextureFactoryIdentifier());
// Pretend we composited, since parent CompositorBridgeParent was replaced.
TimeStamp now = TimeStamp::Now();
NotifyPipelineRendered(childWrBridge->PipelineId(), newEpoch, VsyncId(),
@ -1734,8 +1716,7 @@ mozilla::ipc::IPCResult CompositorBridgeParent::RecvAdoptChild(
MOZ_ASSERT(mApzcTreeManager);
parent->ChildAdopted(mApzcTreeManager, mApzUpdater);
}
mApzUpdater->NotifyLayerTreeAdopted(
WRRootId(child, gfxUtils::GetContentRenderRoot()), oldApzUpdater);
mApzUpdater->NotifyLayerTreeAdopted(child, oldApzUpdater);
}
return IPC_OK();
}
@ -1771,33 +1752,21 @@ PWebRenderBridgeParent* CompositorBridgeParent::AllocPWebRenderBridgeParent(
// Same as for mApzUpdater, but for the sampler thread.
mApzSampler->SetWebRenderWindowId(windowId);
}
InfallibleTArray<RefPtr<wr::WebRenderAPI>> apis;
apis.AppendElement(
wr::WebRenderAPI::Create(this, std::move(widget), windowId, aSize));
if (!apis[0]) {
RefPtr<wr::WebRenderAPI> api =
wr::WebRenderAPI::Create(this, std::move(widget), windowId, aSize);
if (!api) {
mWrBridge = WebRenderBridgeParent::CreateDestroyed(aPipelineId);
mWrBridge.get()->AddRef(); // IPDL reference
return mWrBridge;
}
if (gfxPrefs::WebRenderSplitRenderRoots()) {
apis.AppendElement(
apis[0]->CreateDocument(aSize, 1, wr::RenderRoot::Content));
}
InfallibleTArray<RefPtr<wr::WebRenderAPI>> clonedApis;
for (auto& api : apis) {
wr::TransactionBuilder txn;
txn.SetRootPipeline(aPipelineId);
api->SendTransaction(txn);
clonedApis.AppendElement(api->Clone());
}
mAsyncImageManager = new AsyncImagePipelineManager(std::move(clonedApis));
mAsyncImageManager = new AsyncImagePipelineManager(api->Clone());
RefPtr<AsyncImagePipelineManager> asyncMgr = mAsyncImageManager;
wr::TransactionBuilder txn;
txn.SetRootPipeline(aPipelineId);
api->SendTransaction(txn);
RefPtr<CompositorAnimationStorage> animStorage = GetAnimationStorage();
mWrBridge = new WebRenderBridgeParent(this, aPipelineId, mWidget, nullptr,
std::move(apis), std::move(asyncMgr),
std::move(api), std::move(asyncMgr),
std::move(animStorage), mVsyncRate);
mWrBridge.get()->AddRef(); // IPDL reference
@ -1832,8 +1801,7 @@ bool CompositorBridgeParent::DeallocPWebRenderBridgeParent(
void CompositorBridgeParent::NotifyMemoryPressure() {
if (mWrBridge) {
RefPtr<wr::WebRenderAPI> api =
mWrBridge->GetWebRenderAPI(wr::RenderRoot::Default);
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
if (api) {
api->NotifyMemoryPressure();
}
@ -1842,8 +1810,7 @@ void CompositorBridgeParent::NotifyMemoryPressure() {
void CompositorBridgeParent::AccumulateMemoryReport(wr::MemoryReport* aReport) {
if (mWrBridge) {
RefPtr<wr::WebRenderAPI> api =
mWrBridge->GetWebRenderAPI(wr::RenderRoot::Default);
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
if (api) {
api->AccumulateMemoryReport(aReport);
}
@ -1875,8 +1842,7 @@ static void EraseLayerState(LayersId aId) {
}
if (apz) {
apz->NotifyLayerTreeRemoved(
WRRootId(aId, gfxUtils::GetContentRenderRoot()));
apz->NotifyLayerTreeRemoved(aId);
}
}
@ -2063,14 +2029,14 @@ void CompositorBridgeParent::DidComposite(const VsyncId& aId,
}
void CompositorBridgeParent::NotifyDidSceneBuild(
wr::RenderRoot aRenderRoot, RefPtr<wr::WebRenderPipelineInfo> aInfo) {
RefPtr<wr::WebRenderPipelineInfo> aInfo) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
if (mPaused) {
return;
}
if (mWrBridge) {
mWrBridge->NotifyDidSceneBuild(aRenderRoot, aInfo);
mWrBridge->NotifyDidSceneBuild(aInfo);
} else {
mCompositorScheduler->ScheduleComposition();
}
@ -2281,8 +2247,7 @@ void CompositorBridgeParent::NotifyWebRenderError(wr::WebRenderError aError) {
void CompositorBridgeParent::NotifyWebRenderContextPurge() {
MOZ_ASSERT(CompositorLoop() == MessageLoop::current());
RefPtr<wr::WebRenderAPI> api =
mWrBridge->GetWebRenderAPI(wr::RenderRoot::Default);
RefPtr<wr::WebRenderAPI> api = mWrBridge->GetWebRenderAPI();
api->ClearAllCaches();
}

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

@ -125,17 +125,17 @@ class CompositorBridgeParentBase : public PCompositorBridgeParent,
virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree,
TransformsToSkip aSkip) = 0;
virtual void SetTestAsyncScrollOffset(
const WRRootId& aWrRootId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) = 0;
virtual void SetTestAsyncZoom(const WRRootId& aWrRootId,
virtual void SetTestAsyncZoom(const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom) = 0;
virtual void FlushApzRepaints(const WRRootId& aWrRootId) = 0;
virtual void GetAPZTestData(const WRRootId& aWrRootId,
virtual void FlushApzRepaints(const LayersId& aLayersId) = 0;
virtual void GetAPZTestData(const LayersId& aLayersId,
APZTestData* aOutData) {}
virtual void SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) = 0;
const nsTArray<ScrollableLayerGuid>& aTargets) = 0;
virtual void UpdatePaintTime(LayerTransactionParent* aLayerTree,
const TimeDuration& aPaintTime) {}
virtual void RegisterPayload(
@ -358,18 +358,18 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
void ApplyAsyncProperties(LayerTransactionParent* aLayerTree,
TransformsToSkip aSkip) override;
CompositorAnimationStorage* GetAnimationStorage();
void SetTestAsyncScrollOffset(const WRRootId& aWrRootId,
void SetTestAsyncScrollOffset(const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) override;
void SetTestAsyncZoom(const WRRootId& aWrRootId,
void SetTestAsyncZoom(const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom) override;
void FlushApzRepaints(const WRRootId& aWrRootId) override;
void GetAPZTestData(const WRRootId& aWrRootId,
void FlushApzRepaints(const LayersId& aLayersId) override;
void GetAPZTestData(const LayersId& aLayersId,
APZTestData* aOutData) override;
void SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) override;
const nsTArray<ScrollableLayerGuid>& aTargets) override;
AsyncCompositionManager* GetCompositionManager(
LayerTransactionParent* aLayerTree) override {
return mCompositionManager;
@ -392,8 +392,7 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
TimeStamp& aCompositeStart,
TimeStamp& aRenderStart, TimeStamp& aCompositeEnd,
wr::RendererStats* aStats = nullptr);
void NotifyDidSceneBuild(wr::RenderRoot aRenderRoot,
RefPtr<wr::WebRenderPipelineInfo> aInfo);
void NotifyDidSceneBuild(RefPtr<wr::WebRenderPipelineInfo> aInfo);
RefPtr<AsyncImagePipelineManager> GetAsyncImagePipelineManager() const;
PCompositorWidgetParent* AllocPCompositorWidgetParent(
@ -419,8 +418,7 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
void AsyncRender();
// Can be called from any thread
void ScheduleRenderOnCompositorThread(
const Maybe<wr::RenderRoot>& aRenderRoot = Nothing()) override;
void ScheduleRenderOnCompositorThread() override;
void SchedulePauseOnCompositorThread();
void InvalidateOnCompositorThread();
/**
@ -430,8 +428,7 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
bool ScheduleResumeOnCompositorThread();
bool ScheduleResumeOnCompositorThread(int x, int y, int width, int height);
void ScheduleComposition(
const Maybe<wr::RenderRoot>& aRenderRoot = Nothing());
void ScheduleComposition();
void NotifyShadowTreeTransaction(LayersId aId, bool aIsFirstPaint,
const FocusTarget& aFocusTarget,
bool aScheduleComposite,
@ -587,7 +584,7 @@ class CompositorBridgeParent final : public CompositorBridgeParentBase,
// ContentCompositorBridgeParent.
void AllocateAPZCTreeManagerParent(
const MonitorAutoLock& aProofOfLayerTreeStateLock,
const WRRootId& aWrRootId, LayerTreeState& aLayerTreeStateToUpdate);
const LayersId& aLayersId, LayerTreeState& aLayerTreeStateToUpdate);
PAPZParent* AllocPAPZParent(const LayersId& aLayersId) override;
bool DeallocPAPZParent(PAPZParent* aActor) override;

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

@ -35,7 +35,6 @@
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
#include "mozilla/Unused.h"
#include "mozilla/StaticPtr.h"
#include "gfxUtils.h"
using namespace std;
@ -143,13 +142,10 @@ ContentCompositorBridgeParent::AllocPAPZCTreeManagerParent(
RefPtr<APZCTreeManager> temp = new APZCTreeManager(dummyId);
RefPtr<APZUpdater> tempUpdater = new APZUpdater(temp, false);
tempUpdater->ClearTree(dummyId);
return new APZCTreeManagerParent(
WRRootId(aLayersId, gfxUtils::GetContentRenderRoot()), temp,
tempUpdater);
return new APZCTreeManagerParent(aLayersId, temp, tempUpdater);
}
state.mParent->AllocateAPZCTreeManagerParent(
lock, WRRootId(aLayersId, gfxUtils::GetContentRenderRoot()), state);
state.mParent->AllocateAPZCTreeManagerParent(lock, aLayersId, state);
return state.mApzcTreeManagerParent;
}
bool ContentCompositorBridgeParent::DeallocPAPZCTreeManagerParent(
@ -229,13 +225,12 @@ ContentCompositorBridgeParent::AllocPWebRenderBridgeParent(
}
}
InfallibleTArray<RefPtr<wr::WebRenderAPI>> apis;
bool cloneSuccess = false;
RefPtr<wr::WebRenderAPI> api;
if (root) {
cloneSuccess = root->CloneWebRenderAPIs(apis);
api = root->GetWebRenderAPI();
}
if (!cloneSuccess) {
if (!root || !api) {
// This could happen when this function is called after
// CompositorBridgeParent destruction. This was observed during Tab move
// between different windows.
@ -249,10 +244,11 @@ ContentCompositorBridgeParent::AllocPWebRenderBridgeParent(
return parent;
}
api = api->Clone();
RefPtr<AsyncImagePipelineManager> holder = root->AsyncImageManager();
RefPtr<CompositorAnimationStorage> animStorage = cbp->GetAnimationStorage();
WebRenderBridgeParent* parent = new WebRenderBridgeParent(
this, aPipelineId, nullptr, root->CompositorScheduler(), std::move(apis),
this, aPipelineId, nullptr, root->CompositorScheduler(), std::move(api),
std::move(holder), std::move(animStorage), cbp->GetVsyncInterval());
parent->AddRef(); // IPDL reference
@ -485,11 +481,11 @@ void ContentCompositorBridgeParent::ApplyAsyncProperties(
}
void ContentCompositorBridgeParent::SetTestAsyncScrollOffset(
const WRRootId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) {
MOZ_ASSERT(aLayersId.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(aLayersId.mLayersId);
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);
if (!state) {
return;
}
@ -499,11 +495,11 @@ void ContentCompositorBridgeParent::SetTestAsyncScrollOffset(
}
void ContentCompositorBridgeParent::SetTestAsyncZoom(
const WRRootId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayersId& aLayersId, const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom) {
MOZ_ASSERT(aLayersId.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(aLayersId.mLayersId);
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);
if (!state) {
return;
}
@ -513,10 +509,10 @@ void ContentCompositorBridgeParent::SetTestAsyncZoom(
}
void ContentCompositorBridgeParent::FlushApzRepaints(
const WRRootId& aLayersId) {
const LayersId& aLayersId) {
MOZ_ASSERT(aLayersId.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(aLayersId.mLayersId);
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);
if (!state || !state->mParent) {
return;
}
@ -524,11 +520,11 @@ void ContentCompositorBridgeParent::FlushApzRepaints(
state->mParent->FlushApzRepaints(aLayersId);
}
void ContentCompositorBridgeParent::GetAPZTestData(const WRRootId& aLayersId,
void ContentCompositorBridgeParent::GetAPZTestData(const LayersId& aLayersId,
APZTestData* aOutData) {
MOZ_ASSERT(aLayersId.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(aLayersId.mLayersId);
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);
if (!state || !state->mParent) {
return;
}
@ -538,7 +534,7 @@ void ContentCompositorBridgeParent::GetAPZTestData(const WRRootId& aLayersId,
void ContentCompositorBridgeParent::SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) {
const nsTArray<ScrollableLayerGuid>& aTargets) {
MOZ_ASSERT(aLayersId.IsValid());
const CompositorBridgeParent::LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(aLayersId);

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

@ -114,18 +114,18 @@ class ContentCompositorBridgeParent final : public CompositorBridgeParentBase {
void LeaveTestMode(const LayersId& aId) override;
void ApplyAsyncProperties(LayerTransactionParent* aLayerTree,
TransformsToSkip aSkip) override;
void SetTestAsyncScrollOffset(const WRRootId& aLayersId,
void SetTestAsyncScrollOffset(const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const CSSPoint& aPoint) override;
void SetTestAsyncZoom(const WRRootId& aLayersId,
void SetTestAsyncZoom(const LayersId& aLayersId,
const ScrollableLayerGuid::ViewID& aScrollId,
const LayerToParentLayerScale& aZoom) override;
void FlushApzRepaints(const WRRootId& aLayersId) override;
void GetAPZTestData(const WRRootId& aLayersId,
void FlushApzRepaints(const LayersId& aLayersId) override;
void GetAPZTestData(const LayersId& aLayersId,
APZTestData* aOutData) override;
void SetConfirmedTargetAPZC(
const LayersId& aLayersId, const uint64_t& aInputBlockId,
const nsTArray<SLGuidAndRenderRoot>& aTargets) override;
const nsTArray<ScrollableLayerGuid>& aTargets) override;
AsyncCompositionManager* GetCompositionManager(
LayerTransactionParent* aParent) override;

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

@ -99,8 +99,7 @@ struct AutoEndTransaction {
void ImageBridgeChild::UseTextures(
CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) {
const nsTArray<TimedTextureClient>& aTextures) {
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aCompositable->GetIPCHandle());
MOZ_ASSERT(aCompositable->IsConnected());
@ -322,7 +321,7 @@ void ImageBridgeChild::UpdateImageClient(RefPtr<ImageContainer> aContainer) {
}
BeginTransaction();
client->UpdateImage(aContainer, Layer::CONTENT_OPAQUE, Nothing());
client->UpdateImage(aContainer, Layer::CONTENT_OPAQUE);
EndTransaction();
}
@ -361,8 +360,7 @@ void ImageBridgeChild::UpdateAsyncCanvasRendererNow(
}
BeginTransaction();
// TODO wr::RenderRoot::Unknown
aWrapper->GetCanvasClient()->Updated(wr::RenderRoot::Default);
aWrapper->GetCanvasClient()->Updated();
EndTransaction();
}
@ -944,8 +942,7 @@ bool ImageBridgeChild::DestroyInTransaction(const CompositableHandle& aHandle) {
}
void ImageBridgeChild::RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) {
CompositableClient* aCompositable, TextureClient* aTexture) {
MOZ_ASSERT(CanSend());
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aTexture->IsSharedWithCompositor());

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

@ -265,9 +265,9 @@ class ImageBridgeChild final : public PImageBridgeChild,
/**
* See CompositableForwarder::UseTextures
*/
virtual void UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual void UseTextures(
CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures) override;
virtual void UseComponentAlphaTextures(
CompositableClient* aCompositable, TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) override;
@ -294,9 +294,8 @@ class ImageBridgeChild final : public PImageBridgeChild,
virtual bool DestroyInTransaction(PTextureChild* aTexture) override;
bool DestroyInTransaction(const CompositableHandle& aHandle);
virtual void RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) override;
virtual void UseTiledLayerBuffer(
CompositableClient* aCompositable,

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

@ -765,8 +765,8 @@ mozilla::ipc::IPCResult LayerTransactionParent::RecvSetAsyncScrollOffset(
return IPC_FAIL_NO_REASON(this);
}
mCompositorBridge->SetTestAsyncScrollOffset(WRRootId::NonWebRender(GetId()),
aScrollID, CSSPoint(aX, aY));
mCompositorBridge->SetTestAsyncScrollOffset(GetId(), aScrollID,
CSSPoint(aX, aY));
return IPC_OK();
}
@ -776,20 +776,19 @@ mozilla::ipc::IPCResult LayerTransactionParent::RecvSetAsyncZoom(
return IPC_FAIL_NO_REASON(this);
}
mCompositorBridge->SetTestAsyncZoom(WRRootId::NonWebRender(GetId()),
aScrollID,
mCompositorBridge->SetTestAsyncZoom(GetId(), aScrollID,
LayerToParentLayerScale(aValue));
return IPC_OK();
}
mozilla::ipc::IPCResult LayerTransactionParent::RecvFlushApzRepaints() {
mCompositorBridge->FlushApzRepaints(WRRootId::NonWebRender(GetId()));
mCompositorBridge->FlushApzRepaints(GetId());
return IPC_OK();
}
mozilla::ipc::IPCResult LayerTransactionParent::RecvGetAPZTestData(
APZTestData* aOutData) {
mCompositorBridge->GetAPZTestData(WRRootId::NonWebRender(GetId()), aOutData);
mCompositorBridge->GetAPZTestData(GetId(), aOutData);
return IPC_OK();
}
@ -800,16 +799,10 @@ mozilla::ipc::IPCResult LayerTransactionParent::RecvRequestProperty(
}
mozilla::ipc::IPCResult LayerTransactionParent::RecvSetConfirmedTargetAPZC(
const uint64_t& aBlockId, nsTArray<SLGuidAndRenderRoot>&& aTargets) {
const uint64_t& aBlockId, nsTArray<ScrollableLayerGuid>&& aTargets) {
for (size_t i = 0; i < aTargets.Length(); i++) {
// Guard against bad data from hijacked child processes
if (aTargets[i].mRenderRoot != wr::RenderRoot::Default) {
NS_ERROR(
"Unexpected render root in RecvSetConfirmedTargetAPZC; dropping "
"message...");
return IPC_FAIL(this, "Bad render root");
}
if (aTargets[i].mScrollableLayerGuid.mLayersId != GetId()) {
if (aTargets[i].mLayersId != GetId()) {
// Guard against bad data from hijacked child processes
NS_ERROR(
"Unexpected layers id in RecvSetConfirmedTargetAPZC; dropping "
"message...");

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

@ -130,7 +130,7 @@ class LayerTransactionParent final : public PLayerTransactionParent,
mozilla::ipc::IPCResult RecvRequestProperty(const nsString& aProperty,
float* aValue);
mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(
const uint64_t& aBlockId, nsTArray<SLGuidAndRenderRoot>&& aTargets);
const uint64_t& aBlockId, nsTArray<ScrollableLayerGuid>&& aTargets);
mozilla::ipc::IPCResult RecvRecordPaintTimes(const PaintTiming& aTiming);
mozilla::ipc::IPCResult RecvGetTextureFactoryIdentifier(
TextureFactoryIdentifier* aIdentifier);

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

@ -14,7 +14,6 @@
#include "ipc/IPCMessageUtils.h"
#include "ipc/nsGUIEventIPC.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/layers/APZTypes.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/layers/CompositorTypes.h"
@ -26,7 +25,6 @@
#include "mozilla/layers/MatrixMessage.h"
#include "mozilla/layers/RefCountedShmem.h"
#include "mozilla/layers/RepaintRequest.h"
#include "mozilla/layers/WebRenderMessageUtils.h"
#include "VsyncSource.h"
#include "mozilla/Move.h"
@ -489,22 +487,6 @@ struct ParamTraits<mozilla::layers::ScrollableLayerGuid> {
}
};
template <>
struct ParamTraits<mozilla::layers::SLGuidAndRenderRoot> {
typedef mozilla::layers::SLGuidAndRenderRoot paramType;
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mScrollableLayerGuid);
WriteParam(aMsg, aParam.mRenderRoot);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return (ReadParam(aMsg, aIter, &aResult->mScrollableLayerGuid) &&
ReadParam(aMsg, aIter, &aResult->mRenderRoot));
}
};
template <>
struct ParamTraits<mozilla::layers::ZoomConstraints> {
typedef mozilla::layers::ZoomConstraints paramType;
@ -555,17 +537,13 @@ struct ParamTraits<mozilla::layers::FocusTarget::ScrollTargets> {
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mHorizontal);
WriteParam(aMsg, aParam.mHorizontalRenderRoot);
WriteParam(aMsg, aParam.mVertical);
WriteParam(aMsg, aParam.mVerticalRenderRoot);
}
static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mHorizontal) &&
ReadParam(aMsg, aIter, &aResult->mHorizontalRenderRoot) &&
ReadParam(aMsg, aIter, &aResult->mVertical) &&
ReadParam(aMsg, aIter, &aResult->mVerticalRenderRoot);
ReadParam(aMsg, aIter, &aResult->mVertical);
}
};

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

@ -16,12 +16,10 @@ using ScreenPoint from "Units.h";
using mozilla::layers::MaybeZoomConstraints from "mozilla/layers/ZoomConstraints.h";
using struct mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h";
using struct mozilla::layers::SLGuidAndRenderRoot from "mozilla/layers/APZTypes.h";
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/LayersTypes.h";
using mozilla::layers::AsyncDragMetrics from "mozilla/layers/AsyncDragMetrics.h";
using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/GeckoContentController.h";
using class mozilla::layers::KeyboardMap from "mozilla/layers/KeyboardMap.h";
using mozilla::wr::RenderRoot from "mozilla/webrender/WebRenderTypes.h";
using mozilla::Modifiers from "mozilla/EventForwards.h";
using mozilla::PinchGestureInput::PinchGestureType from "InputData.h";
@ -47,13 +45,13 @@ parent:
// These messages correspond to the methods
// on the IAPZCTreeManager interface
async ZoomToRect(SLGuidAndRenderRoot aGuid, CSSRect aRect, uint32_t Flags);
async ZoomToRect(ScrollableLayerGuid aGuid, CSSRect aRect, uint32_t Flags);
async ContentReceivedInputBlock(uint64_t aInputBlockId, bool PreventDefault);
async SetTargetAPZC(uint64_t aInputBlockId, SLGuidAndRenderRoot[] Targets);
async SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] Targets);
async UpdateZoomConstraints(SLGuidAndRenderRoot aGuid, MaybeZoomConstraints aConstraints);
async UpdateZoomConstraints(ScrollableLayerGuid aGuid, MaybeZoomConstraints aConstraints);
async SetKeyboardMap(KeyboardMap aKeyboardMap);
@ -61,11 +59,11 @@ parent:
async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aValues);
async StartScrollbarDrag(SLGuidAndRenderRoot aGuid, AsyncDragMetrics aDragMetrics);
async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
async StartAutoscroll(SLGuidAndRenderRoot aGuid, ScreenPoint aAnchorLocation);
async StartAutoscroll(ScrollableLayerGuid aGuid, ScreenPoint aAnchorLocation);
async StopAutoscroll(SLGuidAndRenderRoot aGuid);
async StopAutoscroll(ScrollableLayerGuid aGuid);
async SetLongTapEnabled(bool aTapGestureEnabled);

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

@ -18,7 +18,7 @@ using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
using mozilla::layers::ScrollableLayerGuid::ViewID from "mozilla/layers/ScrollableLayerGuid.h";
using struct mozilla::layers::SLGuidAndRenderRoot from "mozilla/layers/APZTypes.h";
using struct mozilla::layers::ScrollableLayerGuid 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";
@ -66,7 +66,7 @@ parent:
// Tell the compositor to notify APZ that a layer has been confirmed for an
// input event.
async SetConfirmedTargetAPZC(uint64_t aInputBlockId, SLGuidAndRenderRoot[] aTargets);
async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
// Testing APIs

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

@ -15,7 +15,8 @@ include protocol PCompositorBridge;
include protocol PTexture;
using mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
using struct mozilla::layers::SLGuidAndRenderRoot from "mozilla/layers/APZTypes.h";
using mozilla::layers::ScrollUpdatesMap from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "mozilla/layers/ScrollableLayerGuid.h";
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using mozilla::layers::CompositableHandle from "mozilla/layers/LayersTypes.h";
@ -23,9 +24,7 @@ using mozilla::wr::BuiltDisplayListDescriptor from "mozilla/webrender/webrender_
using mozilla::wr::IdNamespace from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::MaybeIdNamespace from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::ExternalImageKeyPair from "mozilla/webrender/WebRenderTypes.h";
using mozilla::wr::RenderRoot from "mozilla/webrender/WebRenderTypes.h";
using moveonly mozilla::layers::RenderRootDisplayListData from "mozilla/layers/RenderRootTypes.h";
using moveonly mozilla::layers::RenderRootUpdates from "mozilla/layers/RenderRootTypes.h";
using mozilla::layers::WebRenderScrollData from "mozilla/layers/WebRenderScrollData.h";
using mozilla::layers::FocusTarget from "mozilla/layers/FocusTarget.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
@ -46,23 +45,18 @@ parent:
async ReleaseCompositable(CompositableHandle compositable);
async DeleteCompositorAnimations(uint64_t[] aIds);
async SetDisplayList(RenderRootDisplayListData[] displayLists,
OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
IdNamespace aIdNamespace, bool containsSVGGroup,
VsyncId vsyncId, TimeStamp vsyncStartTime,
TimeStamp refreshStartTime, TimeStamp txnStartTime, nsCString txnURL, TimeStamp fwdTime);
async EmptyTransaction(FocusTarget focusTarget, uint32_t aPaintSequenceNumber,
RenderRootUpdates[] renderRootUpdates,
OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
IdNamespace aIdNamespace,
VsyncId vsyncId, TimeStamp vsyncStartTime,
TimeStamp refreshStartTime, TimeStamp txnStartTime,
nsCString txnURL, TimeStamp fwdTime);
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, bool containsSVGGroup, VsyncId vsyncId, TimeStamp vsyncStartTime, TimeStamp refreshStartTime, TimeStamp txnStartTime, nsCString txnURL, TimeStamp fwdTime);
async EmptyTransaction(FocusTarget focusTarget, ScrollUpdatesMap scrollUpdates, uint32_t aPaintSequenceNumber,
WebRenderParentCommand[] commands, OpDestroy[] toDestroy, uint64_t fwdTransactionId, TransactionId transactionId,
OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems,
IdNamespace aIdNamespace, VsyncId vsyncId, TimeStamp vsyncStartTime, TimeStamp refreshStartTime, TimeStamp txnStartTime, nsCString txnURL, TimeStamp fwdTime);
async SetFocusTarget(FocusTarget focusTarget);
async UpdateResources(OpUpdateResource[] aResourceUpdates,
RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems,
RenderRoot aRenderRoot);
async ParentCommands(WebRenderParentCommand[] commands, RenderRoot aRenderRoot);
async UpdateResources(OpUpdateResource[] aResourceUpdates, RefCountedShmem[] aSmallShmems, Shmem[] aLargeShmems);
async ParentCommands(WebRenderParentCommand[] commands);
sync GetSnapshot(PTexture texture);
async SetLayersObserverEpoch(LayersObserverEpoch childEpoch);
async ClearCachedResources();
@ -78,7 +72,7 @@ parent:
// These correspond exactly to the equivalent APIs in PLayerTransaction -
// see those for documentation.
async SetConfirmedTargetAPZC(uint64_t aInputBlockId, SLGuidAndRenderRoot[] aTargets);
async SetConfirmedTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] aTargets);
// More copied from PLayerTransaction, but these are only used for testing.
sync SetTestSampleTime(TimeStamp sampleTime);
sync LeaveTestMode();

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

@ -404,8 +404,7 @@ void ShadowLayerForwarder::UpdateTextureRegion(
void ShadowLayerForwarder::UseTextures(
CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) {
const nsTArray<TimedTextureClient>& aTextures) {
MOZ_ASSERT(aCompositable);
if (!aCompositable->IsConnected()) {
@ -484,8 +483,7 @@ bool ShadowLayerForwarder::DestroyInTransaction(
}
void ShadowLayerForwarder::RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) {
CompositableClient* aCompositable, TextureClient* aTexture) {
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aTexture->GetIPDLActor());

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

@ -217,9 +217,8 @@ class ShadowLayerForwarder final : public LayersIPCActor,
bool DestroyInTransaction(PTextureChild* aTexture) override;
bool DestroyInTransaction(const CompositableHandle& aHandle);
virtual void RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) override;
/**
* Communicate to the compositor that aRegion in the texture identified by
@ -232,9 +231,9 @@ class ShadowLayerForwarder final : public LayersIPCActor,
/**
* See CompositableForwarder::UseTextures
*/
virtual void UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
virtual void UseTextures(
CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures) override;
virtual void UseComponentAlphaTextures(
CompositableClient* aCompositable, TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) override;

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

@ -95,7 +95,6 @@ EXPORTS.mozilla.layers += [
'AnimationInfo.h',
'apz/public/APZInputBridge.h',
'apz/public/APZSampler.h',
'apz/public/APZTypes.h',
'apz/public/APZUpdater.h',
'apz/public/CompositorController.h',
'apz/public/GeckoContentController.h',
@ -246,9 +245,7 @@ EXPORTS.mozilla.layers += [
'wr/AsyncImagePipelineManager.h',
'wr/ClipManager.h',
'wr/IpcResourceUpdateQueue.h',
'wr/RenderRootBoundary.h',
'wr/RenderRootStateManager.h',
'wr/RenderRootTypes.h',
'wr/StackingContextHelper.h',
'wr/WebRenderBridgeChild.h',
'wr/WebRenderBridgeParent.h',
@ -495,7 +492,6 @@ UNIFIED_SOURCES += [
'wr/ClipManager.cpp',
'wr/IpcResourceUpdateQueue.cpp',
'wr/RenderRootStateManager.cpp',
'wr/RenderRootTypes.cpp',
'wr/StackingContextHelper.cpp',
'wr/WebRenderBridgeChild.cpp',
'wr/WebRenderBridgeParent.cpp',

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

@ -27,7 +27,6 @@ AsyncImagePipelineManager::ForwardingExternalImage::~ForwardingExternalImage() {
AsyncImagePipelineManager::AsyncImagePipeline::AsyncImagePipeline()
: mInitialised(false),
mRenderRoot(wr::RenderRoot::Default),
mIsChanged(false),
mUseExternalImage(false),
mFilter(wr::ImageRendering::Auto),
@ -41,13 +40,13 @@ AsyncImagePipelineManager::PipelineUpdates::PipelineUpdates(
mRendered(aRendered) {}
AsyncImagePipelineManager::AsyncImagePipelineManager(
nsTArray<RefPtr<wr::WebRenderAPI>>&& aApis)
: mApis(aApis),
mIdNamespace(mApis[0]->GetNamespace()),
mUseTripleBuffering(mApis[0]->GetUseTripleBuffering()),
already_AddRefed<wr::WebRenderAPI>&& aApi)
: mApi(aApi),
mIdNamespace(mApi->GetNamespace()),
mUseTripleBuffering(mApi->GetUseTripleBuffering()),
mResourceId(0),
mAsyncImageEpoch{0},
mWillGenerateFrame{},
mWillGenerateFrame(false),
mDestroyed(false),
mUpdatesLock("UpdatesLock"),
mUpdatesCount(0) {
@ -60,30 +59,22 @@ AsyncImagePipelineManager::~AsyncImagePipelineManager() {
void AsyncImagePipelineManager::Destroy() {
MOZ_ASSERT(!mDestroyed);
mApis.Clear();
mApi = nullptr;
mPipelineTexturesHolders.Clear();
mDestroyed = true;
}
void AsyncImagePipelineManager::SetWillGenerateFrameAllRenderRoots() {
for (auto renderRoot : wr::kRenderRoots) {
SetWillGenerateFrame(renderRoot);
}
}
void AsyncImagePipelineManager::SetWillGenerateFrame(
wr::RenderRoot aRenderRoot) {
void AsyncImagePipelineManager::SetWillGenerateFrame() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
mWillGenerateFrame[aRenderRoot] = true;
mWillGenerateFrame = true;
}
bool AsyncImagePipelineManager::GetAndResetWillGenerateFrame(
wr::RenderRoot aRenderRoot) {
bool AsyncImagePipelineManager::GetAndResetWillGenerateFrame() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
bool ret = mWillGenerateFrame[aRenderRoot];
mWillGenerateFrame[aRenderRoot] = false;
bool ret = mWillGenerateFrame;
mWillGenerateFrame = false;
return ret;
}
@ -154,8 +145,7 @@ WebRenderBridgeParent* AsyncImagePipelineManager::GetWrBridge(
}
void AsyncImagePipelineManager::AddAsyncImagePipeline(
const wr::PipelineId& aPipelineId, WebRenderImageHost* aImageHost,
wr::RenderRoot aRenderRoot) {
const wr::PipelineId& aPipelineId, WebRenderImageHost* aImageHost) {
if (mDestroyed) {
return;
}
@ -164,7 +154,6 @@ void AsyncImagePipelineManager::AddAsyncImagePipeline(
MOZ_ASSERT(!mAsyncImagePipelines.Get(id));
AsyncImagePipeline* holder = new AsyncImagePipeline();
holder->mRenderRoot = aRenderRoot;
holder->mImageHost = aImageHost;
mAsyncImagePipelines.Put(id, holder);
AddPipeline(aPipelineId, /* aWrBridge */ nullptr);
@ -297,7 +286,7 @@ Maybe<TextureHost::ResourceUpdateOp> AsyncImagePipelineManager::UpdateImageKeys(
aPipeline->mWrTextureWrapper->UpdateWebRenderTextureHost(aMaybeFastTxn,
wrTexture);
// Ensure frame generation.
SetWillGenerateFrame(aPipeline->mRenderRoot);
SetWillGenerateFrame();
} else {
if (useWrTextureWrapper) {
aPipeline->mWrTextureWrapper = new WebRenderTextureHostWrapper(this);
@ -358,8 +347,8 @@ AsyncImagePipelineManager::UpdateWithoutExternalImage(
}
void AsyncImagePipelineManager::ApplyAsyncImagesOfImageBridge(
wr::RenderRootArray<Maybe<wr::TransactionBuilder>>& aSceneBuilderTxns,
wr::RenderRootArray<Maybe<wr::TransactionBuilder>>& aFastTxns) {
wr::TransactionBuilder& aSceneBuilderTxn,
wr::TransactionBuilder& aFastTxn) {
if (mDestroyed || mAsyncImagePipelines.Count() == 0) {
return;
}
@ -375,9 +364,8 @@ void AsyncImagePipelineManager::ApplyAsyncImagesOfImageBridge(
if (!pipeline->mImageHost->GetAsyncRef()) {
continue;
}
ApplyAsyncImageForPipeline(epoch, pipelineId, pipeline,
*aSceneBuilderTxns[pipeline->mRenderRoot],
*aFastTxns[pipeline->mRenderRoot]);
ApplyAsyncImageForPipeline(epoch, pipelineId, pipeline, aSceneBuilderTxn,
aFastTxn);
}
}
@ -468,15 +456,14 @@ void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
const wr::PipelineId& aPipelineId, wr::TransactionBuilder& aTxn,
wr::TransactionBuilder& aTxnForImageBridge, wr::RenderRoot aRenderRoot) {
wr::TransactionBuilder& aTxnForImageBridge) {
AsyncImagePipeline* pipeline =
mAsyncImagePipelines.Get(wr::AsUint64(aPipelineId));
if (!pipeline) {
return;
}
wr::WebRenderAPI* api = mApis[(size_t)pipeline->mRenderRoot];
wr::TransactionBuilder fastTxn(/* aUseSceneBuilderThread */ false);
wr::AutoTransactionSender sender(api, &fastTxn);
wr::AutoTransactionSender sender(mApi, &fastTxn);
// Transaction for async image pipeline that uses ImageBridge always need to
// be non low priority.
@ -683,12 +670,11 @@ void AsyncImagePipelineManager::ProcessPipelineRendered(
}
void AsyncImagePipelineManager::ProcessPipelineRemoved(
const wr::RemovedPipeline& aRemovedPipeline, const uint64_t aUpdatesCount) {
const wr::PipelineId& aPipelineId, const uint64_t aUpdatesCount) {
if (mDestroyed) {
return;
}
if (auto entry = mPipelineTexturesHolders.Lookup(
wr::AsUint64(aRemovedPipeline.pipeline_id))) {
if (auto entry = mPipelineTexturesHolders.Lookup(wr::AsUint64(aPipelineId))) {
PipelineTexturesHolder* holder = entry.Data();
if (holder->mDestroyedEpoch.isSome()) {
while (!holder->mTextureHosts.empty()) {

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

@ -38,8 +38,7 @@ class AsyncImagePipelineManager final {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AsyncImagePipelineManager)
explicit AsyncImagePipelineManager(
nsTArray<RefPtr<wr::WebRenderAPI>>&& aApis);
explicit AsyncImagePipelineManager(already_AddRefed<wr::WebRenderAPI>&& aApi);
protected:
~AsyncImagePipelineManager();
@ -88,8 +87,7 @@ class AsyncImagePipelineManager final {
TimeStamp GetCompositeUntilTime() const { return mCompositeUntilTime; }
void AddAsyncImagePipeline(const wr::PipelineId& aPipelineId,
WebRenderImageHost* aImageHost,
wr::RenderRoot aRenderRoot);
WebRenderImageHost* aImageHost);
void RemoveAsyncImagePipeline(const wr::PipelineId& aPipelineId,
wr::TransactionBuilder& aTxn);
@ -99,13 +97,11 @@ class AsyncImagePipelineManager final {
const gfx::MaybeIntSize& aScaleToSize,
const wr::ImageRendering& aFilter,
const wr::MixBlendMode& aMixBlendMode);
void ApplyAsyncImagesOfImageBridge(
wr::RenderRootArray<Maybe<wr::TransactionBuilder>>& aSceneBuilderTxns,
wr::RenderRootArray<Maybe<wr::TransactionBuilder>>& aFastTxns);
void ApplyAsyncImagesOfImageBridge(wr::TransactionBuilder& aSceneBuilderTxn,
wr::TransactionBuilder& aFastTxn);
void ApplyAsyncImageForPipeline(const wr::PipelineId& aPipelineId,
wr::TransactionBuilder& aTxn,
wr::TransactionBuilder& aTxnForImageBridge,
wr::RenderRoot aRenderRoot);
wr::TransactionBuilder& aTxnForImageBridge);
void SetEmptyDisplayList(const wr::PipelineId& aPipelineId,
wr::TransactionBuilder& aTxn,
@ -121,9 +117,8 @@ class AsyncImagePipelineManager final {
aNotifications->AppendElements(std::move(mImageCompositeNotifications));
}
void SetWillGenerateFrameAllRenderRoots();
void SetWillGenerateFrame(wr::RenderRoot aRenderRoot);
bool GetAndResetWillGenerateFrame(wr::RenderRoot aRenderRoot);
void SetWillGenerateFrame();
bool GetAndResetWillGenerateFrame();
wr::ExternalImageId GetNextExternalImageId();
@ -131,7 +126,7 @@ class AsyncImagePipelineManager final {
void ProcessPipelineRendered(const wr::PipelineId& aPipelineId,
const wr::Epoch& aEpoch,
const uint64_t aUpdatesCount);
void ProcessPipelineRemoved(const wr::RemovedPipeline& aRemovedPipeline,
void ProcessPipelineRemoved(const wr::PipelineId& aPipelineId,
const uint64_t aUpdatesCount);
wr::Epoch GetNextImageEpoch();
@ -196,7 +191,6 @@ class AsyncImagePipelineManager final {
}
bool mInitialised;
wr::RenderRoot mRenderRoot;
bool mIsChanged;
bool mUseExternalImage;
LayoutDeviceRect mScBounds;
@ -229,7 +223,7 @@ class AsyncImagePipelineManager final {
uint64_t aUpdatesCount);
void CheckForTextureHostsNotUsedByGPU();
nsTArray<RefPtr<wr::WebRenderAPI>> mApis;
RefPtr<wr::WebRenderAPI> mApi;
const wr::IdNamespace mIdNamespace;
const bool mUseTripleBuffering;
uint32_t mResourceId;
@ -238,7 +232,7 @@ class AsyncImagePipelineManager final {
mPipelineTexturesHolders;
nsClassHashtable<nsUint64HashKey, AsyncImagePipeline> mAsyncImagePipelines;
wr::Epoch mAsyncImageEpoch;
wr::RenderRootArray<bool> mWillGenerateFrame;
bool mWillGenerateFrame;
bool mDestroyed;
// Render time for the current composition.

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

@ -249,43 +249,22 @@ bool ShmSegmentsReader::Read(const layers::OffsetRange& aRange,
}
IpcResourceUpdateQueue::IpcResourceUpdateQueue(
layers::WebRenderBridgeChild* aAllocator,
wr::RenderRoot aRenderRoot,
size_t aChunkSize)
: mWriter(aAllocator, aChunkSize), mRenderRoot(aRenderRoot) {}
layers::WebRenderBridgeChild* aAllocator, size_t aChunkSize)
: mWriter(aAllocator, aChunkSize) {}
IpcResourceUpdateQueue::IpcResourceUpdateQueue(
IpcResourceUpdateQueue&& aOther) noexcept
: mWriter(std::move(aOther.mWriter)),
mUpdates(std::move(aOther.mUpdates)),
mRenderRoot(aOther.mRenderRoot) {
for (auto renderRoot : wr::kNonDefaultRenderRoots) {
mSubQueues[renderRoot] = std::move(aOther.mSubQueues[renderRoot]);
}
}
mUpdates(std::move(aOther.mUpdates)) {}
IpcResourceUpdateQueue& IpcResourceUpdateQueue::operator=(
IpcResourceUpdateQueue&& aOther) noexcept {
MOZ_ASSERT(IsEmpty(), "Will forget existing updates!");
mWriter = std::move(aOther.mWriter);
mUpdates = std::move(aOther.mUpdates);
mRenderRoot = aOther.mRenderRoot;
for (auto renderRoot : wr::kNonDefaultRenderRoots) {
mSubQueues[renderRoot] = std::move(aOther.mSubQueues[renderRoot]);
}
return *this;
}
void IpcResourceUpdateQueue::ReplaceResources(
IpcResourceUpdateQueue&& aOther) {
MOZ_ASSERT(IsEmpty(), "Will forget existing updates!");
MOZ_ASSERT(!aOther.HasAnySubQueue(), "Subqueues will be lost!");
MOZ_ASSERT(mRenderRoot == aOther.mRenderRoot);
mWriter = std::move(aOther.mWriter);
mUpdates = std::move(aOther.mUpdates);
mRenderRoot = aOther.mRenderRoot;
}
bool IpcResourceUpdateQueue::AddImage(ImageKey key,
const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes) {
@ -429,12 +408,6 @@ bool IpcResourceUpdateQueue::IsEmpty() const {
void IpcResourceUpdateQueue::Clear() {
mWriter.Clear();
mUpdates.Clear();
for (auto& subQueue : mSubQueues) {
if (subQueue) {
subQueue->Clear();
}
}
}
// static

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

@ -16,10 +16,6 @@ namespace mozilla {
namespace ipc {
class IShmemAllocator;
}
namespace layers {
class TextureClient;
}
namespace wr {
/// ShmSegmentsWriter pushes bytes in a sequence of fixed size shmems for small
@ -51,7 +47,6 @@ class ShmSegmentsWriter {
bool IsEmpty() const;
layers::WebRenderBridgeChild* WrBridge() const { return mShmAllocator; }
size_t ChunkSize() const { return mChunkSize; }
protected:
bool AllocChunk();
@ -87,41 +82,8 @@ class IpcResourceUpdateQueue {
// we use here. The RefCountedShmem type used to allocate the chunks keeps a
// 16 bytes header in the buffer which we account for here as well. So we pick
// 64k - 2 * 4k - 16 = 57328 bytes as the default alloc size.
explicit IpcResourceUpdateQueue(
layers::WebRenderBridgeChild* aAllocator,
wr::RenderRoot aRenderRoot = wr::RenderRoot::Default,
size_t aChunkSize = 57328);
// Although resource updates don't belong to a particular document/render root
// in any concrete way, they still end up being tied to a render root because
// we need to know which WR document to generate a frame for when they change.
IpcResourceUpdateQueue& SubQueue(wr::RenderRoot aRenderRoot) {
MOZ_ASSERT(mRenderRoot == wr::RenderRoot::Default);
if (aRenderRoot == wr::RenderRoot::Default) {
MOZ_ASSERT(mRenderRoot == wr::RenderRoot::Default);
return *this;
}
if (!mSubQueues[aRenderRoot]) {
mSubQueues[aRenderRoot] = MakeUnique<IpcResourceUpdateQueue>(
mWriter.WrBridge(), aRenderRoot, mWriter.ChunkSize());
}
return *mSubQueues[aRenderRoot];
}
bool HasAnySubQueue() {
for (auto renderRoot : wr::kNonDefaultRenderRoots) {
if (mSubQueues[renderRoot]) {
return true;
}
}
return false;
}
bool HasSubQueue(wr::RenderRoot aRenderRoot) {
return aRenderRoot == wr::RenderRoot::Default || !!mSubQueues[aRenderRoot];
}
wr::RenderRoot GetRenderRoot() { return mRenderRoot; }
explicit IpcResourceUpdateQueue(layers::WebRenderBridgeChild* aAllocator,
size_t aChunkSize = 57328);
IpcResourceUpdateQueue(IpcResourceUpdateQueue&& aOther) noexcept;
IpcResourceUpdateQueue& operator=(IpcResourceUpdateQueue&& aOther) noexcept;
@ -130,9 +92,6 @@ class IpcResourceUpdateQueue {
IpcResourceUpdateQueue& operator=(const IpcResourceUpdateQueue& aOther) =
delete;
// Moves over everything but the subqueues
void ReplaceResources(IpcResourceUpdateQueue&& aOther);
bool AddImage(wr::ImageKey aKey, const ImageDescriptor& aDescriptor,
Range<uint8_t> aBytes);
@ -193,8 +152,6 @@ class IpcResourceUpdateQueue {
protected:
ShmSegmentsWriter mWriter;
nsTArray<layers::OpUpdateResource> mUpdates;
wr::NonDefaultRenderRootArray<UniquePtr<IpcResourceUpdateQueue>> mSubQueues;
wr::RenderRoot mRenderRoot;
};
} // namespace wr

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

@ -1,87 +0,0 @@
/* 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 GFX_RENDERROOTBOUNDARY_H
#define GFX_RENDERROOTBOUNDARY_H
#include "mozilla/webrender/WebRenderTypes.h"
namespace mozilla {
namespace layers {
// clang-format off
// A display list can have multiple nsDisplayRenderRoot instances in it, one
// at each point that the display list transitions from being in one render root
// to another. In particular, this means that a display list can transition
// from e.g. the "Default" render root to the "Content" render root multiple
// times. When we process this display list in WebRenderCommandBuilder, we build
// a WebRenderScrollData for each render root, and they are "connected" by the
// referent render root property on the WebRenderLayerScrollData instances.
// (This is similar to how the layers id referent property works, i.e. a WRLSD
// item with a referent is an attachment point for a subtree from a different
// render root.) But given that there are multiple transitions to the same
// "child" render root, we need an additional data point to uniquely identify
// each of the transitions, so that we can attach the correct scroll data
// subtree at each transition. Failure to uniquely identify the transitions
// means that the entire "child" render root's scroll data tree will get
// attached at each transition. The RenderRootBoundary class serves this
// purpose.
//
// Example time! Consider the following display list structure:
//
// R // root of the display list
// / \ //
// A B // items in Default render root that generate scroll data
// / / \ //
// C D E // nsDisplayRenderRoot items transitioning to content
// / \ / //
// F G H // items in Content render root that generate scroll data
//
// In this example, the Default render root WebRenderScrollData will contain
// 6 WRLSD items, one for each of R, A, B, C, D, E. Of these, C, D, and E will
// have mReferentRenderRoot properties set. The WebRenderScrollData for the
// Content render root will end up looking like this:
//
// Dummy root //
// / \ //
// C-Root E-Root //
// / | | //
// F G H //
//
// The RenderRootBoundary item on C will point to C-Root, and likewise for E.
// The RenderRootBoundary item on D will be valid, but there will be no
// corresponding subtree in the Content-side WebRenderScrollData. C-Root and
// E-Root are created via WebRenderScrollDataCollection::AppendWrapper, and
// have their mBoundaryRoot property set to the same RenderRootBoundary value
// as the mReferentRenderRoot properties from C and E respectively.
// clang-format on
class RenderRootBoundary {
public:
explicit RenderRootBoundary(wr::RenderRoot aChildType)
: mChildType(aChildType) {
static uint64_t sCounter = 0;
mId = ++sCounter;
}
wr::RenderRoot GetChildType() const { return mChildType; }
bool operator==(const RenderRootBoundary& aOther) const {
return mChildType == aOther.mChildType && mId == aOther.mId;
}
friend struct IPC::ParamTraits<RenderRootBoundary>;
// constructor for IPC
RenderRootBoundary() = default;
private:
wr::RenderRoot mChildType;
// The id is what distinguishes different transition points within a display
// list (i.e. what would be different in C, D, and E in the example above).
uint64_t mId;
};
} // namespace layers
} // namespace mozilla
#endif // GFX_RENDERROOTBOUNDARY_H

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

@ -11,6 +11,12 @@
namespace mozilla {
namespace layers {
RenderRootStateManager::RenderRootStateManager(
WebRenderLayerManager* aLayerManager)
: mLayerManager(aLayerManager), mDestroyed(false) {}
RenderRootStateManager::~RenderRootStateManager() {}
// RenderRootStateManager shares its ref count with the WebRenderLayerManager
// that created it. You can think of the two classes as being one unit, except
// there are multiple RenderRootStateManagers per WebRenderLayerManager. Since
@ -35,10 +41,9 @@ RenderRootStateManager::GetWebRenderUserDataTable() {
wr::IpcResourceUpdateQueue& RenderRootStateManager::AsyncResourceUpdates() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(XRE_IsParentProcess() || mRenderRoot == wr::RenderRoot::Default);
if (!mAsyncResourceUpdates) {
mAsyncResourceUpdates.emplace(WrBridge(), mRenderRoot);
mAsyncResourceUpdates.emplace(WrBridge());
RefPtr<Runnable> task = NewRunnableMethod(
"RenderRootStateManager::FlushAsyncResourceUpdates", this,
@ -72,7 +77,7 @@ void RenderRootStateManager::FlushAsyncResourceUpdates() {
}
if (!IsDestroyed() && WrBridge()) {
WrBridge()->UpdateResources(mAsyncResourceUpdates.ref(), mRenderRoot);
WrBridge()->UpdateResources(mAsyncResourceUpdates.ref());
}
mAsyncResourceUpdates.reset();
@ -175,41 +180,38 @@ void RenderRootStateManager::WrReleasedImages(
void RenderRootStateManager::AddWebRenderParentCommand(
const WebRenderParentCommand& aCmd) {
WrBridge()->AddWebRenderParentCommand(aCmd, mRenderRoot);
WrBridge()->AddWebRenderParentCommand(aCmd);
}
void RenderRootStateManager::UpdateResources(
wr::IpcResourceUpdateQueue& aResources) {
WrBridge()->UpdateResources(aResources, mRenderRoot);
WrBridge()->UpdateResources(aResources);
}
void RenderRootStateManager::AddPipelineIdForAsyncCompositable(
const wr::PipelineId& aPipelineId, const CompositableHandle& aHandle) {
WrBridge()->AddPipelineIdForAsyncCompositable(aPipelineId, aHandle,
mRenderRoot);
WrBridge()->AddPipelineIdForAsyncCompositable(aPipelineId, aHandle);
}
void RenderRootStateManager::AddPipelineIdForCompositable(
const wr::PipelineId& aPipelineId, const CompositableHandle& aHandle) {
WrBridge()->AddPipelineIdForCompositable(aPipelineId, aHandle, mRenderRoot);
WrBridge()->AddPipelineIdForCompositable(aPipelineId, aHandle);
}
void RenderRootStateManager::RemovePipelineIdForCompositable(
const wr::PipelineId& aPipelineId) {
WrBridge()->RemovePipelineIdForCompositable(aPipelineId, mRenderRoot);
WrBridge()->RemovePipelineIdForCompositable(aPipelineId);
}
/// Release TextureClient that is bounded to ImageKey.
/// It is used for recycling TextureClient.
void RenderRootStateManager::ReleaseTextureOfImage(const wr::ImageKey& aKey) {
WrBridge()->ReleaseTextureOfImage(aKey, mRenderRoot);
WrBridge()->ReleaseTextureOfImage(aKey);
}
Maybe<wr::FontInstanceKey> RenderRootStateManager::GetFontKeyForScaledFont(
gfx::ScaledFont* aScaledFont, wr::IpcResourceUpdateQueue* aResources) {
return WrBridge()->GetFontKeyForScaledFont(aScaledFont, mRenderRoot,
aResources);
return WrBridge()->GetFontKeyForScaledFont(aScaledFont, aResources);
}
Maybe<wr::FontKey> RenderRootStateManager::GetFontKeyForUnscaledFont(
gfx::UnscaledFont* aUnscaledFont, wr::IpcResourceUpdateQueue* aResources) {
return WrBridge()->GetFontKeyForUnscaledFont(aUnscaledFont, mRenderRoot,
aResources);
return WrBridge()->GetFontKeyForUnscaledFont(aUnscaledFont, aResources);
}
} // namespace layers

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

@ -10,7 +10,6 @@
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/layers/IpcResourceUpdateQueue.h"
#include "mozilla/layers/SharedSurfacesChild.h"
#include "mozilla/layers/WebRenderCommandBuilder.h"
namespace mozilla {
@ -25,14 +24,10 @@ class RenderRootStateManager {
void AddRef();
void Release();
RenderRootStateManager()
: mLayerManager(nullptr),
mRenderRoot(wr::RenderRoot::Default),
mDestroyed(false) {}
explicit RenderRootStateManager(WebRenderLayerManager* aLayerManager);
void Destroy();
bool IsDestroyed() { return mDestroyed; }
wr::RenderRoot GetRenderRoot() { return mRenderRoot; }
wr::IpcResourceUpdateQueue& AsyncResourceUpdates();
WebRenderBridgeChild* WrBridge() const;
WebRenderCommandBuilder& CommandBuilder();
@ -79,6 +74,7 @@ class RenderRootStateManager {
void FlushAsyncResourceUpdates();
private:
~RenderRootStateManager();
WebRenderLayerManager* mLayerManager;
Maybe<wr::IpcResourceUpdateQueue> mAsyncResourceUpdates;
nsTArray<wr::ImageKey> mImageKeysToDelete;
@ -93,7 +89,6 @@ class RenderRootStateManager {
// the compositor to discard information for.
nsTArray<uint64_t> mDiscardedCompositorAnimationsIds;
wr::RenderRoot mRenderRoot;
bool mDestroyed;
friend class WebRenderLayerManager;

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

@ -1,75 +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 "RenderRootTypes.h"
#include "mozilla/layers/WebRenderMessageUtils.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
namespace mozilla {
namespace ipc {
void IPDLParamTraits<mozilla::layers::RenderRootDisplayListData>::Write(IPC::Message* aMsg,
IProtocol* aActor,
paramType&& aParam) {
WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot);
WriteIPDLParam(aMsg, aActor, aParam.mRect);
WriteIPDLParam(aMsg, aActor, aParam.mCommands);
WriteIPDLParam(aMsg, aActor, aParam.mContentSize);
WriteIPDLParam(aMsg, aActor, std::move(aParam.mDL));
WriteIPDLParam(aMsg, aActor, aParam.mDLDesc);
WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates);
WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems);
WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems));
WriteIPDLParam(aMsg, aActor, aParam.mScrollData);
}
bool IPDLParamTraits<mozilla::layers::RenderRootDisplayListData>::Read(const IPC::Message* aMsg,
PickleIterator* aIter,
IProtocol* aActor,
paramType* aResult) {
if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRect) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mContentSize) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDL) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLDesc) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollData)) {
return true;
}
return false;
}
void IPDLParamTraits<mozilla::layers::RenderRootUpdates>::Write(IPC::Message* aMsg,
IProtocol* aActor,
paramType&& aParam) {
WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot);
WriteIPDLParam(aMsg, aActor, aParam.mCommands);
WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates);
WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems);
WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems));
WriteIPDLParam(aMsg, aActor, aParam.mScrollUpdates);
}
bool IPDLParamTraits<mozilla::layers::RenderRootUpdates>::Read(const IPC::Message* aMsg,
PickleIterator* aIter,
IProtocol* aActor,
paramType* aResult) {
if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) &&
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollUpdates)) {
return true;
}
return false;
}
} // namespace ipc
} // namespace mozilla

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

@ -1,68 +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 GFX_RENDERROOTTYPES_H
#define GFX_RENDERROOTTYPES_H
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/WebRenderScrollData.h"
namespace mozilla {
namespace layers {
struct RenderRootDisplayListData {
wr::RenderRoot mRenderRoot;
gfx::IntRect mRect;
nsTArray<WebRenderParentCommand> mCommands;
wr::LayoutSize mContentSize;
Maybe<mozilla::ipc::ByteBuf> mDL;
wr::BuiltDisplayListDescriptor mDLDesc;
nsTArray<OpUpdateResource> mResourceUpdates;
nsTArray<RefCountedShmem> mSmallShmems;
nsTArray<mozilla::ipc::Shmem> mLargeShmems;
Maybe<WebRenderScrollData> mScrollData;
};
struct RenderRootUpdates {
wr::RenderRoot mRenderRoot;
nsTArray<WebRenderParentCommand> mCommands;
nsTArray<OpUpdateResource> mResourceUpdates;
nsTArray<RefCountedShmem> mSmallShmems;
nsTArray<mozilla::ipc::Shmem> mLargeShmems;
ScrollUpdatesMap mScrollUpdates;
};
} // namespace layers
namespace ipc {
template <>
struct IPDLParamTraits<mozilla::layers::RenderRootDisplayListData> {
typedef mozilla::layers::RenderRootDisplayListData paramType;
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam);
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
IProtocol* aActor, paramType* aResult);
};
template <>
struct IPDLParamTraits<mozilla::layers::RenderRootUpdates> {
typedef mozilla::layers::RenderRootUpdates paramType;
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam);
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
IProtocol* aActor, paramType* aResult);
};
} // namespace ipc
} // namespace mozilla
#endif /* GFX_RENDERROOTTYPES_H */

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

@ -32,7 +32,6 @@ StackingContextHelper::StackingContextHelper(
mIsPreserve3D(aParams.transform_style == wr::TransformStyle::Preserve3D),
mRasterizeLocally(aParams.mRasterizeLocally ||
aParentSC.mRasterizeLocally) {
mOrigin = aParentSC.mOrigin + aBounds.TopLeft();
// Compute scale for fallback rendering. We don't try to guess a scale for 3d
// transformed items
gfx::Matrix transform2d;

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

@ -48,10 +48,6 @@ class MOZ_RAII StackingContextHelper {
// Export the inherited scale
gfx::Size GetInheritedScale() const { return mScale; }
const gfx::Matrix& GetInheritedTransform() const {
return mInheritedTransform;
}
const gfx::Matrix& GetSnappingSurfaceTransform() const {
return mSnappingSurfaceTransform;
}
@ -62,13 +58,10 @@ class MOZ_RAII StackingContextHelper {
bool AffectsClipPositioning() const { return mAffectsClipPositioning; }
Maybe<wr::WrSpatialId> ReferenceFrameId() const { return mReferenceFrameId; }
const LayoutDevicePoint& GetOrigin() const { return mOrigin; }
private:
wr::DisplayListBuilder* mBuilder;
gfx::Size mScale;
gfx::Matrix mInheritedTransform;
LayoutDevicePoint mOrigin;
// The "snapping surface" defines the space that we want to snap in.
// You can think of it as the nearest physical surface.

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

@ -31,8 +31,8 @@ WebRenderBridgeChild::WebRenderBridgeChild(const wr::PipelineId& aPipelineId)
mManager(nullptr),
mIPCOpen(false),
mDestroyed(false),
mFontKeysDeleted(),
mFontInstanceKeysDeleted() {}
mFontKeysDeleted(0),
mFontInstanceKeysDeleted(0) {}
WebRenderBridgeChild::~WebRenderBridgeChild() {
MOZ_ASSERT(NS_IsMainThread());
@ -71,10 +71,8 @@ void WebRenderBridgeChild::DoDestroy() {
}
void WebRenderBridgeChild::AddWebRenderParentCommand(
const WebRenderParentCommand& aCmd, wr::RenderRoot aRenderRoot) {
MOZ_ASSERT(aRenderRoot == wr::RenderRoot::Default ||
(XRE_IsParentProcess() && gfxPrefs::WebRenderSplitRenderRoots()));
mParentCommands[aRenderRoot].AppendElement(aCmd);
const WebRenderParentCommand& aCmd) {
mParentCommands.AppendElement(aCmd);
}
void WebRenderBridgeChild::BeginTransaction() {
@ -85,7 +83,7 @@ void WebRenderBridgeChild::BeginTransaction() {
}
void WebRenderBridgeChild::UpdateResources(
wr::IpcResourceUpdateQueue& aResources, wr::RenderRoot aRenderRoot) {
wr::IpcResourceUpdateQueue& aResources) {
if (!IPCOpen()) {
aResources.Clear();
return;
@ -101,43 +99,46 @@ void WebRenderBridgeChild::UpdateResources(
aResources.Flush(resourceUpdates, smallShmems, largeShmems);
this->SendUpdateResources(resourceUpdates, smallShmems,
std::move(largeShmems), aRenderRoot);
std::move(largeShmems));
}
void WebRenderBridgeChild::EndTransaction(
nsTArray<RenderRootDisplayListData>& aRenderRoots,
TransactionId aTransactionId, bool aContainsSVGGroup,
const mozilla::VsyncId& aVsyncId, const mozilla::TimeStamp& aVsyncStartTime,
const wr::LayoutSize& aContentSize, wr::BuiltDisplayList& aDL,
wr::IpcResourceUpdateQueue& aResources, const gfx::IntSize& aSize,
TransactionId aTransactionId, const WebRenderScrollData& aScrollData,
bool aContainsSVGGroup, const mozilla::VsyncId& aVsyncId,
const mozilla::TimeStamp& aVsyncStartTime,
const mozilla::TimeStamp& aRefreshStartTime,
const mozilla::TimeStamp& aTxnStartTime, const nsCString& aTxnURL) {
MOZ_ASSERT(!mDestroyed);
MOZ_ASSERT(mIsInTransaction);
ByteBuf dlData(aDL.dl.inner.data, aDL.dl.inner.length, aDL.dl.inner.capacity);
aDL.dl.inner.capacity = 0;
aDL.dl.inner.data = nullptr;
TimeStamp fwdTime = TimeStamp::Now();
for (auto& renderRoot : aRenderRoots) {
MOZ_ASSERT(
renderRoot.mRenderRoot == wr::RenderRoot::Default ||
(XRE_IsParentProcess() && gfxPrefs::WebRenderSplitRenderRoots()));
renderRoot.mCommands = std::move(mParentCommands[renderRoot.mRenderRoot]);
}
nsTArray<OpUpdateResource> resourceUpdates;
nsTArray<RefCountedShmem> smallShmems;
nsTArray<ipc::Shmem> largeShmems;
aResources.Flush(resourceUpdates, smallShmems, largeShmems);
this->SendSetDisplayList(std::move(aRenderRoots), mDestroyedActors,
GetFwdTransactionId(), aTransactionId, mIdNamespace,
aContainsSVGGroup, aVsyncId, aVsyncStartTime,
aRefreshStartTime, aTxnStartTime, aTxnURL, fwdTime);
this->SendSetDisplayList(
aSize, mParentCommands, mDestroyedActors, GetFwdTransactionId(),
aTransactionId, aContentSize, std::move(dlData), aDL.dl_desc, aScrollData,
resourceUpdates, smallShmems, std::move(largeShmems), mIdNamespace,
aContainsSVGGroup, aVsyncId, aVsyncStartTime, aRefreshStartTime,
aTxnStartTime, aTxnURL, fwdTime);
// With multiple render roots, we may not have sent all of our
// mParentCommands, so go ahead and go through our mParentCommands and ensure
// they get sent.
ProcessWebRenderParentCommands();
mParentCommands.Clear();
mDestroyedActors.Clear();
mIsInTransaction = false;
}
void WebRenderBridgeChild::EndEmptyTransaction(
const FocusTarget& aFocusTarget,
nsTArray<RenderRootUpdates>& aRenderRootUpdates,
const FocusTarget& aFocusTarget, const ScrollUpdatesMap& aUpdates,
Maybe<wr::IpcResourceUpdateQueue>& aResources,
uint32_t aPaintSequenceNumber, TransactionId aTransactionId,
const mozilla::VsyncId& aVsyncId, const mozilla::TimeStamp& aVsyncStartTime,
const mozilla::TimeStamp& aRefreshStartTime,
@ -147,23 +148,20 @@ void WebRenderBridgeChild::EndEmptyTransaction(
TimeStamp fwdTime = TimeStamp::Now();
for (auto& update : aRenderRootUpdates) {
MOZ_ASSERT(
update.mRenderRoot == wr::RenderRoot::Default ||
(XRE_IsParentProcess() && gfxPrefs::WebRenderSplitRenderRoots()));
update.mCommands = std::move(mParentCommands[update.mRenderRoot]);
nsTArray<OpUpdateResource> resourceUpdates;
nsTArray<RefCountedShmem> smallShmems;
nsTArray<ipc::Shmem> largeShmems;
if (aResources) {
aResources->Flush(resourceUpdates, smallShmems, largeShmems);
aResources.reset();
}
this->SendEmptyTransaction(
aFocusTarget, aPaintSequenceNumber, std::move(aRenderRootUpdates),
mDestroyedActors, GetFwdTransactionId(), aTransactionId, mIdNamespace,
aVsyncId, aVsyncStartTime, aRefreshStartTime, aTxnStartTime, aTxnURL,
fwdTime);
// With multiple render roots, we may not have sent all of our
// mParentCommands, so go ahead and go through our mParentCommands and ensure
// they get sent.
ProcessWebRenderParentCommands();
aFocusTarget, aUpdates, aPaintSequenceNumber, mParentCommands,
mDestroyedActors, GetFwdTransactionId(), aTransactionId, resourceUpdates,
smallShmems, std::move(largeShmems), mIdNamespace, aVsyncId,
aVsyncStartTime, aRefreshStartTime, aTxnStartTime, aTxnURL, fwdTime);
mParentCommands.Clear();
mDestroyedActors.Clear();
mIsInTransaction = false;
}
@ -171,36 +169,28 @@ void WebRenderBridgeChild::EndEmptyTransaction(
void WebRenderBridgeChild::ProcessWebRenderParentCommands() {
MOZ_ASSERT(!mDestroyed);
for (auto renderRoot : wr::kRenderRoots) {
if (!mParentCommands[renderRoot].IsEmpty()) {
MOZ_ASSERT(renderRoot == wr::RenderRoot::Default ||
gfxPrefs::WebRenderSplitRenderRoots());
this->SendParentCommands(mParentCommands[renderRoot], renderRoot);
mParentCommands[renderRoot].Clear();
}
if (mParentCommands.IsEmpty()) {
return;
}
this->SendParentCommands(mParentCommands);
mParentCommands.Clear();
}
void WebRenderBridgeChild::AddPipelineIdForAsyncCompositable(
const wr::PipelineId& aPipelineId, const CompositableHandle& aHandle,
wr::RenderRoot aRenderRoot) {
const wr::PipelineId& aPipelineId, const CompositableHandle& aHandle) {
AddWebRenderParentCommand(
OpAddPipelineIdForCompositable(aPipelineId, aHandle, /* isAsync */ true),
aRenderRoot);
OpAddPipelineIdForCompositable(aPipelineId, aHandle, /* isAsync */ true));
}
void WebRenderBridgeChild::AddPipelineIdForCompositable(
const wr::PipelineId& aPipelineId, const CompositableHandle& aHandle,
wr::RenderRoot aRenderRoot) {
AddWebRenderParentCommand(
OpAddPipelineIdForCompositable(aPipelineId, aHandle, /* isAsync */ false),
aRenderRoot);
const wr::PipelineId& aPipelineId, const CompositableHandle& aHandle) {
AddWebRenderParentCommand(OpAddPipelineIdForCompositable(
aPipelineId, aHandle, /* isAsync */ false));
}
void WebRenderBridgeChild::RemovePipelineIdForCompositable(
const wr::PipelineId& aPipelineId, wr::RenderRoot aRenderRoot) {
AddWebRenderParentCommand(OpRemovePipelineIdForCompositable(aPipelineId),
aRenderRoot);
const wr::PipelineId& aPipelineId) {
AddWebRenderParentCommand(OpRemovePipelineIdForCompositable(aPipelineId));
}
wr::ExternalImageId WebRenderBridgeChild::GetNextExternalImageId() {
@ -210,9 +200,8 @@ wr::ExternalImageId WebRenderBridgeChild::GetNextExternalImageId() {
return id.value();
}
void WebRenderBridgeChild::ReleaseTextureOfImage(const wr::ImageKey& aKey,
wr::RenderRoot aRenderRoot) {
AddWebRenderParentCommand(OpReleaseTextureOfImage(aKey), aRenderRoot);
void WebRenderBridgeChild::ReleaseTextureOfImage(const wr::ImageKey& aKey) {
AddWebRenderParentCommand(OpReleaseTextureOfImage(aKey));
}
struct FontFileDataSink {
@ -251,8 +240,7 @@ void WebRenderBridgeChild::PushGlyphs(
const wr::GlyphOptions* aGlyphOptions) {
MOZ_ASSERT(aFont);
Maybe<wr::WrFontInstanceKey> key =
GetFontKeyForScaledFont(aFont, aBuilder.GetRenderRoot());
Maybe<wr::WrFontInstanceKey> key = GetFontKeyForScaledFont(aFont);
MOZ_ASSERT(key.isSome());
if (key.isSome()) {
@ -262,15 +250,13 @@ void WebRenderBridgeChild::PushGlyphs(
}
Maybe<wr::FontInstanceKey> WebRenderBridgeChild::GetFontKeyForScaledFont(
gfx::ScaledFont* aScaledFont, wr::RenderRoot aRenderRoot,
wr::IpcResourceUpdateQueue* aResources) {
gfx::ScaledFont* aScaledFont, wr::IpcResourceUpdateQueue* aResources) {
MOZ_ASSERT(!mDestroyed);
MOZ_ASSERT(aScaledFont);
MOZ_ASSERT(aScaledFont->CanSerialize());
auto& fontInstanceKeys = mFontInstanceKeys[aRenderRoot];
wr::FontInstanceKey instanceKey = {wr::IdNamespace{0}, 0};
if (fontInstanceKeys.Get(aScaledFont, &instanceKey)) {
if (mFontInstanceKeys.Get(aScaledFont, &instanceKey)) {
return Some(instanceKey);
}
@ -278,8 +264,8 @@ Maybe<wr::FontInstanceKey> WebRenderBridgeChild::GetFontKeyForScaledFont(
aResources ? Nothing() : Some(wr::IpcResourceUpdateQueue(this));
aResources = resources.ptrOr(aResources);
Maybe<wr::FontKey> fontKey = GetFontKeyForUnscaledFont(
aScaledFont->GetUnscaledFont(), aRenderRoot, aResources);
Maybe<wr::FontKey> fontKey =
GetFontKeyForUnscaledFont(aScaledFont->GetUnscaledFont(), aResources);
if (fontKey.isNothing()) {
return Nothing();
}
@ -297,22 +283,20 @@ Maybe<wr::FontInstanceKey> WebRenderBridgeChild::GetFontKeyForScaledFont(
options.ptrOr(nullptr), platformOptions.ptrOr(nullptr),
Range<const FontVariation>(variations.data(), variations.size()));
if (resources.isSome()) {
UpdateResources(resources.ref(), aRenderRoot);
UpdateResources(resources.ref());
}
fontInstanceKeys.Put(aScaledFont, instanceKey);
mFontInstanceKeys.Put(aScaledFont, instanceKey);
return Some(instanceKey);
}
Maybe<wr::FontKey> WebRenderBridgeChild::GetFontKeyForUnscaledFont(
gfx::UnscaledFont* aUnscaled, wr::RenderRoot aRenderRoot,
wr::IpcResourceUpdateQueue* aResources) {
gfx::UnscaledFont* aUnscaled, wr::IpcResourceUpdateQueue* aResources) {
MOZ_ASSERT(!mDestroyed);
auto& fontKeys = mFontKeys[aRenderRoot];
wr::FontKey fontKey = {wr::IdNamespace{0}, 0};
if (!fontKeys.Get(aUnscaled, &fontKey)) {
if (!mFontKeys.Get(aUnscaled, &fontKey)) {
Maybe<wr::IpcResourceUpdateQueue> resources =
aResources ? Nothing() : Some(wr::IpcResourceUpdateQueue(this));
@ -328,10 +312,10 @@ Maybe<wr::FontKey> WebRenderBridgeChild::GetFontKeyForUnscaledFont(
}
if (resources.isSome()) {
UpdateResources(resources.ref(), aRenderRoot);
UpdateResources(resources.ref());
}
fontKeys.Put(aUnscaled, fontKey);
mFontKeys.Put(aUnscaled, fontKey);
}
return Some(fontKey);
@ -339,16 +323,10 @@ Maybe<wr::FontKey> WebRenderBridgeChild::GetFontKeyForUnscaledFont(
void WebRenderBridgeChild::RemoveExpiredFontKeys(
wr::IpcResourceUpdateQueue& aResourceUpdates) {
auto& fontInstanceKeys = mFontInstanceKeys[aResourceUpdates.GetRenderRoot()];
auto& fontKeys = mFontKeys[aResourceUpdates.GetRenderRoot()];
auto& fontInstanceKeysDeleted =
mFontInstanceKeysDeleted[aResourceUpdates.GetRenderRoot()];
auto& fontKeysDeleted = mFontKeysDeleted[aResourceUpdates.GetRenderRoot()];
uint32_t counter = gfx::ScaledFont::DeletionCounter();
if (fontInstanceKeysDeleted != counter) {
fontInstanceKeysDeleted = counter;
for (auto iter = fontInstanceKeys.Iter(); !iter.Done(); iter.Next()) {
if (mFontInstanceKeysDeleted != counter) {
mFontInstanceKeysDeleted = counter;
for (auto iter = mFontInstanceKeys.Iter(); !iter.Done(); iter.Next()) {
if (!iter.Key()) {
aResourceUpdates.DeleteFontInstance(iter.Data());
iter.Remove();
@ -356,9 +334,9 @@ void WebRenderBridgeChild::RemoveExpiredFontKeys(
}
}
counter = gfx::UnscaledFont::DeletionCounter();
if (fontKeysDeleted != counter) {
fontKeysDeleted = counter;
for (auto iter = fontKeys.Iter(); !iter.Done(); iter.Next()) {
if (mFontKeysDeleted != counter) {
mFontKeysDeleted = counter;
for (auto iter = mFontKeys.Iter(); !iter.Done(); iter.Next()) {
if (!iter.Key()) {
aResourceUpdates.DeleteFont(iter.Data());
iter.Remove();
@ -442,8 +420,7 @@ bool WebRenderBridgeChild::DestroyInTransaction(
}
void WebRenderBridgeChild::RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) {
CompositableClient* aCompositable, TextureClient* aTexture) {
MOZ_ASSERT(aCompositable);
MOZ_ASSERT(aTexture);
MOZ_ASSERT(aTexture->GetIPDLActor());
@ -454,16 +431,14 @@ void WebRenderBridgeChild::RemoveTextureFromCompositable(
return;
}
AddWebRenderParentCommand(
CompositableOperation(aCompositable->GetIPCHandle(),
OpRemoveTexture(nullptr, aTexture->GetIPDLActor())),
*aRenderRoot);
AddWebRenderParentCommand(CompositableOperation(
aCompositable->GetIPCHandle(),
OpRemoveTexture(nullptr, aTexture->GetIPDLActor())));
}
void WebRenderBridgeChild::UseTextures(
CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) {
const nsTArray<TimedTextureClient>& aTextures) {
MOZ_ASSERT(aCompositable);
if (!aCompositable->IsConnected()) {
@ -486,8 +461,7 @@ void WebRenderBridgeChild::UseTextures(
t.mTextureClient);
}
AddWebRenderParentCommand(CompositableOperation(aCompositable->GetIPCHandle(),
OpUseTexture(textures)),
*aRenderRoot);
OpUseTexture(textures)));
}
void WebRenderBridgeChild::UseComponentAlphaTextures(
@ -517,10 +491,8 @@ mozilla::ipc::IPCResult WebRenderBridgeChild::RecvWrUpdated(
mIdNamespace = aNewIdNamespace;
// Just clear FontInstaceKeys/FontKeys, they are removed during WebRenderAPI
// destruction.
for (auto renderRoot : wr::kRenderRoots) {
mFontInstanceKeys[renderRoot].Clear();
mFontKeys[renderRoot].Clear();
}
mFontInstanceKeys.Clear();
mFontKeys.Clear();
return IPC_OK();
}

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

@ -64,24 +64,23 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
public:
explicit WebRenderBridgeChild(const wr::PipelineId& aPipelineId);
void AddWebRenderParentCommand(const WebRenderParentCommand& aCmd,
wr::RenderRoot aRenderRoot);
bool HasWebRenderParentCommands(wr::RenderRoot aRenderRoot) {
return !mParentCommands[aRenderRoot].IsEmpty();
}
void AddWebRenderParentCommand(const WebRenderParentCommand& aCmd);
void UpdateResources(wr::IpcResourceUpdateQueue& aResources,
wr::RenderRoot aRenderRoot);
void UpdateResources(wr::IpcResourceUpdateQueue& aResources);
void BeginTransaction();
void EndTransaction(nsTArray<RenderRootDisplayListData>& aRenderRoots,
TransactionId aTransactionId, bool aContainsSVGroup,
const mozilla::VsyncId& aVsyncId,
void EndTransaction(const wr::LayoutSize& aContentSize,
wr::BuiltDisplayList& dl,
wr::IpcResourceUpdateQueue& aResources,
const gfx::IntSize& aSize, TransactionId aTransactionId,
const WebRenderScrollData& aScrollData,
bool aContainsSVGroup, const mozilla::VsyncId& aVsyncId,
const mozilla::TimeStamp& aVsyncStartTime,
const mozilla::TimeStamp& aRefreshStartTime,
const mozilla::TimeStamp& aTxnStartTime,
const nsCString& aTxtURL);
void EndEmptyTransaction(const FocusTarget& aFocusTarget,
nsTArray<RenderRootUpdates>& aRenderRootUpdates,
const ScrollUpdatesMap& aUpdates,
Maybe<wr::IpcResourceUpdateQueue>& aResources,
uint32_t aPaintSequenceNumber,
TransactionId aTransactionId,
const mozilla::VsyncId& aVsyncId,
@ -104,18 +103,14 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
}
void AddPipelineIdForAsyncCompositable(const wr::PipelineId& aPipelineId,
const CompositableHandle& aHandlee,
wr::RenderRoot aRenderRoot);
const CompositableHandle& aHandlee);
void AddPipelineIdForCompositable(const wr::PipelineId& aPipelineId,
const CompositableHandle& aHandlee,
wr::RenderRoot aRenderRoot);
void RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId,
wr::RenderRoot aRenderRoot);
const CompositableHandle& aHandlee);
void RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId);
/// Release TextureClient that is bounded to ImageKey.
/// It is used for recycling TextureClient.
void ReleaseTextureOfImage(const wr::ImageKey& aKey,
wr::RenderRoot aRenderRoot);
void ReleaseTextureOfImage(const wr::ImageKey& aKey);
/**
* Clean this up, finishing with SendShutDown() which will cause __delete__
@ -152,10 +147,10 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
const wr::GlyphOptions* aGlyphOptions = nullptr);
Maybe<wr::FontInstanceKey> GetFontKeyForScaledFont(
gfx::ScaledFont* aScaledFont, wr::RenderRoot aRenderRoot,
gfx::ScaledFont* aScaledFont,
wr::IpcResourceUpdateQueue* aResources = nullptr);
Maybe<wr::FontKey> GetFontKeyForUnscaledFont(
gfx::UnscaledFont* aUnscaledFont, wr::RenderRoot aRenderRoot,
gfx::UnscaledFont* aUnscaledFont,
wr::IpcResourceUpdateQueue* aResources = nullptr);
void RemoveExpiredFontKeys(wr::IpcResourceUpdateQueue& aResources);
@ -202,12 +197,10 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
void ReleaseCompositable(const CompositableHandle& aHandle) override;
bool DestroyInTransaction(PTextureChild* aTexture) override;
bool DestroyInTransaction(const CompositableHandle& aHandle);
void RemoveTextureFromCompositable(
CompositableClient* aCompositable, TextureClient* aTexture,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
void RemoveTextureFromCompositable(CompositableClient* aCompositable,
TextureClient* aTexture) override;
void UseTextures(CompositableClient* aCompositable,
const nsTArray<TimedTextureClient>& aTextures,
const Maybe<wr::RenderRoot>& aRenderRoot) override;
const nsTArray<TimedTextureClient>& aTextures) override;
void UseComponentAlphaTextures(CompositableClient* aCompositable,
TextureClient* aClientOnBlack,
TextureClient* aClientOnWhite) override;
@ -238,8 +231,8 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
bool AddOpDestroy(const OpDestroy& aOp);
nsTArray<WebRenderParentCommand> mParentCommands;
nsTArray<OpDestroy> mDestroyedActors;
wr::RenderRootArray<nsTArray<WebRenderParentCommand>> mParentCommands;
nsDataHashtable<nsUint64HashKey, CompositableClient*> mCompositables;
bool mIsInTransaction;
bool mIsInClearCachedResources;
@ -251,13 +244,11 @@ class WebRenderBridgeChild final : public PWebRenderBridgeChild,
bool mIPCOpen;
bool mDestroyed;
wr::RenderRootArray<uint32_t> mFontKeysDeleted;
wr::RenderRootArray<nsDataHashtable<UnscaledFontHashKey, wr::FontKey>>
mFontKeys;
uint32_t mFontKeysDeleted;
nsDataHashtable<UnscaledFontHashKey, wr::FontKey> mFontKeys;
wr::RenderRootArray<uint32_t> mFontInstanceKeysDeleted;
wr::RenderRootArray<nsDataHashtable<ScaledFontHashKey, wr::FontInstanceKey>>
mFontInstanceKeys;
uint32_t mFontInstanceKeysDeleted;
nsDataHashtable<ScaledFontHashKey, wr::FontInstanceKey> mFontInstanceKeys;
UniquePtr<ActiveResourceTracker> mActiveResourceTracker;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -59,7 +59,7 @@ class WebRenderBridgeParent final
const wr::PipelineId& aPipelineId,
widget::CompositorWidget* aWidget,
CompositorVsyncScheduler* aScheduler,
nsTArray<RefPtr<wr::WebRenderAPI>>&& aApis,
RefPtr<wr::WebRenderAPI>&& aApi,
RefPtr<AsyncImagePipelineManager>&& aImageMgr,
RefPtr<CompositorAnimationStorage>&& aAnimStorage,
TimeDuration aVsyncRate);
@ -68,25 +68,8 @@ class WebRenderBridgeParent final
const wr::PipelineId& aPipelineId);
wr::PipelineId PipelineId() { return mPipelineId; }
bool CloneWebRenderAPIs(nsTArray<RefPtr<wr::WebRenderAPI>>& aOutAPIs) {
for (auto& api : mApis) {
RefPtr<wr::WebRenderAPI> clone = api->Clone();
if (!clone) {
return false;
}
aOutAPIs.AppendElement(clone);
}
return true;
}
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPIAtPoint(
const gfx::IntPoint& aPoint);
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI(
wr::RenderRoot aRenderRoot) {
if ((size_t)aRenderRoot >= mApis.Length()) {
return nullptr;
}
return do_AddRef(mApis[(int)aRenderRoot]);
already_AddRefed<wr::WebRenderAPI> GetWebRenderAPI() {
return do_AddRef(mApi);
}
AsyncImagePipelineManager* AsyncImageManager() { return mAsyncImageManager; }
CompositorVsyncScheduler* CompositorScheduler() {
@ -112,30 +95,38 @@ class WebRenderBridgeParent final
mozilla::ipc::IPCResult RecvUpdateResources(
nsTArray<OpUpdateResource>&& aUpdates,
nsTArray<RefCountedShmem>&& aSmallShmems,
nsTArray<ipc::Shmem>&& aLargeShmems,
const wr::RenderRoot& aRenderRoot) override;
nsTArray<ipc::Shmem>&& aLargeShmems) override;
mozilla::ipc::IPCResult RecvSetDisplayList(
nsTArray<RenderRootDisplayListData>&& aDisplayLists,
const gfx::IntSize& aSize,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId, const TransactionId& aTransactionId,
const wr::IdNamespace& aIdNamespace, const bool& aContainsSVGGroup,
const VsyncId& aVsyncId, const TimeStamp& aVsyncStartTime,
const TimeStamp& aRefreshStartTime, const TimeStamp& aTxnStartTime,
const nsCString& aTxnURL, const TimeStamp& aFwdTime) override;
mozilla::ipc::IPCResult RecvEmptyTransaction(
const FocusTarget& aFocusTarget, const uint32_t& aPaintSequenceNumber,
nsTArray<RenderRootUpdates>&& aRenderRootUpdates,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId, const TransactionId& aTransactionId,
const wr::IdNamespace& aIdNamespace, const VsyncId& aVsyncId,
const wr::LayoutSize& aContentSize, ipc::ByteBuf&& dl,
const wr::BuiltDisplayListDescriptor& dlDesc,
const WebRenderScrollData& aScrollData,
nsTArray<OpUpdateResource>&& aResourceUpdates,
nsTArray<RefCountedShmem>&& aSmallShmems,
nsTArray<ipc::Shmem>&& aLargeShmems, const wr::IdNamespace& aIdNamespace,
const bool& aContainsSVGGroup, const VsyncId& aVsyncId,
const TimeStamp& aVsyncStartTime, const TimeStamp& aRefreshStartTime,
const TimeStamp& aTxnStartTime, const nsCString& aTxnURL,
const TimeStamp& aFwdTime) override;
mozilla::ipc::IPCResult RecvEmptyTransaction(
const FocusTarget& aFocusTarget, const ScrollUpdatesMap& aUpdates,
const uint32_t& aPaintSequenceNumber,
InfallibleTArray<WebRenderParentCommand>&& aCommands,
InfallibleTArray<OpDestroy>&& aToDestroy,
const uint64_t& aFwdTransactionId, const TransactionId& aTransactionId,
nsTArray<OpUpdateResource>&& aResourceUpdates,
nsTArray<RefCountedShmem>&& aSmallShmems,
nsTArray<ipc::Shmem>&& aLargeShmems, const wr::IdNamespace& aIdNamespace,
const VsyncId& aVsyncId, const TimeStamp& aVsyncStartTime,
const TimeStamp& aRefreshStartTime, const TimeStamp& aTxnStartTime,
const nsCString& aTxnURL, const TimeStamp& aFwdTime) override;
mozilla::ipc::IPCResult RecvSetFocusTarget(
const FocusTarget& aFocusTarget) override;
mozilla::ipc::IPCResult RecvParentCommands(
nsTArray<WebRenderParentCommand>&& commands,
const wr::RenderRoot& aRenderRoot) override;
nsTArray<WebRenderParentCommand>&& commands) override;
mozilla::ipc::IPCResult RecvGetSnapshot(PTextureParent* aTexture) override;
mozilla::ipc::IPCResult RecvSetLayersObserverEpoch(
@ -148,7 +139,7 @@ class WebRenderBridgeParent final
mozilla::ipc::IPCResult RecvSetConfirmedTargetAPZC(
const uint64_t& aBlockId,
nsTArray<SLGuidAndRenderRoot>&& aTargets) override;
nsTArray<ScrollableLayerGuid>&& aTargets) override;
mozilla::ipc::IPCResult RecvSetTestSampleTime(
const TimeStamp& aTime) override;
@ -228,8 +219,7 @@ class WebRenderBridgeParent final
* Call CompositorVsyncScheduler::ScheduleComposition() directly, if we just
* want to trigger AsyncImagePipelines update checks.
*/
void ScheduleGenerateFrame(const Maybe<wr::RenderRoot>& aRenderRoot);
void ScheduleGenerateFrameAllRenderRoots();
void ScheduleGenerateFrame();
/**
* Schedule forced frame rendering at next composite timing.
@ -239,12 +229,10 @@ class WebRenderBridgeParent final
*/
void ScheduleForcedGenerateFrame();
void NotifyDidSceneBuild(wr::RenderRoot aRenderRoot,
RefPtr<wr::WebRenderPipelineInfo> aInfo);
void NotifyDidSceneBuild(RefPtr<wr::WebRenderPipelineInfo> aInfo);
wr::Epoch UpdateWebRender(
CompositorVsyncScheduler* aScheduler,
nsTArray<RefPtr<wr::WebRenderAPI>>&& aApis,
CompositorVsyncScheduler* aScheduler, wr::WebRenderAPI* aApi,
AsyncImagePipelineManager* aImageMgr,
CompositorAnimationStorage* aAnimStorage,
const TextureFactoryIdentifier& aTextureFactoryIdentifier);
@ -263,7 +251,6 @@ class WebRenderBridgeParent final
bool IsRootWebRenderBridgeParent() const;
LayersId GetLayersId() const;
WRRootId GetWRRootId() const;
private:
class ScheduleSharedSurfaceRelease;
@ -271,46 +258,11 @@ class WebRenderBridgeParent final
explicit WebRenderBridgeParent(const wr::PipelineId& aPipelineId);
virtual ~WebRenderBridgeParent();
wr::WebRenderAPI* Api(wr::RenderRoot aRenderRoot) {
if (IsRootWebRenderBridgeParent()) {
return mApis[(size_t)aRenderRoot];
} else {
MOZ_ASSERT(aRenderRoot == wr::RenderRoot::Default);
return mApis[(size_t)mRenderRoot];
}
}
// Within WebRenderBridgeParent, we can use wr::RenderRoot::Default to
// refer to DefaultApi(), which can be the content API if this
// WebRenderBridgeParent is for a content WebRenderBridgeChild. However,
// different WebRenderBridgeParents use the same AsyncImagePipelineManager,
// for example, which doesn't have this distinction, so we need to
// convert out our RenderRoot.
wr::RenderRoot RenderRootForExternal(wr::RenderRoot aRenderRoot) {
if (IsRootWebRenderBridgeParent()) {
return aRenderRoot;
} else {
MOZ_ASSERT(aRenderRoot == wr::RenderRoot::Default);
return mRenderRoot;
}
}
bool SetDisplayList(wr::RenderRoot aRenderRoot, const gfx::IntRect& aRect,
const wr::LayoutSize& aContentSize, ipc::ByteBuf&& aDL,
const wr::BuiltDisplayListDescriptor& aDLDesc,
const nsTArray<OpUpdateResource>& aResourceUpdates,
const nsTArray<RefCountedShmem>& aSmallShmems,
const nsTArray<ipc::Shmem>& aLargeShmems,
const TimeStamp& aTxnStartTime,
wr::TransactionBuilder& aTxn, wr::Epoch aWrEpoch,
bool aValidTransaction, bool aObserveLayersUpdate);
void UpdateAPZFocusState(const FocusTarget& aFocus);
void UpdateAPZScrollData(const wr::Epoch& aEpoch, WebRenderScrollData&& aData,
wr::RenderRoot aRenderRoot);
void UpdateAPZScrollData(const wr::Epoch& aEpoch,
WebRenderScrollData&& aData);
void UpdateAPZScrollOffsets(ScrollUpdatesMap&& aUpdates,
uint32_t aPaintSequenceNumber,
wr::RenderRoot aRenderRoot);
uint32_t aPaintSequenceNumber);
bool UpdateResources(const nsTArray<OpUpdateResource>& aResourceUpdates,
const nsTArray<RefCountedShmem>& aSmallShmems,
@ -334,18 +286,16 @@ class WebRenderBridgeParent final
const CompositableHandle& aHandle,
const bool& aAsync,
wr::TransactionBuilder& aTxn,
wr::TransactionBuilder& aTxnForImageBridge,
const wr::RenderRoot& aRenderRoot);
wr::TransactionBuilder& aTxnForImageBridge);
void RemovePipelineIdForCompositable(const wr::PipelineId& aPipelineId,
wr::TransactionBuilder& aTxn,
wr::RenderRoot aRenderRoot);
wr::TransactionBuilder& aTxn);
void DeleteImage(const wr::ImageKey& aKey, wr::TransactionBuilder& aUpdates);
void ReleaseTextureOfImage(const wr::ImageKey& aKey);
bool ProcessWebRenderParentCommands(
const InfallibleTArray<WebRenderParentCommand>& aCommands,
wr::TransactionBuilder& aTxn, wr::RenderRoot aRenderRoot);
wr::TransactionBuilder& aTxn);
void ClearResources();
bool ShouldParentObserveEpoch();
@ -354,9 +304,8 @@ class WebRenderBridgeParent final
// Returns true if there is any animation (including animations in delay
// phase).
bool AdvanceAnimations();
bool SampleAnimations(
wr::RenderRootArray<nsTArray<wr::WrOpacityProperty>>& aOpacityArrays,
wr::RenderRootArray<nsTArray<wr::WrTransformProperty>>& aTransformArrays);
bool SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
nsTArray<wr::WrTransformProperty>& aTransformArray);
CompositorBridgeParent* GetRootCompositorBridgeParent() const;
@ -435,7 +384,7 @@ class WebRenderBridgeParent final
CompositorBridgeParentBase* MOZ_NON_OWNING_REF mCompositorBridge;
wr::PipelineId mPipelineId;
RefPtr<widget::CompositorWidget> mWidget;
nsTArray<RefPtr<wr::WebRenderAPI>> mApis;
RefPtr<wr::WebRenderAPI> mApi;
RefPtr<AsyncImagePipelineManager> mAsyncImageManager;
RefPtr<CompositorVsyncScheduler> mCompositorScheduler;
RefPtr<CompositorAnimationStorage> mAnimStorage;
@ -443,8 +392,7 @@ class WebRenderBridgeParent final
// WebRenderBridgeParent is destroyed abnormally and Tab move between
// different windows.
std::unordered_map<uint64_t, wr::Epoch> mActiveAnimations;
wr::RenderRootArray<std::unordered_map<uint64_t, RefPtr<WebRenderImageHost>>>
mAsyncCompositables;
std::unordered_map<uint64_t, RefPtr<WebRenderImageHost>> mAsyncCompositables;
std::unordered_map<uint64_t, CompositableTextureHostRef> mTextureHosts;
std::unordered_map<uint64_t, wr::ExternalImageId> mSharedSurfaceIds;
@ -465,12 +413,6 @@ class WebRenderBridgeParent final
VsyncId mSkippedCompositeId;
TimeStamp mMostRecentComposite;
// Kind of clunky, but I can't sort out a more elegant way of getting this to
// work.
Mutex mRenderRootRectMutex;
wr::NonDefaultRenderRootArray<IntRect> mRenderRootRects;
wr::RenderRoot mRenderRoot;
bool mPaused;
bool mDestroyed;
bool mReceivedDisplayList;

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

@ -83,7 +83,7 @@ void WebRenderCanvasRendererAsync::Destroy() {
void WebRenderCanvasRendererAsync::
UpdateCompositableClientForEmptyTransaction() {
UpdateCompositableClient(mManager->GetRenderRoot());
UpdateCompositableClient();
if (mPipelineId.isSome()) {
// Notify an update of async image pipeline during empty transaction.
// During non empty transaction, WebRenderBridgeParent receives

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

@ -300,7 +300,7 @@ struct DIGroup {
// mImageBounds clipped to the container/parent of the
// current item being processed.
IntRect mClippedImageBounds;
Maybe<mozilla::Pair<wr::RenderRoot, wr::BlobImageKey>> mKey;
Maybe<wr::BlobImageKey> mKey;
std::vector<RefPtr<SourceSurface>> mExternalSurfaces;
std::vector<RefPtr<ScaledFont>> mFonts;
@ -331,7 +331,7 @@ struct DIGroup {
void ClearImageKey(RenderRootStateManager* aManager, bool aForce = false) {
if (mKey) {
MOZ_RELEASE_ASSERT(aForce || mInvalidRect.IsEmpty());
aManager->AddBlobImageKeyForDiscard(mKey.value().second());
aManager->AddBlobImageKeyForDiscard(mKey.value());
mKey = Nothing();
}
mFonts.clear();
@ -632,7 +632,7 @@ struct DIGroup {
GP("End EndGroup\n");
if (mKey) {
aResources.SetBlobImageVisibleArea(
mKey.value().second(),
mKey.value(),
ViewAs<ImagePixel>(mPaintRect,
PixelCastJustification::LayerIsImage));
PushImage(aBuilder, bounds);
@ -652,7 +652,7 @@ struct DIGroup {
for (auto& scaled : aScaledFonts) {
Maybe<wr::FontInstanceKey> key =
aWrManager->WrBridge()->GetFontKeyForScaledFont(
scaled, aBuilder.GetRenderRoot(), &aResources);
scaled, &aResources);
if (key.isNothing()) {
validFonts = false;
break;
@ -679,9 +679,7 @@ struct DIGroup {
bool empty = aStartItem == aEndItem;
if (empty) {
ClearImageKey(
aWrManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()),
true);
ClearImageKey(aWrManager->GetRenderRootStateManager(), true);
return;
}
@ -692,10 +690,8 @@ struct DIGroup {
// Contains(paintBounds);?
wr::OpacityType opacity = wr::OpacityType::HasAlphaChannel;
TakeExternalSurfaces(
recorder, mExternalSurfaces,
aWrManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()),
aResources);
TakeExternalSurfaces(recorder, mExternalSurfaces,
aWrManager->GetRenderRootStateManager(), aResources);
bool hasItems = recorder->Finish();
GP("%d Finish\n", hasItems);
if (!validFonts) {
@ -716,7 +712,7 @@ struct DIGroup {
if (!aResources.AddBlobImage(key, descriptor, bytes)) {
return;
}
mKey = Some(MakePair(aBuilder.GetRenderRoot(), key));
mKey = Some(key);
} else {
wr::ImageDescriptor descriptor(dtSize, 0, dt->GetFormat(), opacity);
auto bottomRight = mInvalidRect.BottomRight();
@ -726,7 +722,7 @@ struct DIGroup {
bottomRight.y <= dtSize.height);
GP("Update Blob %d %d %d %d\n", mInvalidRect.x, mInvalidRect.y,
mInvalidRect.width, mInvalidRect.height);
if (!aResources.UpdateBlobImage(mKey.value().second(), descriptor, bytes,
if (!aResources.UpdateBlobImage(mKey.value(), descriptor, bytes,
ViewAs<ImagePixel>(mInvalidRect))) {
return;
}
@ -734,7 +730,7 @@ struct DIGroup {
mFonts = std::move(fonts);
mInvalidRect.SetEmpty();
aResources.SetBlobImageVisibleArea(
mKey.value().second(),
mKey.value(),
ViewAs<ImagePixel>(mPaintRect, PixelCastJustification::LayerIsImage));
PushImage(aBuilder, bounds);
GP("End EndGroup\n\n");
@ -760,7 +756,7 @@ struct DIGroup {
aBuilder.SetHitTestInfo(mScrollId, hitInfo);
aBuilder.PushImage(dest, dest, !backfaceHidden,
wr::ToImageRendering(sampleFilter),
wr::AsImageKey(mKey.value().second()));
wr::AsImageKey(mKey.value()));
aBuilder.ClearHitTestInfo();
}
@ -1010,62 +1006,6 @@ void Grouper::PaintContainerItem(DIGroup* aGroup, nsDisplayItem* aItem,
}
}
size_t WebRenderScrollDataCollection::GetLayerCount(
wr::RenderRoot aRoot) const {
return mInternalScrollDatas[aRoot].size();
}
void WebRenderScrollDataCollection::AppendRoot(
Maybe<ScrollMetadata>& aRootMetadata,
wr::RenderRootArray<WebRenderScrollData>& aScrollDatas) {
mSeenRenderRoot[wr::RenderRoot::Default] = true;
for (auto renderRoot : wr::kRenderRoots) {
if (mSeenRenderRoot[renderRoot]) {
auto& layerScrollData = mInternalScrollDatas[renderRoot];
layerScrollData.emplace_back();
layerScrollData.back().InitializeRoot(layerScrollData.size() - 1);
if (aRootMetadata) {
layerScrollData.back().AppendScrollMetadata(aScrollDatas[renderRoot],
aRootMetadata.ref());
}
}
}
}
void WebRenderScrollDataCollection::AppendWrapper(
const RenderRootBoundary& aBoundary, size_t aLayerCountBeforeRecursing) {
wr::RenderRoot root = aBoundary.GetChildType();
size_t layerCountAfterRecursing = GetLayerCount(root);
MOZ_ASSERT(layerCountAfterRecursing >= aLayerCountBeforeRecursing);
if (layerCountAfterRecursing == aLayerCountBeforeRecursing) {
// nothing to wrap
return;
}
mInternalScrollDatas[root].emplace_back();
mInternalScrollDatas[root].back().InitializeRoot(layerCountAfterRecursing -
aLayerCountBeforeRecursing);
mInternalScrollDatas[root].back().SetBoundaryRoot(aBoundary);
}
void WebRenderScrollDataCollection::AppendScrollData(
const wr::DisplayListBuilder& aBuilder, WebRenderLayerManager* aManager,
nsDisplayItem* aItem, size_t aLayerCountBeforeRecursing,
const ActiveScrolledRoot* aStopAtAsr,
const Maybe<gfx::Matrix4x4>& aAncestorTransform) {
wr::RenderRoot renderRoot = aBuilder.GetRenderRoot();
mSeenRenderRoot[renderRoot] = true;
int descendants =
mInternalScrollDatas[renderRoot].size() - aLayerCountBeforeRecursing;
mInternalScrollDatas[renderRoot].emplace_back();
mInternalScrollDatas[renderRoot].back().Initialize(
aManager->GetScrollData(renderRoot), aItem, descendants, aStopAtAsr,
aAncestorTransform, renderRoot);
}
class WebRenderGroupData : public WebRenderUserData {
public:
explicit WebRenderGroupData(RenderRootStateManager* aWRManager,
@ -1162,7 +1102,6 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
item);
{
MOZ_ASSERT(item->GetType() != DisplayItemType::TYPE_RENDER_ROOT);
auto spaceAndClipChain = mClipManager.SwitchItem(item);
wr::SpaceAndClipChainHelper saccHelper(aBuilder, spaceAndClipChain);
@ -1170,8 +1109,7 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
// Note: this call to CreateWebRenderCommands can recurse back into
// this function.
RenderRootStateManager* manager =
aCommandBuilder->mManager->GetRenderRootStateManager(
aBuilder.GetRenderRoot());
aCommandBuilder->mManager->GetRenderRootStateManager();
bool createdWRCommands = item->CreateWebRenderCommands(
aBuilder, aResources, aSc, manager, mDisplayListBuilder);
sIndent--;
@ -1183,7 +1121,7 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
RefPtr<WebRenderGroupData> groupData =
aCommandBuilder->CreateOrRecycleWebRenderUserData<WebRenderGroupData>(
item, aBuilder.GetRenderRoot());
item);
// Initialize groupData->mFollowingGroup
// TODO: compute the group bounds post-grouping, so that they can be
@ -1207,8 +1145,7 @@ void Grouper::ConstructGroups(nsDisplayListBuilder* aDisplayListBuilder,
GP("Inner group size change\n");
groupData->mFollowingGroup.ClearItems();
groupData->mFollowingGroup.ClearImageKey(
aCommandBuilder->mManager->GetRenderRootStateManager(
aBuilder.GetRenderRoot()));
aCommandBuilder->mManager->GetRenderRootStateManager());
}
groupData->mFollowingGroup.mGroupBounds = currentGroup->mGroupBounds;
groupData->mFollowingGroup.mAppUnitsPerDevPixel =
@ -1348,9 +1285,8 @@ static mozilla::gfx::IntRect ScaleToOutsidePixelsOffset(
return rect;
}
RenderRootStateManager* WebRenderCommandBuilder::GetRenderRootStateManager(
wr::RenderRoot aRenderRoot) {
return mManager->GetRenderRootStateManager(aRenderRoot);
RenderRootStateManager* WebRenderCommandBuilder::GetRenderRootStateManager() {
return mManager->GetRenderRootStateManager();
}
void WebRenderCommandBuilder::DoGroupingForDisplayList(
@ -1363,16 +1299,15 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
GP("DoGroupingForDisplayList\n");
mCurrentClipManager->BeginList(aSc);
Grouper g(*mCurrentClipManager);
mClipManager.BeginList(aSc);
Grouper g(mClipManager);
int32_t appUnitsPerDevPixel =
aWrappingItem->Frame()->PresContext()->AppUnitsPerDevPixel();
g.mDisplayListBuilder = aDisplayListBuilder;
RefPtr<WebRenderGroupData> groupData =
CreateOrRecycleWebRenderUserData<WebRenderGroupData>(
aWrappingItem, aBuilder.GetRenderRoot());
CreateOrRecycleWebRenderUserData<WebRenderGroupData>(aWrappingItem);
bool snapped;
nsRect groupBounds =
@ -1430,8 +1365,7 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
}
group.ClearItems();
group.ClearImageKey(
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()));
group.ClearImageKey(mManager->GetRenderRootStateManager());
}
ScrollableLayerGuid::ViewID scrollId = ScrollableLayerGuid::NULL_SCROLL_ID;
@ -1468,7 +1402,7 @@ void WebRenderCommandBuilder::DoGroupingForDisplayList(
group.mScrollId = scrollId;
g.ConstructGroups(aDisplayListBuilder, this, aBuilder, aResources, &group,
aList, aSc);
mCurrentClipManager->EndList(aSc);
mClipManager.EndList(aSc);
}
void WebRenderCommandBuilder::Destroy() {
@ -1494,26 +1428,19 @@ bool WebRenderCommandBuilder::NeedsEmptyTransaction() {
void WebRenderCommandBuilder::BuildWebRenderCommands(
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResourceUpdates, nsDisplayList* aDisplayList,
nsDisplayListBuilder* aDisplayListBuilder,
wr::RenderRootArray<WebRenderScrollData>& aScrollDatas,
WrFiltersHolder&& aFilters) {
nsDisplayListBuilder* aDisplayListBuilder, WebRenderScrollData& aScrollData,
wr::LayoutSize& aContentSize, WrFiltersHolder&& aFilters) {
AUTO_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_WRDisplayList);
wr::RenderRootArray<StackingContextHelper> rootScs;
MOZ_ASSERT(aBuilder.GetRenderRoot() == wr::RenderRoot::Default);
for (auto renderRoot : wr::kRenderRoots) {
aScrollDatas[renderRoot] = WebRenderScrollData(mManager);
if (aBuilder.HasSubBuilder(renderRoot)) {
mClipManagers[renderRoot].BeginBuild(mManager,
aBuilder.SubBuilder(renderRoot));
}
}
MOZ_ASSERT(mLayerScrollDatas.IsEmpty());
StackingContextHelper sc;
aScrollData = WebRenderScrollData(mManager);
MOZ_ASSERT(mLayerScrollData.empty());
mLastCanvasDatas.Clear();
mLastAsr = nullptr;
mBuilderDumpIndex = 0;
mContainsSVGGroup = false;
MOZ_ASSERT(mDumpIndent == 0);
mClipManager.BeginBuild(mManager, aBuilder);
{
nsPresContext* presContext =
@ -1521,64 +1448,46 @@ void WebRenderCommandBuilder::BuildWebRenderCommands(
bool isTopLevelContent =
presContext->Document()->IsTopLevelContentDocument();
wr::RenderRootArray<Maybe<StackingContextHelper>> pageRootScs;
for (auto renderRoot : wr::kRenderRoots) {
if (aBuilder.HasSubBuilder(renderRoot)) {
wr::StackingContextParams params;
// Just making this explicit - we assume that we do not want any
// filters traversing a RenderRoot boundary
if (renderRoot == wr::RenderRoot::Default) {
params.mFilters = std::move(aFilters.filters);
params.mFilterDatas = std::move(aFilters.filter_datas);
}
params.cache_tiles = isTopLevelContent;
params.clip = wr::WrStackingContextClip::ClipChain(
aBuilder.SubBuilder(renderRoot).CurrentClipChainId());
pageRootScs[renderRoot].emplace(
rootScs[renderRoot], nullptr, nullptr, nullptr,
aBuilder.SubBuilder(renderRoot), params);
}
}
wr::StackingContextParams params;
params.mFilters = std::move(aFilters.filters);
params.mFilterDatas = std::move(aFilters.filter_datas);
params.cache_tiles = isTopLevelContent;
params.clip =
wr::WrStackingContextClip::ClipChain(aBuilder.CurrentClipChainId());
StackingContextHelper pageRootSc(sc, nullptr, nullptr, nullptr, aBuilder,
params);
if (ShouldDumpDisplayList(aDisplayListBuilder)) {
mBuilderDumpIndex =
aBuilder.Dump(mDumpIndent + 1, Some(mBuilderDumpIndex), Nothing());
}
MOZ_ASSERT(mRootStackingContexts == nullptr);
AutoRestore<wr::RenderRootArray<Maybe<StackingContextHelper>>*> rootScs(
mRootStackingContexts);
mRootStackingContexts = &pageRootScs;
CreateWebRenderCommandsFromDisplayList(
aDisplayList, nullptr, aDisplayListBuilder,
*pageRootScs[wr::RenderRoot::Default], aBuilder, aResourceUpdates);
CreateWebRenderCommandsFromDisplayList(aDisplayList, nullptr,
aDisplayListBuilder, pageRootSc,
aBuilder, aResourceUpdates);
}
// Make a "root" layer data that has everything else as descendants
mLayerScrollData.emplace_back();
mLayerScrollData.back().InitializeRoot(mLayerScrollData.size() - 1);
auto callback =
[&aScrollDatas](ScrollableLayerGuid::ViewID aScrollId) -> bool {
for (auto renderRoot : wr::kRenderRoots) {
if (aScrollDatas[renderRoot].HasMetadataFor(aScrollId).isSome()) {
return true;
}
}
return false;
[&aScrollData](ScrollableLayerGuid::ViewID aScrollId) -> bool {
return aScrollData.HasMetadataFor(aScrollId).isSome();
};
Maybe<ScrollMetadata> rootMetadata = nsLayoutUtils::GetRootMetadata(
aDisplayListBuilder, mManager, ContainerLayerParameters(), callback);
mLayerScrollDatas.AppendRoot(rootMetadata, aScrollDatas);
for (auto renderRoot : wr::kRenderRoots) {
// Append the WebRenderLayerScrollData items into WebRenderScrollData
// in reverse order, from topmost to bottommost. This is in keeping with
// the semantics of WebRenderScrollData.
for (auto it = mLayerScrollDatas[renderRoot].crbegin();
it != mLayerScrollDatas[renderRoot].crend(); it++) {
aScrollDatas[renderRoot].AddLayerData(*it);
}
if (aBuilder.HasSubBuilder(renderRoot)) {
mClipManagers[renderRoot].EndBuild();
}
if (Maybe<ScrollMetadata> rootMetadata = nsLayoutUtils::GetRootMetadata(
aDisplayListBuilder, mManager, ContainerLayerParameters(),
callback)) {
mLayerScrollData.back().AppendScrollMetadata(aScrollData,
rootMetadata.ref());
}
mLayerScrollDatas.Clear();
// Append the WebRenderLayerScrollData items into WebRenderScrollData
// in reverse order, from topmost to bottommost. This is in keeping with
// the semantics of WebRenderScrollData.
for (auto i = mLayerScrollData.crbegin(); i != mLayerScrollData.crend();
i++) {
aScrollData.AddLayerData(*i);
}
mLayerScrollData.clear();
mClipManager.EndBuild();
// Remove the user data those are not displayed on the screen and
// also reset the data to unused for next transaction.
@ -1596,8 +1505,6 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
nsDisplayList* aDisplayList, nsDisplayItem* aWrappingItem,
nsDisplayListBuilder* aDisplayListBuilder, const StackingContextHelper& aSc,
wr::DisplayListBuilder& aBuilder, wr::IpcResourceUpdateQueue& aResources) {
AutoRestore<ClipManager*> prevClipManager(mCurrentClipManager);
mCurrentClipManager = &mClipManagers[aBuilder.GetRenderRoot()];
if (mDoGrouping) {
MOZ_RELEASE_ASSERT(
aWrappingItem,
@ -1618,7 +1525,7 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
}
mDumpIndent++;
mCurrentClipManager->BeginList(aSc);
mClipManager.BeginList(aSc);
bool apzEnabled = mManager->AsyncPanZoomEnabled();
@ -1636,8 +1543,7 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
}
bool forceNewLayerData = false;
size_t layerCountBeforeRecursing =
mLayerScrollDatas.GetLayerCount(aBuilder.GetRenderRoot());
size_t layerCountBeforeRecursing = mLayerScrollData.size();
if (apzEnabled) {
// For some types of display items we want to force a new
// WebRenderLayerScrollData object, to ensure we preserve the APZ-relevant
@ -1678,7 +1584,7 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
// This is where we emulate the clip/scroll stack that was previously
// implemented on the WR display list side.
auto spaceAndClipChain = mCurrentClipManager->SwitchItem(item);
auto spaceAndClipChain = mClipManager.SwitchItem(item);
wr::SpaceAndClipChainHelper saccHelper(aBuilder, spaceAndClipChain);
{ // scope restoreDoGrouping
@ -1728,8 +1634,7 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
// Note: this call to CreateWebRenderCommands can recurse back into
// this function if the |item| is a wrapper for a sublist.
item->SetPaintRect(item->GetBuildingRect());
RenderRootStateManager* manager =
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot());
RenderRootStateManager* manager = mManager->GetRenderRootStateManager();
bool createdWRCommands = item->CreateWebRenderCommands(
aBuilder, aResources, aSc, manager, aDisplayListBuilder);
if (!createdWRCommands) {
@ -1750,6 +1655,9 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
const ActiveScrolledRoot* stopAtAsr =
mAsrStack.empty() ? nullptr : mAsrStack.back();
int32_t descendants =
mLayerScrollData.size() - layerCountBeforeRecursing;
// See the comments on StackingContextHelper::mDeferredTransformItem
// for an overview of what deferred transforms are.
// In the case where we deferred a transform, but have a child display
@ -1769,45 +1677,52 @@ void WebRenderCommandBuilder::CreateWebRenderCommandsFromDisplayList(
item->GetActiveScrolledRoot()) {
// This creates the child WebRenderLayerScrollData for |item|, but
// omits the transform (hence the Nothing() as the last argument to
// AppendScrollData(...)). We also need to make sure that the ASR from
// Initialize(...)). We also need to make sure that the ASR from
// the deferred transform item is not on this node, so we use that
// ASR as the "stop at" ASR for this WebRenderLayerScrollData.
mLayerScrollDatas.AppendScrollData(
aBuilder, mManager, item, layerCountBeforeRecursing,
mLayerScrollData.emplace_back();
mLayerScrollData.back().Initialize(
mManager->GetScrollData(), item, descendants,
(*deferred)->GetActiveScrolledRoot(), Nothing());
// The above WebRenderLayerScrollData will also be a descendant of
// the transform-holding WebRenderLayerScrollData we create below.
descendants++;
// This creates the WebRenderLayerScrollData for the deferred
// transform item. This holds the transform matrix and the remaining
// ASRs needed to complete the ASR chain (i.e. the ones from the
// stopAtAsr down to the deferred transform item's ASR, which must be
// "between" stopAtAsr and |item|'s ASR in the ASR tree).
mLayerScrollDatas.AppendScrollData(
aBuilder, mManager, *deferred, layerCountBeforeRecursing,
stopAtAsr, aSc.GetDeferredTransformMatrix());
mLayerScrollData.emplace_back();
mLayerScrollData.back().Initialize(mManager->GetScrollData(),
*deferred, descendants, stopAtAsr,
aSc.GetDeferredTransformMatrix());
} else {
// This is the "simple" case where we don't need to create two
// WebRenderLayerScrollData items; we can just create one that also
// holds the deferred transform matrix, if any.
mLayerScrollDatas.AppendScrollData(
aBuilder, mManager, item, layerCountBeforeRecursing, stopAtAsr,
aSc.GetDeferredTransformMatrix());
mLayerScrollData.emplace_back();
mLayerScrollData.back().Initialize(mManager->GetScrollData(), item,
descendants, stopAtAsr,
aSc.GetDeferredTransformMatrix());
}
}
}
}
mDumpIndent--;
mCurrentClipManager->EndList(aSc);
mClipManager.EndList(aSc);
}
void WebRenderCommandBuilder::PushOverrideForASR(
const ActiveScrolledRoot* aASR, const wr::WrSpatialId& aSpatialId) {
mCurrentClipManager->PushOverrideForASR(aASR, aSpatialId);
mClipManager.PushOverrideForASR(aASR, aSpatialId);
}
void WebRenderCommandBuilder::PopOverrideForASR(
const ActiveScrolledRoot* aASR) {
mCurrentClipManager->PopOverrideForASR(aASR);
mClipManager.PopOverrideForASR(aASR);
}
Maybe<wr::ImageKey> WebRenderCommandBuilder::CreateImageKey(
@ -1817,8 +1732,7 @@ Maybe<wr::ImageKey> WebRenderCommandBuilder::CreateImageKey(
mozilla::wr::ImageRendering aRendering, const StackingContextHelper& aSc,
gfx::IntSize& aSize, const Maybe<LayoutDeviceRect>& aAsyncImageBounds) {
RefPtr<WebRenderImageData> imageData =
CreateOrRecycleWebRenderUserData<WebRenderImageData>(
aItem, aBuilder.GetRenderRoot());
CreateOrRecycleWebRenderUserData<WebRenderImageData>(aItem);
MOZ_ASSERT(imageData);
if (aContainer->IsAsync()) {
@ -2076,8 +1990,7 @@ WebRenderCommandBuilder::GenerateFallbackData(
}
RefPtr<WebRenderFallbackData> fallbackData =
CreateOrRecycleWebRenderUserData<WebRenderFallbackData>(
aItem, aBuilder.GetRenderRoot());
CreateOrRecycleWebRenderUserData<WebRenderFallbackData>(aItem);
bool snap;
nsRect itemBounds = aItem->GetBounds(aDisplayListBuilder, &snap);
@ -2204,7 +2117,7 @@ WebRenderCommandBuilder::GenerateFallbackData(
for (auto& scaled : aScaledFonts) {
Maybe<wr::FontInstanceKey> key =
mManager->WrBridge()->GetFontKeyForScaledFont(
scaled, aBuilder.GetRenderRoot(), &aResources);
scaled, &aResources);
if (key.isNothing()) {
validFonts = false;
break;
@ -2226,10 +2139,8 @@ WebRenderCommandBuilder::GenerateFallbackData(
aItem, dt, offset, aDisplayListBuilder,
fallbackData->mBasicLayerManager, scale, highlight);
recorder->FlushItem(IntRect({0, 0}, dtSize.ToUnknownSize()));
TakeExternalSurfaces(
recorder, fallbackData->mExternalSurfaces,
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()),
aResources);
TakeExternalSurfaces(recorder, fallbackData->mExternalSurfaces,
mManager->GetRenderRootStateManager(), aResources);
recorder->Finish();
if (!validFonts) {
@ -2288,7 +2199,7 @@ WebRenderCommandBuilder::GenerateFallbackData(
if (isInvalidated) {
// Update image if there it's invalidated.
if (!helper.UpdateImage(aBuilder.GetRenderRoot())) {
if (!helper.UpdateImage()) {
return nullptr;
}
} else {
@ -2360,8 +2271,7 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
nsDisplayListBuilder* aDisplayListBuilder,
const LayoutDeviceRect& aBounds) {
RefPtr<WebRenderMaskData> maskData =
CreateOrRecycleWebRenderUserData<WebRenderMaskData>(
aMaskItem, aBuilder.GetRenderRoot());
CreateOrRecycleWebRenderUserData<WebRenderMaskData>(aMaskItem);
if (!maskData) {
return Nothing();
@ -2412,8 +2322,8 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
for (auto& scaled : aScaledFonts) {
Maybe<wr::FontInstanceKey> key =
mManager->WrBridge()->GetFontKeyForScaledFont(
scaled, aBuilder.GetRenderRoot(), &aResources);
mManager->WrBridge()->GetFontKeyForScaledFont(scaled,
&aResources);
if (key.isNothing()) {
validFonts = false;
break;
@ -2445,10 +2355,8 @@ Maybe<wr::ImageMask> WebRenderCommandBuilder::BuildWrMaskImage(
}
recorder->FlushItem(IntRect(0, 0, size.width, size.height));
TakeExternalSurfaces(
recorder, maskData->mExternalSurfaces,
mManager->GetRenderRootStateManager(aBuilder.GetRenderRoot()),
aResources);
TakeExternalSurfaces(recorder, maskData->mExternalSurfaces,
mManager->GetRenderRootStateManager(), aResources);
recorder->Finish();
if (!validFonts) {
@ -2559,18 +2467,5 @@ WebRenderGroupData::~WebRenderGroupData() {
mFollowingGroup.ClearImageKey(mManager, true);
}
WebRenderCommandBuilder::ScrollDataBoundaryWrapper::ScrollDataBoundaryWrapper(
WebRenderCommandBuilder& aBuilder, RenderRootBoundary& aBoundary)
: mBuilder(aBuilder), mBoundary(aBoundary) {
mLayerCountBeforeRecursing =
mBuilder.mLayerScrollDatas.GetLayerCount(mBoundary.GetChildType());
}
WebRenderCommandBuilder::ScrollDataBoundaryWrapper::
~ScrollDataBoundaryWrapper() {
mBuilder.mLayerScrollDatas.AppendWrapper(mBoundary,
mLayerCountBeforeRecursing);
}
} // namespace layers
} // namespace mozilla

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

@ -9,7 +9,6 @@
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/layers/ClipManager.h"
#include "mozilla/layers/RenderRootBoundary.h"
#include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/WebRenderScrollData.h"
#include "mozilla/layers/WebRenderUserData.h"
@ -31,51 +30,6 @@ class WebRenderFallbackData;
class WebRenderParentCommand;
class WebRenderUserData;
class WebRenderScrollDataCollection {
public:
WebRenderScrollDataCollection() : mSeenRenderRoot{} {}
std::vector<WebRenderLayerScrollData>& operator[](
wr::RenderRoot aRenderRoot) {
return mInternalScrollDatas[aRenderRoot];
}
bool IsEmpty() const {
for (auto renderRoot : wr::kRenderRoots) {
if (!mInternalScrollDatas[renderRoot].empty()) {
return false;
}
}
return true;
}
void AppendRoot(Maybe<ScrollMetadata>& aRootMetadata,
wr::RenderRootArray<WebRenderScrollData>& aScrollDatas);
void AppendWrapper(const RenderRootBoundary& aBoundary,
size_t aLayerCountBeforeRecursing);
void AppendScrollData(const wr::DisplayListBuilder& aBuilder,
WebRenderLayerManager* aManager, nsDisplayItem* aItem,
size_t aLayerCountBeforeRecursing,
const ActiveScrolledRoot* aStopAtAsr,
const Maybe<gfx::Matrix4x4>& aAncestorTransform);
size_t GetLayerCount(wr::RenderRoot aRenderRoot) const;
void Clear() {
for (auto renderRoot : wr::kRenderRoots) {
mInternalScrollDatas[renderRoot].clear();
mSeenRenderRoot[renderRoot] = false;
}
}
private:
wr::RenderRootArray<std::vector<WebRenderLayerScrollData>>
mInternalScrollDatas;
wr::RenderRootArray<bool> mSeenRenderRoot;
};
class WebRenderCommandBuilder {
typedef nsTHashtable<nsRefPtrHashKey<WebRenderUserData>>
WebRenderUserDataRefTable;
@ -84,8 +38,6 @@ class WebRenderCommandBuilder {
public:
explicit WebRenderCommandBuilder(WebRenderLayerManager* aManager)
: mManager(aManager),
mRootStackingContexts(nullptr),
mCurrentClipManager(nullptr),
mLastAsr(nullptr),
mBuilderDumpIndex(0),
mDumpIndent(0),
@ -99,12 +51,13 @@ class WebRenderCommandBuilder {
bool NeedsEmptyTransaction();
void BuildWebRenderCommands(
wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResourceUpdates, nsDisplayList* aDisplayList,
nsDisplayListBuilder* aDisplayListBuilder,
wr::RenderRootArray<WebRenderScrollData>& aScrollDatas,
WrFiltersHolder&& aFilters);
void BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder,
wr::IpcResourceUpdateQueue& aResourceUpdates,
nsDisplayList* aDisplayList,
nsDisplayListBuilder* aDisplayListBuilder,
WebRenderScrollData& aScrollData,
wr::LayoutSize& aContentSize,
WrFiltersHolder&& aFilters);
void PushOverrideForASR(const ActiveScrolledRoot* aASR,
const wr::WrSpatialId& aSpatialId);
@ -165,19 +118,13 @@ class WebRenderCommandBuilder {
bool GetContainsSVGGroup() { return mContainsSVGGroup; }
const StackingContextHelper& GetRootStackingContextHelper(
wr::RenderRoot aRenderRoot) const {
return *(*mRootStackingContexts)[aRenderRoot];
}
// Those are data that we kept between transactions. We used to cache some
// data in the layer. But in layers free mode, we don't have layer which
// means we need some other place to cached the data between transaction.
// We store the data in frame's property.
template <class T>
already_AddRefed<T> CreateOrRecycleWebRenderUserData(
nsDisplayItem* aItem, wr::RenderRoot aRenderRoot,
bool* aOutIsRecycled = nullptr) {
nsDisplayItem* aItem, bool* aOutIsRecycled = nullptr) {
MOZ_ASSERT(aItem);
nsIFrame* frame = aItem->Frame();
if (aOutIsRecycled) {
@ -195,7 +142,7 @@ class WebRenderCommandBuilder {
RefPtr<WebRenderUserData>& data = userDataTable->GetOrInsert(
WebRenderUserDataKey(aItem->GetPerFrameKey(), T::Type()));
if (!data) {
data = new T(GetRenderRootStateManager(aRenderRoot), aItem);
data = new T(GetRenderRootStateManager(), aItem);
mWebRenderUserDatas.PutEntry(data);
if (aOutIsRecycled) {
*aOutIsRecycled = false;
@ -218,29 +165,14 @@ class WebRenderCommandBuilder {
WebRenderLayerManager* mManager;
class MOZ_RAII ScrollDataBoundaryWrapper {
public:
ScrollDataBoundaryWrapper(WebRenderCommandBuilder& aBuilder,
RenderRootBoundary& aBoundary);
~ScrollDataBoundaryWrapper();
private:
WebRenderCommandBuilder& mBuilder;
RenderRootBoundary mBoundary;
size_t mLayerCountBeforeRecursing;
};
friend class ScrollDataBoundaryWrapper;
private:
RenderRootStateManager* GetRenderRootStateManager(wr::RenderRoot aRenderRoot);
RenderRootStateManager* GetRenderRootStateManager();
wr::RenderRootArray<Maybe<StackingContextHelper>>* mRootStackingContexts;
wr::RenderRootArray<ClipManager> mClipManagers;
ClipManager* mCurrentClipManager;
ClipManager mClipManager;
// We use this as a temporary data structure while building the mScrollData
// inside a layers-free transaction.
WebRenderScrollDataCollection mLayerScrollDatas;
std::vector<WebRenderLayerScrollData> mLayerScrollData;
// We use this as a temporary data structure to track the current display
// item's ASR as we recurse in CreateWebRenderCommandsFromDisplayList. We
// need this so that WebRenderLayerScrollData items that deeper in the

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

@ -40,12 +40,9 @@ WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
mTarget(nullptr),
mPaintSequenceNumber(0),
mWebRenderCommandBuilder(this),
mLastDisplayListSizes{0} {
mLastDisplayListSize(0),
mStateManager(this) {
MOZ_COUNT_CTOR(WebRenderLayerManager);
for (auto renderRoot : wr::kRenderRoots) {
mStateManagers[renderRoot].mRenderRoot = renderRoot;
mStateManagers[renderRoot].mLayerManager = this;
}
}
KnowsCompositor* WebRenderLayerManager::AsKnowsCompositor() { return mWrChild; }
@ -97,9 +94,7 @@ void WebRenderLayerManager::DoDestroy(bool aIsSync) {
LayerManager::Destroy();
for (auto& stateManager : mStateManagers) {
stateManager.Destroy();
}
mStateManager.Destroy();
if (WrBridge()) {
WrBridge()->Destroy(aIsSync);
@ -196,21 +191,13 @@ bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
mTransactionIdAllocator->GetTransactionId(/*aThrottle*/ true);
if (aFlags & EndTransactionFlags::END_NO_COMPOSITE &&
!mWebRenderCommandBuilder.NeedsEmptyTransaction()) {
bool haveScrollUpdates = false;
for (auto renderRoot : wr::kRenderRoots) {
if (!mPendingScrollUpdates[renderRoot].empty()) {
haveScrollUpdates = true;
break;
}
}
if (!haveScrollUpdates) {
MOZ_ASSERT(!mTarget);
WrBridge()->SendSetFocusTarget(mFocusTarget);
// Revoke TransactionId to trigger next paint.
mTransactionIdAllocator->RevokeTransactionId(mLatestTransactionId);
return true;
}
!mWebRenderCommandBuilder.NeedsEmptyTransaction() &&
mPendingScrollUpdates.empty()) {
MOZ_ASSERT(!mTarget);
WrBridge()->SendSetFocusTarget(mFocusTarget);
// Revoke TransactionId to trigger next paint.
mTransactionIdAllocator->RevokeTransactionId(mLatestTransactionId);
return true;
}
LayoutDeviceIntSize size = mWidget->GetClientSize();
@ -234,29 +221,15 @@ bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
}
}
AutoTArray<RenderRootUpdates, wr::kRenderRootCount> renderRootUpdates;
for (auto& stateManager : mStateManagers) {
auto renderRoot = stateManager.GetRenderRoot();
if (stateManager.mAsyncResourceUpdates ||
!mPendingScrollUpdates[renderRoot].empty() ||
WrBridge()->HasWebRenderParentCommands(renderRoot)) {
auto updates = renderRootUpdates.AppendElement();
updates->mRenderRoot = renderRoot;
if (stateManager.mAsyncResourceUpdates) {
stateManager.mAsyncResourceUpdates->Flush(updates->mResourceUpdates,
updates->mSmallShmems,
updates->mLargeShmems);
}
updates->mScrollUpdates = std::move(mPendingScrollUpdates[renderRoot]);
}
}
Maybe<wr::IpcResourceUpdateQueue> nothing;
WrBridge()->EndEmptyTransaction(mFocusTarget, renderRootUpdates,
WrBridge()->EndEmptyTransaction(mFocusTarget, mPendingScrollUpdates,
mStateManager.mAsyncResourceUpdates,
mPaintSequenceNumber, mLatestTransactionId,
mTransactionIdAllocator->GetVsyncId(),
mTransactionIdAllocator->GetVsyncStart(),
refreshStart, mTransactionStart, mURL);
ClearPendingScrollInfoUpdate();
mTransactionStart = TimeStamp();
MakeSnapshotIfRequired(size);
@ -282,33 +255,9 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
WrBridge()->BeginTransaction();
LayoutDeviceIntSize size = mWidget->GetClientSize();
if (aDisplayListBuilder) {
aDisplayListBuilder->ComputeDefaultRenderRootRect(size);
}
wr::RenderRootArray<LayoutDeviceRect> rects;
wr::RenderRootArray<wr::LayoutRect> wrRects;
for (auto renderRoot : wr::kRenderRoots) {
rects[renderRoot] =
aDisplayListBuilder
? aDisplayListBuilder->GetRenderRootRect(renderRoot)
: LayoutDeviceRect(LayoutDevicePoint(),
renderRoot == wr::RenderRoot::Default
? LayoutDeviceSize(size)
: LayoutDeviceSize());
wrRects[renderRoot] = wr::ToRoundedLayoutRect(rects[renderRoot]);
}
wr::DisplayListBuilder builder(
WrBridge()->GetPipeline(), wrRects[wr::RenderRoot::Default].size,
mLastDisplayListSizes[wr::RenderRoot::Default]);
for (auto renderRoot : wr::kNonDefaultRenderRoots) {
if (!rects[renderRoot].IsEmpty()) {
builder.CreateSubBuilder(wrRects[renderRoot].size,
mLastDisplayListSizes[renderRoot], renderRoot);
}
}
wr::LayoutSize contentSize{(float)size.width, (float)size.height};
wr::DisplayListBuilder builder(WrBridge()->GetPipeline(), contentSize,
mLastDisplayListSize);
wr::IpcResourceUpdateQueue resourceUpdates(WrBridge());
wr::usize builderDumpIndex = 0;
bool containsSVGGroup = false;
@ -326,7 +275,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
mWebRenderCommandBuilder.BuildWebRenderCommands(
builder, resourceUpdates, aDisplayList, aDisplayListBuilder,
mScrollDatas, std::move(aFilters));
mScrollData, contentSize, std::move(aFilters));
builderDumpIndex = mWebRenderCommandBuilder.GetBuilderDumpIndex();
containsSVGGroup = mWebRenderCommandBuilder.GetContainsSVGGroup();
} else {
@ -348,21 +297,16 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
Unused << builder.Dump(/*indent*/ 1, Some(builderDumpIndex), Nothing());
}
for (auto& stateManager : mStateManagers) {
if (AsyncPanZoomEnabled()) {
auto& scrollData = mScrollDatas[stateManager.GetRenderRoot()];
if (AsyncPanZoomEnabled()) {
mScrollData.SetFocusTarget(mFocusTarget);
mFocusTarget = FocusTarget();
if (mIsFirstPaint) {
// Set the same flag on each scrollData instance (one per render root).
// We need to duplicate this because they will get processed by APZ at
// separate times and the flag state is relevant each time.
scrollData.SetIsFirstPaint();
}
scrollData.SetPaintSequenceNumber(mPaintSequenceNumber);
if (mIsFirstPaint) {
mScrollData.SetIsFirstPaint();
mIsFirstPaint = false;
}
mScrollData.SetPaintSequenceNumber(mPaintSequenceNumber);
}
mIsFirstPaint = false;
// Since we're sending a full mScrollData that will include the new scroll
// offsets, and we can throw away the pending scroll updates we had kept for
// an empty transaction.
@ -378,29 +322,21 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
refreshStart = mTransactionStart;
}
for (auto& stateManager : mStateManagers) {
wr::RenderRoot renderRoot = stateManager.GetRenderRoot();
if (stateManager.mAsyncResourceUpdates) {
if (!resourceUpdates.HasSubQueue(renderRoot) ||
resourceUpdates.SubQueue(renderRoot).IsEmpty()) {
resourceUpdates.SubQueue(renderRoot)
.ReplaceResources(
std::move(stateManager.mAsyncResourceUpdates.ref()));
} else {
WrBridge()->UpdateResources(stateManager.mAsyncResourceUpdates.ref(),
stateManager.GetRenderRoot());
}
stateManager.mAsyncResourceUpdates.reset();
if (mStateManager.mAsyncResourceUpdates) {
if (resourceUpdates.IsEmpty()) {
resourceUpdates = std::move(mStateManager.mAsyncResourceUpdates.ref());
} else {
// If we can't just swap the queue, we need to take the slow path and
// send the update as a separate message. We don't need to schedule a
// composite however because that will happen with EndTransaction.
WrBridge()->UpdateResources(mStateManager.mAsyncResourceUpdates.ref());
}
stateManager.DiscardImagesInTransaction(
resourceUpdates.SubQueue(renderRoot));
mStateManager.mAsyncResourceUpdates.reset();
}
for (auto renderRoot : wr::kRenderRoots) {
if (resourceUpdates.HasSubQueue(renderRoot)) {
WrBridge()->RemoveExpiredFontKeys(resourceUpdates.SubQueue(renderRoot));
}
}
mStateManager.DiscardImagesInTransaction(resourceUpdates);
WrBridge()->RemoveExpiredFontKeys(resourceUpdates);
// Skip the synchronization for buffer since we also skip the painting during
// device-reset status.
@ -411,41 +347,24 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
}
}
wr::BuiltDisplayList dl;
builder.Finalize(contentSize, dl);
mLastDisplayListSize = dl.dl.inner.capacity;
{
AUTO_PROFILER_TRACING("Paint", "ForwardDPTransaction", GRAPHICS);
InfallibleTArray<RenderRootDisplayListData> renderRootDLs;
for (auto renderRoot : wr::kRenderRoots) {
if (builder.GetSendSubBuilderDisplayList(renderRoot)) {
auto renderRootDL = renderRootDLs.AppendElement();
renderRootDL->mRenderRoot = renderRoot;
builder.Finalize(*renderRootDL);
mLastDisplayListSizes[renderRoot] = renderRootDL->mDL->mCapacity;
resourceUpdates.SubQueue(renderRoot)
.Flush(renderRootDL->mResourceUpdates, renderRootDL->mSmallShmems,
renderRootDL->mLargeShmems);
renderRootDL->mRect = RoundedToInt(rects[renderRoot]).ToUnknownRect();
renderRootDL->mScrollData.emplace(std::move(mScrollDatas[renderRoot]));
} else if (WrBridge()->HasWebRenderParentCommands(renderRoot)) {
auto renderRootDL = renderRootDLs.AppendElement();
renderRootDL->mRenderRoot = renderRoot;
}
}
WrBridge()->EndTransaction(renderRootDLs, mLatestTransactionId,
containsSVGGroup,
WrBridge()->EndTransaction(contentSize, dl, resourceUpdates,
size.ToUnknownSize(), mLatestTransactionId,
mScrollData, containsSVGGroup,
mTransactionIdAllocator->GetVsyncId(),
mTransactionIdAllocator->GetVsyncStart(),
refreshStart, mTransactionStart, mURL);
WrBridge()->SendSetFocusTarget(mFocusTarget);
mFocusTarget = FocusTarget();
}
// Discard animations after calling WrBridge()->EndTransaction().
// It updates mWrEpoch in WebRenderBridgeParent. The updated mWrEpoch is
// necessary for deleting animations at the correct time.
for (auto& stateManager : mStateManagers) {
stateManager.DiscardCompositorAnimations();
}
mStateManager.DiscardCompositorAnimations();
mTransactionStart = TimeStamp();
@ -521,17 +440,12 @@ void WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize) {
void WebRenderLayerManager::DiscardImages() {
wr::IpcResourceUpdateQueue resources(WrBridge());
for (auto& stateManager : mStateManagers) {
auto& subqueue = resources.SubQueue(stateManager.GetRenderRoot());
stateManager.DiscardImagesInTransaction(subqueue);
WrBridge()->UpdateResources(subqueue, stateManager.GetRenderRoot());
}
mStateManager.DiscardImagesInTransaction(resources);
WrBridge()->UpdateResources(resources);
}
void WebRenderLayerManager::DiscardLocalImages() {
for (auto& stateManager : mStateManagers) {
stateManager.DiscardLocalImages();
}
mStateManager.DiscardLocalImages();
}
void WebRenderLayerManager::SetLayersObserverEpoch(LayersObserverEpoch aEpoch) {
@ -586,9 +500,7 @@ void WebRenderLayerManager::ClearCachedResources(Layer* aSubtree) {
WrBridge()->BeginClearCachedResources();
mWebRenderCommandBuilder.ClearCachedResources();
DiscardImages();
for (auto& stateManager : mStateManagers) {
stateManager.ClearCachedResources();
}
mStateManager.ClearCachedResources();
WrBridge()->EndClearCachedResources();
}
@ -720,16 +632,12 @@ WebRenderLayerManager::CreatePersistentBufferProvider(
}
void WebRenderLayerManager::ClearAsyncAnimations() {
for (auto& stateManager : mStateManagers) {
stateManager.ClearAsyncAnimations();
}
mStateManager.ClearAsyncAnimations();
}
void WebRenderLayerManager::WrReleasedImages(
const nsTArray<wr::ExternalImageKeyPair>& aPairs) {
for (auto& stateManager : mStateManagers) {
stateManager.WrReleasedImages(aPairs);
}
mStateManager.WrReleasedImages(aPairs);
}
} // namespace layers

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

@ -173,9 +173,7 @@ class WebRenderLayerManager final : public LayerManager {
WebRenderUserDataRefTable* GetWebRenderUserDataTable() {
return mWebRenderCommandBuilder.GetWebRenderUserDataTable();
}
WebRenderScrollData& GetScrollData(wr::RenderRoot aRenderRoot) {
return mScrollDatas[aRenderRoot];
}
WebRenderScrollData& GetScrollData() { return mScrollData; }
void WrUpdated();
void WindowOverlayChanged() { mWindowOverlayChanged = true; }
@ -187,10 +185,7 @@ class WebRenderLayerManager final : public LayerManager {
void StopFrameTimeRecording(uint32_t aStartIndex,
nsTArray<float>& aFrameIntervals) override;
RenderRootStateManager* GetRenderRootStateManager(
wr::RenderRoot aRenderRoot) {
return &mStateManagers[aRenderRoot];
}
RenderRootStateManager* GetRenderRootStateManager() { return &mStateManager; }
private:
/**
@ -211,7 +206,7 @@ class WebRenderLayerManager final : public LayerManager {
// This holds the scroll data that we need to send to the compositor for
// APZ to do it's job
wr::RenderRootArray<WebRenderScrollData> mScrollDatas;
WebRenderScrollData mScrollData;
bool mWindowOverlayChanged;
bool mNeedsComposite;
@ -236,8 +231,9 @@ class WebRenderLayerManager final : public LayerManager {
nsCString mURL;
WebRenderCommandBuilder mWebRenderCommandBuilder;
wr::RenderRootArray<size_t> mLastDisplayListSizes;
wr::RenderRootArray<RenderRootStateManager> mStateManagers;
size_t mLastDisplayListSize;
RenderRootStateManager mStateManager;
};
} // namespace layers

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

@ -109,12 +109,6 @@ template <>
struct ParamTraits<mozilla::wr::LayoutPoint>
: public PlainOldDataSerializer<mozilla::wr::LayoutPoint> {};
template <>
struct ParamTraits<mozilla::wr::RenderRoot>
: public ContiguousEnumSerializerInclusive<mozilla::wr::RenderRoot,
mozilla::wr::RenderRoot::Default,
mozilla::wr::kHighestRenderRoot> {};
template <>
struct ParamTraits<mozilla::wr::ImageRendering>
: public ContiguousEnumSerializer<mozilla::wr::ImageRendering,

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

@ -21,8 +21,7 @@ WebRenderLayerScrollData::WebRenderLayerScrollData()
: mDescendantCount(-1),
mTransformIsPerspective(false),
mEventRegionsOverride(EventRegionsOverride::NoOverride),
mFixedPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID),
mRenderRoot(wr::RenderRoot::Default) {}
mFixedPosScrollContainerId(ScrollableLayerGuid::NULL_SCROLL_ID) {}
WebRenderLayerScrollData::~WebRenderLayerScrollData() {}
@ -33,13 +32,11 @@ void WebRenderLayerScrollData::InitializeRoot(int32_t aDescendantCount) {
void WebRenderLayerScrollData::Initialize(
WebRenderScrollData& aOwner, nsDisplayItem* aItem, int32_t aDescendantCount,
const ActiveScrolledRoot* aStopAtAsr,
const Maybe<gfx::Matrix4x4>& aAncestorTransform,
wr::RenderRoot aRenderRoot) {
const Maybe<gfx::Matrix4x4>& aAncestorTransform) {
MOZ_ASSERT(aDescendantCount >= 0); // Ensure value is valid
MOZ_ASSERT(mDescendantCount ==
-1); // Don't allow re-setting an already set value
mDescendantCount = aDescendantCount;
mRenderRoot = aRenderRoot;
MOZ_ASSERT(aItem);
aItem->UpdateScrollData(&aOwner, this);
@ -191,6 +188,10 @@ Maybe<size_t> WebRenderScrollData::HasMetadataFor(
return (it == mScrollIdMap.end() ? Nothing() : Some(it->second));
}
void WebRenderScrollData::SetFocusTarget(const FocusTarget& aFocusTarget) {
mFocusTarget = aFocusTarget;
}
void WebRenderScrollData::SetIsFirstPaint() { mIsFirstPaint = true; }
bool WebRenderScrollData::IsFirstPaint() const { return mIsFirstPaint; }

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

@ -18,9 +18,6 @@
#include "mozilla/layers/LayerAttributes.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/FocusTarget.h"
#include "mozilla/layers/RenderRootBoundary.h"
#include "mozilla/layers/WebRenderMessageUtils.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/Maybe.h"
#include "nsTArrayForwardDeclare.h"
@ -49,8 +46,7 @@ class WebRenderLayerScrollData {
void Initialize(WebRenderScrollData& aOwner, nsDisplayItem* aItem,
int32_t aDescendantCount,
const ActiveScrolledRoot* aStopAtAsr,
const Maybe<gfx::Matrix4x4>& aAncestorTransform,
wr::RenderRoot aRenderRoot);
const Maybe<gfx::Matrix4x4>& aAncestorTransform);
int32_t GetDescendantCount() const;
size_t GetScrollMetadataCount() const;
@ -90,17 +86,6 @@ class WebRenderLayerScrollData {
void SetReferentId(LayersId aReferentId) { mReferentId = Some(aReferentId); }
Maybe<LayersId> GetReferentId() const { return mReferentId; }
void SetReferentRenderRoot(RenderRootBoundary aBoundary) {
mReferentRenderRoot = Some(aBoundary);
}
Maybe<RenderRootBoundary> GetReferentRenderRoot() const {
return mReferentRenderRoot;
}
void SetBoundaryRoot(RenderRootBoundary aBoundary) {
mBoundaryRoot = Some(aBoundary);
}
Maybe<RenderRootBoundary> GetBoundaryRoot() const { return mBoundaryRoot; }
void SetScrollbarData(const ScrollbarData& aData) { mScrollbarData = aData; }
const ScrollbarData& GetScrollbarData() const { return mScrollbarData; }
void SetScrollbarAnimationId(const uint64_t& aId) {
@ -117,8 +102,6 @@ class WebRenderLayerScrollData {
return mFixedPosScrollContainerId;
}
wr::RenderRoot GetRenderRoot() { return mRenderRoot; }
void SetZoomAnimationId(const uint64_t& aId) { mZoomAnimationId = Some(aId); }
Maybe<uint64_t> GetZoomAnimationId() const { return mZoomAnimationId; }
@ -147,13 +130,10 @@ class WebRenderLayerScrollData {
bool mTransformIsPerspective;
LayerIntRegion mVisibleRegion;
Maybe<LayersId> mReferentId;
Maybe<RenderRootBoundary> mReferentRenderRoot;
Maybe<RenderRootBoundary> mBoundaryRoot;
EventRegionsOverride mEventRegionsOverride;
ScrollbarData mScrollbarData;
Maybe<uint64_t> mScrollbarAnimationId;
ScrollableLayerGuid::ViewID mFixedPosScrollContainerId;
wr::RenderRoot mRenderRoot;
Maybe<uint64_t> mZoomAnimationId;
};
@ -186,6 +166,9 @@ class WebRenderScrollData {
Maybe<size_t> HasMetadataFor(
const ScrollableLayerGuid::ViewID& aScrollId) const;
const FocusTarget& GetFocusTarget() const { return mFocusTarget; }
void SetFocusTarget(const FocusTarget& aFocusTarget);
void SetIsFirstPaint();
bool IsFirstPaint() const;
void SetPaintSequenceNumber(uint32_t aPaintSequenceNumber);
@ -229,6 +212,9 @@ class WebRenderScrollData {
// the other side.
nsTArray<WebRenderLayerScrollData> mLayerScrollData;
// The focus information for this layer tree
FocusTarget mFocusTarget;
bool mIsFirstPaint;
uint32_t mPaintSequenceNumber;
};
@ -238,10 +224,6 @@ class WebRenderScrollData {
namespace IPC {
template <>
struct ParamTraits<mozilla::layers::RenderRootBoundary>
: public PlainOldDataSerializer<mozilla::layers::RenderRootBoundary> {};
// When ScrollbarData is stored on the layer tree, it's part of
// SimpleAttributes which itself uses PlainOldDataSerializer, so
// we don't need a ParamTraits specialization for ScrollbarData
@ -264,13 +246,10 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
WriteParam(aMsg, aParam.mTransformIsPerspective);
WriteParam(aMsg, aParam.mVisibleRegion);
WriteParam(aMsg, aParam.mReferentId);
WriteParam(aMsg, aParam.mReferentRenderRoot);
WriteParam(aMsg, aParam.mBoundaryRoot);
WriteParam(aMsg, aParam.mEventRegionsOverride);
WriteParam(aMsg, aParam.mScrollbarData);
WriteParam(aMsg, aParam.mScrollbarAnimationId);
WriteParam(aMsg, aParam.mFixedPosScrollContainerId);
WriteParam(aMsg, aParam.mRenderRoot);
WriteParam(aMsg, aParam.mZoomAnimationId);
}
@ -283,13 +262,10 @@ struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
ReadParam(aMsg, aIter, &aResult->mTransformIsPerspective) &&
ReadParam(aMsg, aIter, &aResult->mVisibleRegion) &&
ReadParam(aMsg, aIter, &aResult->mReferentId) &&
ReadParam(aMsg, aIter, &aResult->mReferentRenderRoot) &&
ReadParam(aMsg, aIter, &aResult->mBoundaryRoot) &&
ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride) &&
ReadParam(aMsg, aIter, &aResult->mScrollbarData) &&
ReadParam(aMsg, aIter, &aResult->mScrollbarAnimationId) &&
ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId) &&
ReadParam(aMsg, aIter, &aResult->mRenderRoot) &&
ReadParam(aMsg, aIter, &aResult->mZoomAnimationId);
}
};
@ -301,6 +277,7 @@ struct ParamTraits<mozilla::layers::WebRenderScrollData> {
static void Write(Message* aMsg, const paramType& aParam) {
WriteParam(aMsg, aParam.mScrollMetadatas);
WriteParam(aMsg, aParam.mLayerScrollData);
WriteParam(aMsg, aParam.mFocusTarget);
WriteParam(aMsg, aParam.mIsFirstPaint);
WriteParam(aMsg, aParam.mPaintSequenceNumber);
}
@ -309,6 +286,7 @@ struct ParamTraits<mozilla::layers::WebRenderScrollData> {
paramType* aResult) {
return ReadParam(aMsg, aIter, &aResult->mScrollMetadatas) &&
ReadParam(aMsg, aIter, &aResult->mLayerScrollData) &&
ReadParam(aMsg, aIter, &aResult->mFocusTarget) &&
ReadParam(aMsg, aIter, &aResult->mIsFirstPaint) &&
ReadParam(aMsg, aIter, &aResult->mPaintSequenceNumber) &&
aResult->RepopulateMap();

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

@ -45,11 +45,9 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
// Basic constructor for external callers. Starts the walker at the root of
// the tree.
explicit WebRenderScrollDataWrapper(
const APZUpdater& aUpdater, WRRootId aWrRootId,
const WebRenderScrollData* aData = nullptr)
const APZUpdater& aUpdater, const WebRenderScrollData* aData = nullptr)
: mUpdater(&aUpdater),
mData(aData),
mWrRootId(aWrRootId),
mLayerIndex(0),
mContainingSubtreeLastIndex(0),
mLayer(nullptr),
@ -79,13 +77,12 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
// Internal constructor for walking from one WebRenderLayerScrollData to
// another. In this case we need to recompute the mMetadataIndex to be the
// "topmost" scroll metadata on the new layer.
WebRenderScrollDataWrapper(const APZUpdater* aUpdater, WRRootId aWrRootId,
WebRenderScrollDataWrapper(const APZUpdater* aUpdater,
const WebRenderScrollData* aData,
size_t aLayerIndex,
size_t aContainingSubtreeLastIndex)
: mUpdater(aUpdater),
mData(aData),
mWrRootId(aWrRootId),
mLayerIndex(aLayerIndex),
mContainingSubtreeLastIndex(aContainingSubtreeLastIndex),
mLayer(nullptr),
@ -104,7 +101,7 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
// Internal constructor for walking from one metadata to another metadata on
// the same WebRenderLayerScrollData.
WebRenderScrollDataWrapper(const APZUpdater* aUpdater, WRRootId aWrRootId,
WebRenderScrollDataWrapper(const APZUpdater* aUpdater,
const WebRenderScrollData* aData,
size_t aLayerIndex,
size_t aContainingSubtreeLastIndex,
@ -112,7 +109,6 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
uint32_t aMetadataIndex)
: mUpdater(aUpdater),
mData(aData),
mWrRootId(aWrRootId),
mLayerIndex(aLayerIndex),
mContainingSubtreeLastIndex(aContainingSubtreeLastIndex),
mLayer(aLayer),
@ -136,7 +132,7 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
// If we're still walking around in the virtual container layers created
// by the ScrollMetadata array, we just need to update the metadata index
// and that's it.
return WebRenderScrollDataWrapper(mUpdater, mWrRootId, mData, mLayerIndex,
return WebRenderScrollDataWrapper(mUpdater, mData, mLayerIndex,
mContainingSubtreeLastIndex, mLayer,
mMetadataIndex - 1);
}
@ -154,42 +150,8 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
size_t prevSiblingIndex = mLayerIndex + 1 + mLayer->GetDescendantCount();
size_t subtreeLastIndex =
std::min(mContainingSubtreeLastIndex, prevSiblingIndex);
return WebRenderScrollDataWrapper(mUpdater, mWrRootId, mData,
mLayerIndex + 1, subtreeLastIndex);
}
if (mLayer->GetReferentRenderRoot()) {
MOZ_ASSERT(!mLayer->GetReferentId());
MOZ_ASSERT(mLayer->GetReferentRenderRoot()->GetChildType() !=
mWrRootId.mRenderRoot);
WRRootId newWrRootId = WRRootId(
mWrRootId.mLayersId, mLayer->GetReferentRenderRoot()->GetChildType());
const WebRenderScrollData* childData =
mUpdater->GetScrollData(newWrRootId);
// See the comment above RenderRootBoundary for more context on what's
// happening here. We need to fish out the appropriate wrapper root from
// inside the dummy root. Note that the wrapper root should always be a
// direct descendant of the dummy root, so we can pass
// `childData->GetLayerCount()` for the `aContainingSubtreeLastIndex`
// parameter below.
Maybe<size_t> layerIndex;
for (size_t i = 0; i < childData->GetLayerCount(); i++) {
const WebRenderLayerScrollData* wrlsd = childData->GetLayerData(i);
if (wrlsd->GetBoundaryRoot() == mLayer->GetReferentRenderRoot()) {
// found it
layerIndex = Some(i);
break;
}
}
if (!layerIndex) {
// It's possible that there's no wrapper root. In that case there are
// no descendants
return WebRenderScrollDataWrapper(*mUpdater, mWrRootId);
}
return WebRenderScrollDataWrapper(mUpdater, newWrRootId, childData,
*layerIndex,
childData->GetLayerCount());
return WebRenderScrollDataWrapper(mUpdater, mData, mLayerIndex + 1,
subtreeLastIndex);
}
// We've run out of descendants. But! If the original layer was a RefLayer,
@ -197,13 +159,11 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
// So return a WebRenderScrollDataWrapper for the root of the child layer
// tree.
if (mLayer->GetReferentId()) {
WRRootId newWrRootId =
WRRootId(*mLayer->GetReferentId(), mWrRootId.mRenderRoot);
return WebRenderScrollDataWrapper(*mUpdater, newWrRootId,
mUpdater->GetScrollData(newWrRootId));
return WebRenderScrollDataWrapper(
*mUpdater, mUpdater->GetScrollData(*mLayer->GetReferentId()));
}
return WebRenderScrollDataWrapper(*mUpdater, mWrRootId);
return WebRenderScrollDataWrapper(*mUpdater);
}
WebRenderScrollDataWrapper GetPrevSibling() const {
@ -211,18 +171,17 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
if (!AtTopLayer()) {
// The virtual container layers don't have siblings
return WebRenderScrollDataWrapper(*mUpdater, mWrRootId);
return WebRenderScrollDataWrapper(*mUpdater);
}
// Skip past the descendants to get to the previous sibling. However, we
// might be at the last sibling already.
size_t prevSiblingIndex = mLayerIndex + 1 + mLayer->GetDescendantCount();
if (prevSiblingIndex < mContainingSubtreeLastIndex) {
return WebRenderScrollDataWrapper(mUpdater, mWrRootId, mData,
prevSiblingIndex,
return WebRenderScrollDataWrapper(mUpdater, mData, prevSiblingIndex,
mContainingSubtreeLastIndex);
}
return WebRenderScrollDataWrapper(*mUpdater, mWrRootId);
return WebRenderScrollDataWrapper(*mUpdater);
}
const ScrollMetadata& Metadata() const {
@ -304,17 +263,6 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
return Nothing();
}
Maybe<wr::RenderRoot> GetReferentRenderRoot() const {
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
if (mLayer->GetReferentRenderRoot()) {
return Some(mLayer->GetReferentRenderRoot()->GetChildType());
}
}
return Nothing();
}
Maybe<ParentLayerIntRect> GetClipRect() const {
// TODO
return Nothing();
@ -362,8 +310,6 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
return mLayer;
}
wr::RenderRoot GetRenderRoot() const { return mWrRootId.mRenderRoot; }
private:
bool AtBottomLayer() const { return mMetadataIndex == 0; }
@ -375,7 +321,6 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper {
private:
const APZUpdater* mUpdater;
const WebRenderScrollData* mData;
WRRootId mWrRootId;
// The index (in mData->mLayerScrollData) of the WebRenderLayerScrollData this
// wrapper is pointing to.
size_t mLayerIndex;

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

@ -130,8 +130,7 @@ void WebRenderImageData::ClearImageKey() {
if (mOwnsKey) {
mManager->AddImageKeyForDiscard(mKey.value());
if (mTextureOfImage) {
WrBridge()->ReleaseTextureOfImage(mKey.value(),
mManager->GetRenderRoot());
WrBridge()->ReleaseTextureOfImage(mKey.value());
mTextureOfImage = nullptr;
}
}
@ -180,8 +179,7 @@ Maybe<wr::ImageKey> WebRenderImageData::UpdateImageKey(
ImageClientSingle* imageClient = mImageClient->AsImageClientSingle();
uint32_t oldCounter = imageClient->GetLastUpdateGenerationCounter();
bool ret = imageClient->UpdateImage(aContainer, /* unused */ 0,
Some(mManager->GetRenderRoot()));
bool ret = imageClient->UpdateImage(aContainer, /* unused */ 0);
RefPtr<TextureClient> currentTexture = imageClient->GetForwardedTexture();
if (!ret || !currentTexture) {
// Delete old key
@ -239,8 +237,7 @@ void WebRenderImageData::CreateAsyncImageWebRenderCommands(
if (mPipelineId.isSome() && mContainer != aContainer) {
// In this case, we need to remove the existed pipeline and create new one
// because the ImageContainer is changed.
WrBridge()->RemovePipelineIdForCompositable(mPipelineId.ref(),
mManager->GetRenderRoot());
WrBridge()->RemovePipelineIdForCompositable(mPipelineId.ref());
mPipelineId.reset();
}
@ -249,8 +246,7 @@ void WebRenderImageData::CreateAsyncImageWebRenderCommands(
mPipelineId =
Some(WrBridge()->GetCompositorBridgeChild()->GetNextPipelineId());
WrBridge()->AddPipelineIdForAsyncCompositable(
mPipelineId.ref(), aContainer->GetAsyncContainerHandle(),
mManager->GetRenderRoot());
mPipelineId.ref(), aContainer->GetAsyncContainerHandle());
mContainer = aContainer;
}
MOZ_ASSERT(!mImageClient);
@ -269,8 +265,7 @@ void WebRenderImageData::CreateAsyncImageWebRenderCommands(
WrBridge()->AddWebRenderParentCommand(
OpUpdateAsyncImagePipeline(mPipelineId.value(), aSCBounds, aSCTransform,
aScaleToSize, aFilter, aMixBlendMode),
mManager->GetRenderRoot());
aScaleToSize, aFilter, aMixBlendMode));
}
void WebRenderImageData::CreateImageClientIfNeeded() {
@ -372,22 +367,6 @@ WebRenderCanvasRendererAsync* WebRenderCanvasData::CreateCanvasRenderer() {
return mCanvasRenderer.get();
}
WebRenderRenderRootData::WebRenderRenderRootData(RenderRootStateManager* aManager,
nsDisplayItem* aItem)
: WebRenderUserData(aManager, aItem) {}
RenderRootBoundary& WebRenderRenderRootData::EnsureHasBoundary(
wr::RenderRoot aChildType) {
if (mBoundary) {
MOZ_ASSERT(mBoundary->GetChildType() == aChildType);
} else {
mBoundary.emplace(aChildType);
}
return mBoundary.ref();
}
WebRenderRenderRootData::~WebRenderRenderRootData() {}
void DestroyWebRenderUserDataTable(WebRenderUserDataTable* aTable) {
for (auto iter = aTable->Iter(); !iter.Done(); iter.Next()) {
iter.UserData()->RemoveFromTable();

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

@ -12,7 +12,6 @@
#include "mozilla/layers/StackingContextHelper.h"
#include "mozilla/webrender/WebRenderAPI.h"
#include "mozilla/layers/AnimationInfo.h"
#include "mozilla/layers/RenderRootBoundary.h"
#include "nsIFrame.h"
#include "ImageTypes.h"
@ -80,7 +79,6 @@ class WebRenderUserData {
eCanvas,
eGroup,
eMask,
eRenderRoot,
};
virtual UserDataType GetType() = 0;
@ -247,21 +245,6 @@ class WebRenderCanvasData : public WebRenderUserData {
UniquePtr<WebRenderCanvasRendererAsync> mCanvasRenderer;
};
class WebRenderRenderRootData : public WebRenderUserData {
public:
WebRenderRenderRootData(RenderRootStateManager* aManager,
nsDisplayItem* aItem);
virtual ~WebRenderRenderRootData();
virtual UserDataType GetType() override { return UserDataType::eRenderRoot; }
static UserDataType Type() { return UserDataType::eRenderRoot; }
RenderRootBoundary& EnsureHasBoundary(wr::RenderRoot aChildType);
protected:
Maybe<RenderRootBoundary> mBoundary;
};
extern void DestroyWebRenderUserDataTable(WebRenderUserDataTable* aTable);
struct WebRenderUserDataProperty {

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

@ -164,12 +164,7 @@ class WRUserData : public layers::LayerUserData,
static UserDataKey sWRUserDataKey;
};
// If we add more render roots, this will need to be updated to accomodate
// more than two render roots, at which point simply adding a bit to an
// array index is probably not how we want to do things.
static const int CONTENT_RECT_GLYPH_ATLAS = 8;
static RefPtr<SourceSurface> gWRGlyphAtlas[16];
static RefPtr<SourceSurface> gWRGlyphAtlas[8];
static LinkedList<WRUserData> gWRUsers;
UserDataKey WRUserData::sWRUserDataKey;
@ -223,17 +218,13 @@ static void PurgeWRGlyphAtlas() {
// from the layer manager.
for (WRUserData* user : gWRUsers) {
auto* manager = user->mManager;
for (size_t i = 0; i < 16; i++) {
for (size_t i = 0; i < 8; i++) {
if (gWRGlyphAtlas[i]) {
uint32_t handle = (uint32_t)(uintptr_t)gWRGlyphAtlas[i]->GetUserData(
reinterpret_cast<UserDataKey*>(manager));
if (handle) {
wr::RenderRoot renderRoot = (i & CONTENT_RECT_GLYPH_ATLAS)
? wr::RenderRoot::Content
: wr::RenderRoot::Default;
manager->GetRenderRootStateManager(renderRoot)
->AddImageKeyForDiscard(
wr::ImageKey{manager->WrBridge()->GetNamespace(), handle});
manager->GetRenderRootStateManager()->AddImageKeyForDiscard(
wr::ImageKey{manager->WrBridge()->GetNamespace(), handle});
}
}
}
@ -244,7 +235,7 @@ static void PurgeWRGlyphAtlas() {
gWRUsers.popFirst()->Remove();
}
// Finally, clear out the atlases.
for (size_t i = 0; i < 16; i++) {
for (size_t i = 0; i < 8; i++) {
gWRGlyphAtlas[i] = nullptr;
}
}
@ -258,7 +249,7 @@ WRUserData::~WRUserData() {
// When the layer manager is destroyed, we need go through each
// atlas and remove any assigned image keys.
if (isInList()) {
for (size_t i = 0; i < 16; i++) {
for (size_t i = 0; i < 8; i++) {
if (gWRGlyphAtlas[i]) {
gWRGlyphAtlas[i]->RemoveUserData(
reinterpret_cast<UserDataKey*>(mManager));
@ -278,20 +269,15 @@ static already_AddRefed<SourceSurface> GetWRGlyphAtlas(DrawTarget& aDrawTarget,
key |= (aMat->_11 < 0 ? 1 : 0) | (aMat->_22 < 0 ? 2 : 0);
}
}
// The atlas may exist, but an image key may not be assigned for it to
// the given layer manager.
auto* tdt = static_cast<layout::TextDrawTarget*>(&aDrawTarget);
if (tdt->GetRenderRoot() == wr::RenderRoot::Content) {
key |= CONTENT_RECT_GLYPH_ATLAS;
}
// Check if an atlas was already created, or create one if necessary.
RefPtr<SourceSurface> atlas = gWRGlyphAtlas[key];
if (!atlas) {
atlas = MakeWRGlyphAtlas(aMat);
gWRGlyphAtlas[key] = atlas;
}
// The atlas may exist, but an image key may not be assigned for it to
// the given layer manager.
auto* tdt = static_cast<layout::TextDrawTarget*>(&aDrawTarget);
auto* manager = tdt->WrLayerManager();
if (!atlas->GetUserData(reinterpret_cast<UserDataKey*>(manager))) {
// No image key, so we need to map the atlas' data for transfer to WR.

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

@ -550,7 +550,6 @@ class gfxPrefs final {
DECL_GFX_PREF(Live, "gfx.webrender.late-scenebuild-threshold", WebRenderLateSceneBuildThreshold, int32_t, 4);
DECL_GFX_PREF(Live, "gfx.webrender.max-filter-ops-per-chain", WebRenderMaxFilterOpsPerChain, uint32_t, 64);
DECL_GFX_PREF(Live, "gfx.webrender.picture-caching", WebRenderPictureCaching, bool, false);
DECL_GFX_PREF(Once, "gfx.webrender.split-render-roots", WebRenderSplitRenderRoots, bool, false);
// Use vsync events generated by hardware
DECL_GFX_PREF(Once, "gfx.work-around-driver-bugs", WorkAroundDriverBugs, bool, true);

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

@ -1471,76 +1471,6 @@ bool gfxUtils::DumpDisplayList() {
(gfxPrefs::LayoutDumpDisplayListContent() && XRE_IsContentProcess());
}
wr::RenderRoot gfxUtils::GetContentRenderRoot() {
if (gfx::gfxVars::UseWebRender() &&
gfxPrefs::WebRenderSplitRenderRoots()) {
return wr::RenderRoot::Content;
}
return wr::RenderRoot::Default;
}
Maybe<wr::RenderRoot> gfxUtils::GetRenderRootForFrame(const nsIFrame* aFrame) {
if (!gfxVars::UseWebRender() || !gfxPrefs::WebRenderSplitRenderRoots()) {
return Nothing();
}
if (!aFrame->GetContent()) {
return Nothing();
}
return gfxUtils::GetRenderRootForElement(aFrame->GetContent()->AsElement());
}
Maybe<wr::RenderRoot> gfxUtils::GetRenderRootForElement(const dom::Element* aElement) {
if (!aElement) {
return Nothing();
}
if (!gfxVars::UseWebRender() || !gfxPrefs::WebRenderSplitRenderRoots()) {
return Nothing();
}
if (!aElement->IsXULElement()) {
return Nothing();
}
if (aElement->AttrValueIs(
kNameSpaceID_None, nsGkAtoms::renderroot,
NS_LITERAL_STRING("content"), eCaseMatters)) {
return Some(wr::RenderRoot::Content);
}
return Nothing();
}
wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForFrame(const nsIFrame* aFrame) {
if (!gfxVars::UseWebRender() || !gfxPrefs::WebRenderSplitRenderRoots()) {
return wr::RenderRoot::Default;
}
for (const nsIFrame* current = aFrame;
current;
current = current->GetParent()) {
auto renderRoot = gfxUtils::GetRenderRootForFrame(current);
if (renderRoot) {
return *renderRoot;
}
}
return wr::RenderRoot::Default;
}
wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForElement(const dom::Element* aElement) {
if (!gfxVars::UseWebRender() || !gfxPrefs::WebRenderSplitRenderRoots()) {
return wr::RenderRoot::Default;
}
for (const dom::Element* current = aElement;
current;
current = current->GetParentElement()) {
auto renderRoot = gfxUtils::GetRenderRootForElement(current);
if (renderRoot) {
return *renderRoot;
}
}
return wr::RenderRoot::Default;
}
FILE* gfxUtils::sDumpPaintFile = stderr;
namespace mozilla {

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

@ -27,9 +27,6 @@ class nsIGfxInfo;
class nsIPresShell;
namespace mozilla {
namespace dom {
class Element;
}
namespace layers {
class WebRenderBridgeChild;
class GlyphArray;
@ -313,13 +310,6 @@ class gfxUtils {
static bool DumpDisplayList();
static FILE* sDumpPaintFile;
static mozilla::wr::RenderRoot GetContentRenderRoot();
static mozilla::Maybe<mozilla::wr::RenderRoot> GetRenderRootForFrame(const nsIFrame* aFrame);
static mozilla::Maybe<mozilla::wr::RenderRoot> GetRenderRootForElement(const mozilla::dom::Element* aElement);
static mozilla::wr::RenderRoot RecursivelyGetRenderRootForFrame(const nsIFrame* aFrame);
static mozilla::wr::RenderRoot RecursivelyGetRenderRootForElement(const mozilla::dom::Element* aElement);
};
namespace mozilla {

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

@ -473,8 +473,7 @@ void RenderThread::SetDestroyed(wr::WindowId aWindowId) {
void RenderThread::IncPendingFrameCount(wr::WindowId aWindowId,
const VsyncId& aStartId,
const TimeStamp& aStartTime,
uint8_t aDocFrameCount) {
const TimeStamp& aStartTime) {
auto windows = mWindowInfos.Lock();
auto it = windows->find(AsUint64(aWindowId));
if (it == windows->end()) {
@ -484,7 +483,6 @@ void RenderThread::IncPendingFrameCount(wr::WindowId aWindowId,
it->second->mPendingCount++;
it->second->mStartTimes.push(aStartTime);
it->second->mStartIds.push(aStartId);
it->second->mDocFrameCounts.push(aDocFrameCount);
}
void RenderThread::DecPendingFrameCount(wr::WindowId aWindowId) {
@ -511,28 +509,14 @@ void RenderThread::DecPendingFrameCount(wr::WindowId aWindowId) {
info->mStartIds.pop();
}
mozilla::Pair<bool, bool> RenderThread::IncRenderingFrameCount(wr::WindowId aWindowId, bool aRender) {
void RenderThread::IncRenderingFrameCount(wr::WindowId aWindowId) {
auto windows = mWindowInfos.Lock();
auto it = windows->find(AsUint64(aWindowId));
if (it == windows->end()) {
MOZ_ASSERT(false);
return MakePair(false, false);
}
it->second->mDocFramesSeen++;
if (it->second->mDocFramesSeen < it->second->mDocFrameCounts.front()) {
it->second->mRender |= aRender;
return MakePair(false, it->second->mRender);
} else {
MOZ_ASSERT(it->second->mDocFramesSeen ==
it->second->mDocFrameCounts.front());
bool render = it->second->mRender || aRender;
it->second->mRender = false;
it->second->mRenderingCount++;
it->second->mDocFrameCounts.pop();
it->second->mDocFramesSeen = 0;
return MakePair(true, render);
return;
}
it->second->mRenderingCount++;
}
void RenderThread::FrameRenderingComplete(wr::WindowId aWindowId) {
@ -861,12 +845,8 @@ static already_AddRefed<gl::GLContext> CreateGLContext() {
extern "C" {
static void HandleFrame(mozilla::wr::WrWindowId aWindowId, bool aRender) {
auto incResult = mozilla::wr::RenderThread::Get()->IncRenderingFrameCount(
aWindowId, aRender);
if (incResult.first()) {
mozilla::wr::RenderThread::Get()->HandleFrame(aWindowId,
incResult.second());
}
mozilla::wr::RenderThread::Get()->IncRenderingFrameCount(aWindowId);
mozilla::wr::RenderThread::Get()->HandleFrame(aWindowId, aRender);
}
void wr_notifier_wake_up(mozilla::wr::WrWindowId aWindowId) {
@ -889,30 +869,27 @@ void wr_notifier_external_event(mozilla::wr::WrWindowId aWindowId,
std::move(evt));
}
void wr_schedule_render(mozilla::wr::WrWindowId aWindowId,
mozilla::wr::WrDocumentId aDocumentId) {
void wr_schedule_render(mozilla::wr::WrWindowId aWindowId) {
RefPtr<mozilla::layers::CompositorBridgeParent> cbp = mozilla::layers::
CompositorBridgeParent::GetCompositorBridgeParentFromWindowId(aWindowId);
if (cbp) {
cbp->ScheduleRenderOnCompositorThread(Some(wr::RenderRootFromId(aDocumentId)));
cbp->ScheduleRenderOnCompositorThread();
}
}
static void NotifyDidSceneBuild(RefPtr<layers::CompositorBridgeParent> aBridge,
wr::DocumentId aRenderRootId,
RefPtr<wr::WebRenderPipelineInfo> aInfo) {
aBridge->NotifyDidSceneBuild(wr::RenderRootFromId(aRenderRootId), aInfo);
aBridge->NotifyDidSceneBuild(aInfo);
}
void wr_finished_scene_build(mozilla::wr::WrWindowId aWindowId,
mozilla::wr::WrDocumentId aDocumentId,
mozilla::wr::WrPipelineInfo aInfo) {
RefPtr<mozilla::layers::CompositorBridgeParent> cbp = mozilla::layers::
CompositorBridgeParent::GetCompositorBridgeParentFromWindowId(aWindowId);
RefPtr<wr::WebRenderPipelineInfo> info = new wr::WebRenderPipelineInfo(aInfo);
if (cbp) {
layers::CompositorThreadHolder::Loop()->PostTask(NewRunnableFunction(
"NotifyDidSceneBuild", &NotifyDidSceneBuild, cbp, aDocumentId, info));
"NotifyDidSceneBuild", &NotifyDidSceneBuild, cbp, info));
}
}

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

@ -205,13 +205,11 @@ class RenderThread final {
bool TooManyPendingFrames(wr::WindowId aWindowId);
/// Can be called from any thread.
void IncPendingFrameCount(wr::WindowId aWindowId, const VsyncId& aStartId,
const TimeStamp& aStartTime,
uint8_t aDocFrameCount);
const TimeStamp& aStartTime);
/// Can be called from any thread.
void DecPendingFrameCount(wr::WindowId aWindowId);
/// Can be called from any thread.
mozilla::Pair<bool, bool> IncRenderingFrameCount(wr::WindowId aWindowId,
bool aRender);
void IncRenderingFrameCount(wr::WindowId aWindowId);
/// Can be called from any thread.
void FrameRenderingComplete(wr::WindowId aWindowId);
@ -275,15 +273,12 @@ class RenderThread final {
struct WindowInfo {
bool mIsDestroyed = false;
bool mRender = false;
int64_t mPendingCount = 0;
int64_t mRenderingCount = 0;
uint8_t mDocFramesSeen = 0;
// One entry in this queue for each pending frame, so the length
// should always equal mPendingCount
std::queue<TimeStamp> mStartTimes;
std::queue<VsyncId> mStartIds;
std::queue<uint8_t> mDocFrameCounts;
bool mHadSlowFrame = false;
};

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

@ -8,7 +8,6 @@
#include "gfxPrefs.h"
#include "LayersLogging.h"
#include "mozilla/ipc/ByteBuf.h"
#include "mozilla/webrender/RendererOGL.h"
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/layers/CompositorThread.h"
@ -81,9 +80,8 @@ class NewRenderer : public RendererEvent {
? aRenderThread.GetShaders()->RawShaders()
: nullptr,
aRenderThread.ThreadPool().Raw(), &WebRenderMallocSizeOf,
&WebRenderMallocEnclosingSizeOf,
(uint32_t)wr::RenderRoot::Default,
mDocHandle, &wrRenderer, mMaxTextureSize)) {
&WebRenderMallocEnclosingSizeOf, mDocHandle, &wrRenderer,
mMaxTextureSize)) {
// wr_window_new puts a message into gfxCriticalNote if it returns false
return;
}
@ -207,12 +205,10 @@ bool TransactionBuilder::IsRenderedFrameInvalidated() const {
}
void TransactionBuilder::SetDocumentView(
const LayoutDeviceIntRect& aDocumentRect,
const LayoutDeviceIntSize& aWidgetSize) {
const LayoutDeviceIntRect& aDocumentRect) {
wr::FramebufferIntRect wrDocRect;
wrDocRect.origin.x = aDocumentRect.x;
wrDocRect.origin.y =
aWidgetSize.height - aDocumentRect.y - aDocumentRect.height;
wrDocRect.origin.y = aDocumentRect.y;
wrDocRect.size.width = aDocumentRect.width;
wrDocRect.size.height = aDocumentRect.height;
wr_transaction_set_document_view(mTxn, &wrDocRect);
@ -280,8 +276,7 @@ already_AddRefed<WebRenderAPI> WebRenderAPI::Create(
return RefPtr<WebRenderAPI>(
new WebRenderAPI(docHandle, aWindowId, maxTextureSize, useANGLE,
useDComp, useTripleBuffering, syncHandle,
wr::RenderRoot::Default))
useDComp, useTripleBuffering, syncHandle))
.forget();
}
@ -291,25 +286,24 @@ already_AddRefed<WebRenderAPI> WebRenderAPI::Clone() {
RefPtr<WebRenderAPI> renderApi =
new WebRenderAPI(docHandle, mId, mMaxTextureSize, mUseANGLE, mUseDComp,
mUseTripleBuffering, mSyncHandle, mRenderRoot);
mUseTripleBuffering, mSyncHandle);
renderApi->mRootApi = this; // Hold root api
renderApi->mRootDocumentApi = this;
return renderApi.forget();
}
already_AddRefed<WebRenderAPI> WebRenderAPI::CreateDocument(
LayoutDeviceIntSize aSize, int8_t aLayerIndex, wr::RenderRoot aRenderRoot) {
LayoutDeviceIntSize aSize, int8_t aLayerIndex) {
wr::FramebufferIntSize wrSize;
wrSize.width = aSize.width;
wrSize.height = aSize.height;
wr::DocumentHandle* newDoc;
wr_api_create_document(mDocHandle, &newDoc, wrSize, aLayerIndex,
(uint32_t)aRenderRoot);
wr_api_create_document(mDocHandle, &newDoc, wrSize, aLayerIndex);
RefPtr<WebRenderAPI> api(
new WebRenderAPI(newDoc, mId, mMaxTextureSize, mUseANGLE, mUseDComp,
mUseTripleBuffering, mSyncHandle, aRenderRoot));
RefPtr<WebRenderAPI> api(new WebRenderAPI(newDoc, mId, mMaxTextureSize,
mUseANGLE, mUseDComp,
mUseTripleBuffering, mSyncHandle));
api->mRootApi = this;
return api.forget();
}
@ -318,21 +312,6 @@ wr::WrIdNamespace WebRenderAPI::GetNamespace() {
return wr_api_get_namespace(mDocHandle);
}
WebRenderAPI::WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId,
uint32_t aMaxTextureSize, bool aUseANGLE,
bool aUseDComp, bool aUseTripleBuffering,
layers::SyncHandle aSyncHandle,
wr::RenderRoot aRenderRoot)
: mDocHandle(aHandle),
mId(aId),
mMaxTextureSize(aMaxTextureSize),
mUseANGLE(aUseANGLE),
mUseDComp(aUseDComp),
mUseTripleBuffering(aUseTripleBuffering),
mSyncHandle(aSyncHandle),
mDebugFlags({0}),
mRenderRoot(aRenderRoot) {}
WebRenderAPI::~WebRenderAPI() {
if (!mRootDocumentApi) {
wr_api_delete_document(mDocHandle);
@ -666,13 +645,9 @@ void WebRenderAPI::RunOnRenderThread(UniquePtr<RendererEvent> aEvent) {
DisplayListBuilder::DisplayListBuilder(PipelineId aId,
const wr::LayoutSize& aContentSize,
size_t aCapacity, RenderRoot aRenderRoot)
size_t aCapacity)
: mCurrentSpaceAndClipChain(wr::RootScrollNodeWithChain()),
mActiveFixedPosTracker(nullptr),
mPipelineId(aId),
mContentSize(aContentSize),
mRenderRoot(aRenderRoot),
mSendSubBuilderDisplayList(aRenderRoot == wr::RenderRoot::Default) {
mActiveFixedPosTracker(nullptr) {
MOZ_COUNT_CTOR(DisplayListBuilder);
mWrState = wr_state_new(aId, aContentSize, aCapacity);
}
@ -686,31 +661,6 @@ void DisplayListBuilder::Save() { wr_dp_save(mWrState); }
void DisplayListBuilder::Restore() { wr_dp_restore(mWrState); }
void DisplayListBuilder::ClearSave() { wr_dp_clear_save(mWrState); }
DisplayListBuilder& DisplayListBuilder::CreateSubBuilder(
const wr::LayoutSize& aContentSize, size_t aCapacity,
wr::RenderRoot aRenderRoot) {
MOZ_ASSERT(mRenderRoot == wr::RenderRoot::Default);
MOZ_ASSERT(!mSubBuilders[aRenderRoot]);
mSubBuilders[aRenderRoot] = MakeUnique<DisplayListBuilder>(
mPipelineId, aContentSize, aCapacity, aRenderRoot);
return *mSubBuilders[aRenderRoot];
}
DisplayListBuilder& DisplayListBuilder::SubBuilder(RenderRoot aRenderRoot) {
if (aRenderRoot == mRenderRoot) {
return *this;
}
return *mSubBuilders[aRenderRoot];
}
bool DisplayListBuilder::HasSubBuilder(RenderRoot aRenderRoot) {
if (aRenderRoot == RenderRoot::Default) {
MOZ_ASSERT(mRenderRoot == RenderRoot::Default);
return true;
}
return !!mSubBuilders[aRenderRoot];
}
usize DisplayListBuilder::Dump(usize aIndent, const Maybe<usize>& aStart,
const Maybe<usize>& aEnd) {
return wr_dump_display_list(mWrState, aIndent, aStart.ptrOr(nullptr),
@ -723,19 +673,6 @@ void DisplayListBuilder::Finalize(wr::LayoutSize& aOutContentSize,
&aOutDisplayList.dl.inner);
}
void DisplayListBuilder::Finalize(
layers::RenderRootDisplayListData& aOutTransaction) {
MOZ_ASSERT(mRenderRoot == wr::RenderRoot::Default);
wr::VecU8 dl;
wr_api_finalize_builder(SubBuilder(aOutTransaction.mRenderRoot).mWrState,
&aOutTransaction.mContentSize,
&aOutTransaction.mDLDesc, &dl.inner);
aOutTransaction.mDL.emplace(dl.inner.data, dl.inner.length,
dl.inner.capacity);
dl.inner.capacity = 0;
dl.inner.data = nullptr;
}
Maybe<wr::WrSpatialId> DisplayListBuilder::PushStackingContext(
const wr::StackingContextParams& aParams, const wr::LayoutRect& aBounds,
const wr::RasterSpace& aRasterSpace) {

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

@ -37,7 +37,6 @@ namespace layers {
class CompositorBridgeParent;
class WebRenderBridgeParent;
class RenderRootStateManager;
struct RenderRootDisplayListData;
} // namespace layers
namespace layout {
@ -104,8 +103,7 @@ class TransactionBuilder {
const nsTArray<wr::WrOpacityProperty>& aOpacityArray,
const nsTArray<wr::WrTransformProperty>& aTransformArray);
void SetDocumentView(const LayoutDeviceIntRect& aDocRect,
const LayoutDeviceIntSize& aWidgetSize);
void SetDocumentView(const LayoutDeviceIntRect& aDocRect);
void UpdateScrollPosition(
const wr::WrPipelineId& aPipelineId,
@ -210,8 +208,7 @@ class WebRenderAPI {
const wr::WrWindowId& aWindowId, LayoutDeviceIntSize aSize);
already_AddRefed<WebRenderAPI> CreateDocument(LayoutDeviceIntSize aSize,
int8_t aLayerIndex,
wr::RenderRoot aRenderRoot);
int8_t aLayerIndex);
already_AddRefed<WebRenderAPI> Clone();
@ -242,7 +239,6 @@ class WebRenderAPI {
void AccumulateMemoryReport(wr::MemoryReport*);
wr::WrIdNamespace GetNamespace();
wr::RenderRoot GetRenderRoot() const { return mRenderRoot; }
uint32_t GetMaxTextureSize() const { return mMaxTextureSize; }
bool GetUseANGLE() const { return mUseANGLE; }
bool GetUseDComp() const { return mUseDComp; }
@ -253,9 +249,16 @@ class WebRenderAPI {
protected:
WebRenderAPI(wr::DocumentHandle* aHandle, wr::WindowId aId,
uint32_t aMaxTextureSize, bool aUseANGLE, bool aUseDComp,
bool aUseTripleBuffering, layers::SyncHandle aSyncHandle,
wr::RenderRoot aRenderRoot);
int32_t aMaxTextureSize, bool aUseANGLE, bool aUseDComp,
bool aUseTripleBuffering, layers::SyncHandle aSyncHandle)
: mDocHandle(aHandle),
mId(aId),
mMaxTextureSize(aMaxTextureSize),
mUseANGLE(aUseANGLE),
mUseDComp(aUseDComp),
mUseTripleBuffering(aUseTripleBuffering),
mSyncHandle(aSyncHandle),
mDebugFlags({0}) {}
~WebRenderAPI();
// Should be used only for shutdown handling
@ -271,7 +274,6 @@ class WebRenderAPI {
bool mUseTripleBuffering;
layers::SyncHandle mSyncHandle;
wr::DebugFlags mDebugFlags;
wr::RenderRoot mRenderRoot;
// We maintain alive the root api to know when to shut the render backend
// down, and the root api for the document to know when to delete the
@ -350,8 +352,7 @@ class DisplayListBuilder {
public:
explicit DisplayListBuilder(wr::PipelineId aId,
const wr::LayoutSize& aContentSize,
size_t aCapacity = 0,
RenderRoot aRenderRoot = RenderRoot::Default);
size_t aCapacity = 0);
DisplayListBuilder(DisplayListBuilder&&) = default;
~DisplayListBuilder();
@ -362,28 +363,8 @@ class DisplayListBuilder {
usize Dump(usize aIndent, const Maybe<usize>& aStart,
const Maybe<usize>& aEnd);
void Finalize(wr::LayoutSize& aOutContentSizes,
void Finalize(wr::LayoutSize& aOutContentSize,
wr::BuiltDisplayList& aOutDisplayList);
void Finalize(layers::RenderRootDisplayListData& aOutTransaction);
RenderRoot GetRenderRoot() const { return mRenderRoot; }
bool HasSubBuilder(RenderRoot aRenderRoot);
DisplayListBuilder& CreateSubBuilder(const wr::LayoutSize& aContentSize,
size_t aCapacity,
RenderRoot aRenderRoot);
DisplayListBuilder& SubBuilder(RenderRoot aRenderRoot);
bool GetSendSubBuilderDisplayList(RenderRoot aRenderRoot) {
if (aRenderRoot == RenderRoot::Default) {
return true;
}
return mSubBuilders[aRenderRoot] &&
mSubBuilders[aRenderRoot]->mSendSubBuilderDisplayList;
}
void SetSendSubBuilderDisplayList(RenderRoot aRenderRoot) {
mSubBuilders[aRenderRoot]->mSendSubBuilderDisplayList = true;
}
Maybe<wr::WrSpatialId> PushStackingContext(
const StackingContextParams& aParams, const wr::LayoutRect& aBounds,
@ -612,13 +593,6 @@ class DisplayListBuilder {
FixedPosScrollTargetTracker* mActiveFixedPosTracker;
NonDefaultRenderRootArray<UniquePtr<DisplayListBuilder>> mSubBuilders;
wr::PipelineId mPipelineId;
wr::LayoutSize mContentSize;
RenderRoot mRenderRoot;
bool mSendSubBuilderDisplayList;
friend class WebRenderAPI;
friend class SpaceAndClipChainHelper;
};

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

@ -42,10 +42,5 @@ WrSpaceAndClipChain RootScrollNodeWithChain() {
return sacc;
}
RenderRoot RenderRootFromId(DocumentId id) {
MOZ_ASSERT(id.mHandle < kRenderRootCount);
return (RenderRoot)id.mHandle;
}
} // namespace wr
} // namespace mozilla

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

@ -9,7 +9,6 @@
#include "ImageTypes.h"
#include "mozilla/webrender/webrender_ffi.h"
#include "mozilla/EnumSet.h"
#include "mozilla/Maybe.h"
#include "mozilla/gfx/Matrix.h"
#include "mozilla/gfx/Types.h"
@ -37,8 +36,6 @@ typedef uintptr_t usize;
typedef wr::WrWindowId WindowId;
typedef wr::WrPipelineId PipelineId;
typedef wr::WrDocumentId DocumentId;
typedef wr::WrRemovedPipeline RemovedPipeline;
typedef wr::WrImageKey ImageKey;
typedef wr::WrFontKey FontKey;
typedef wr::WrFontInstanceKey FontInstanceKey;
@ -60,75 +57,6 @@ struct ExternalImageKeyPair {
/* Generate a brand new window id and return it. */
WindowId NewWindowId();
MOZ_DEFINE_ENUM_CLASS_WITH_BASE(RenderRoot, uint8_t, (
// The default render root - within the parent process, this refers
// to everything within the top chrome area (urlbar, tab strip, etc.).
// Within the content process, this refers to the content area. Any
// system that multiplexes data streams from different processes is
// responsible for converting RenderRoot::Default into
// RenderRoot::Content (or whatever value is appropriate)
Default,
// Everything below the chrome - even if it is not coming from a content
// process. For example. the devtools, sidebars, and status panel are
// traditionally part of the "chrome," but are assigned a renderroot of
// RenderRoot::Content because they occupy screen space in the "content"
// area of the browser (visually situated below the "chrome" area).
Content
));
typedef EnumSet<RenderRoot, uint8_t> RenderRootSet;
// For simple iteration of all render roots
const Array<RenderRoot, kRenderRootCount> kRenderRoots(
RenderRoot::Default,
RenderRoot::Content);
const Array<RenderRoot, kRenderRootCount - 1> kNonDefaultRenderRoots(
RenderRoot::Content);
template <typename T>
class RenderRootArray : public Array<T, kRenderRootCount> {
typedef Array<T, kRenderRootCount> Super;
public:
RenderRootArray() {}
explicit RenderRootArray(T aDefault) {
for (auto renderRoot : kRenderRoots) {
(*this)[renderRoot] = aDefault;
}
}
T& operator[](wr::RenderRoot aIndex) {
return (*(Super*)this)[(size_t)aIndex];
}
const T& operator[](wr::RenderRoot aIndex) const {
return (*(Super*)this)[(size_t)aIndex];
}
T& operator[](size_t aIndex) = delete;
const T& operator[](size_t aIndex) const = delete;
};
template <typename T>
class NonDefaultRenderRootArray : public Array<T, kRenderRootCount - 1> {
typedef Array<T, kRenderRootCount - 1> Super;
public:
T& operator[](wr::RenderRoot aIndex) {
return (*(Super*)this)[(size_t)aIndex - 1];
}
const T& operator[](wr::RenderRoot aIndex) const {
return (*(Super*)this)[(size_t)aIndex - 1];
}
T& operator[](size_t aIndex) = delete;
const T& operator[](size_t aIndex) const = delete;
};
RenderRoot RenderRootFromId(DocumentId id);
inline DebugFlags NewDebugFlags(uint32_t aFlags) { return {aFlags}; }
inline Maybe<wr::ImageFormat> SurfaceFormatToImageFormat(

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

@ -107,8 +107,6 @@ type WrEpoch = Epoch;
/// cbindgen:derive-neq=true
pub type WrIdNamespace = IdNamespace;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrDocumentId = DocumentId;
/// cbindgen:field-names=[mNamespace, mHandle]
type WrPipelineId = PipelineId;
/// cbindgen:field-names=[mNamespace, mHandle]
@ -217,14 +215,6 @@ impl DocumentHandle {
document_id: doc
}
}
pub fn new_with_id(api: RenderApi, size: FramebufferIntSize, layer: i8, id: u32) -> DocumentHandle {
let doc = api.add_document_with_id(size, layer, id);
DocumentHandle {
api: api,
document_id: doc
}
}
}
#[repr(C)]
@ -578,8 +568,8 @@ extern "C" {
fn wr_notifier_nop_frame_done(window_id: WrWindowId);
fn wr_notifier_external_event(window_id: WrWindowId,
raw_event: usize);
fn wr_schedule_render(window_id: WrWindowId, document_id: WrDocumentId);
fn wr_finished_scene_build(window_id: WrWindowId, document_id: WrDocumentId, pipeline_info: WrPipelineInfo);
fn wr_schedule_render(window_id: WrWindowId);
fn wr_finished_scene_build(window_id: WrWindowId, pipeline_info: WrPipelineInfo);
fn wr_transaction_notification_notified(handler: usize, when: Checkpoint);
}
@ -684,6 +674,18 @@ pub unsafe extern "C" fn wr_renderer_readback(renderer: &mut Renderer,
&mut slice);
}
#[no_mangle]
pub extern "C" fn wr_renderer_current_epoch(renderer: &mut Renderer,
pipeline_id: WrPipelineId,
out_epoch: &mut WrEpoch)
-> bool {
if let Some(epoch) = renderer.current_epoch(pipeline_id) {
*out_epoch = epoch;
return true;
}
return false;
}
/// cbindgen:postfix=WR_DESTRUCTOR_SAFE_FUNC
#[no_mangle]
pub unsafe extern "C" fn wr_renderer_delete(renderer: *mut Renderer) {
@ -703,35 +705,18 @@ pub unsafe extern "C" fn wr_renderer_accumulate_memory_report(renderer: &mut Ren
#[repr(C)]
pub struct WrPipelineEpoch {
pipeline_id: WrPipelineId,
document_id: WrDocumentId,
epoch: WrEpoch,
}
impl<'a> From<(&'a(WrPipelineId, WrDocumentId), &'a WrEpoch)> for WrPipelineEpoch {
fn from(tuple: (&(WrPipelineId, WrDocumentId), &WrEpoch)) -> WrPipelineEpoch {
impl<'a> From<(&'a WrPipelineId, &'a WrEpoch)> for WrPipelineEpoch {
fn from(tuple: (&WrPipelineId, &WrEpoch)) -> WrPipelineEpoch {
WrPipelineEpoch {
pipeline_id: (tuple.0).0,
document_id: (tuple.0).1,
pipeline_id: *tuple.0,
epoch: *tuple.1
}
}
}
#[repr(C)]
pub struct WrRemovedPipeline {
pipeline_id: WrPipelineId,
document_id: WrDocumentId,
}
impl<'a> From<&'a (WrPipelineId, WrDocumentId)> for WrRemovedPipeline {
fn from(tuple: &(WrPipelineId, WrDocumentId)) -> WrRemovedPipeline {
WrRemovedPipeline {
pipeline_id: tuple.0,
document_id: tuple.1,
}
}
}
#[repr(C)]
pub struct WrPipelineInfo {
// This contains an entry for each pipeline that was rendered, along with
@ -745,15 +730,14 @@ pub struct WrPipelineInfo {
// up in this array means that the data structures have been torn down on
// the webrender side, and so any remaining data structures on the caller
// side can now be torn down also.
removed_pipelines: FfiVec<WrRemovedPipeline>,
removed_pipelines: FfiVec<PipelineId>,
}
impl WrPipelineInfo {
fn new(info: &PipelineInfo) -> Self {
WrPipelineInfo {
epochs: FfiVec::from_vec(info.epochs.iter().map(WrPipelineEpoch::from).collect()),
removed_pipelines: FfiVec::from_vec(info.removed_pipelines.iter()
.map(WrRemovedPipeline::from).collect()),
removed_pipelines: FfiVec::from_vec(info.removed_pipelines.clone()),
}
}
}
@ -827,8 +811,7 @@ extern "C" {
// These callbacks are invoked from the render backend thread (aka the APZ
// sampler thread)
fn apz_register_sampler(window_id: WrWindowId);
fn apz_sample_transforms(window_id: WrWindowId, transaction: &mut Transaction,
document_id: WrDocumentId);
fn apz_sample_transforms(window_id: WrWindowId, transaction: &mut Transaction);
fn apz_deregister_sampler(window_id: WrWindowId);
}
@ -860,7 +843,7 @@ impl SceneBuilderHooks for APZCallbacks {
}
}
fn post_scene_swap(&self, document_id: DocumentId, info: PipelineInfo, sceneswap_time: u64) {
fn post_scene_swap(&self, info: PipelineInfo, sceneswap_time: u64) {
unsafe {
let info = WrPipelineInfo::new(&info);
record_telemetry_time(TelemetryProbe::SceneSwapTime, sceneswap_time);
@ -871,12 +854,12 @@ impl SceneBuilderHooks for APZCallbacks {
// After a scene swap we should schedule a render for the next vsync,
// otherwise there's no guarantee that the new scene will get rendered
// anytime soon
unsafe { wr_finished_scene_build(self.window_id, document_id, info) }
unsafe { wr_finished_scene_build(self.window_id, info) }
unsafe { gecko_profiler_end_marker(b"SceneBuilding\0".as_ptr() as *const c_char); }
}
fn post_resource_update(&self, document_id: DocumentId) {
unsafe { wr_schedule_render(self.window_id, document_id) }
fn post_resource_update(&self) {
unsafe { wr_schedule_render(self.window_id) }
unsafe { gecko_profiler_end_marker(b"SceneBuilding\0".as_ptr() as *const c_char); }
}
@ -910,9 +893,9 @@ impl AsyncPropertySampler for SamplerCallback {
unsafe { apz_register_sampler(self.window_id) }
}
fn sample(&self, document_id: DocumentId) -> Vec<FrameMsg> {
fn sample(&self) -> Vec<FrameMsg> {
let mut transaction = Transaction::new();
unsafe { apz_sample_transforms(self.window_id, &mut transaction, document_id) };
unsafe { apz_sample_transforms(self.window_id, &mut transaction) };
// TODO: also omta_sample_transforms(...)
transaction.get_frame_ops()
}
@ -1074,7 +1057,6 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
thread_pool: *mut WrThreadPool,
size_of_op: VoidPtrToSizeFn,
enclosing_size_of_op: VoidPtrToSizeFn,
document_id: u32,
out_handle: &mut *mut DocumentHandle,
out_renderer: &mut *mut Renderer,
out_max_texture_size: *mut i32)
@ -1180,8 +1162,7 @@ pub extern "C" fn wr_window_new(window_id: WrWindowId,
let window_size = FramebufferIntSize::new(window_width, window_height);
let layer = 0;
*out_handle = Box::into_raw(Box::new(
DocumentHandle::new_with_id(sender.create_api_by_client(next_namespace_id()),
window_size, layer, document_id)));
DocumentHandle::new(sender.create_api_by_client(next_namespace_id()), window_size, layer)));
*out_renderer = Box::into_raw(Box::new(renderer));
return true;
@ -1193,15 +1174,13 @@ pub extern "C" fn wr_api_create_document(
out_handle: &mut *mut DocumentHandle,
doc_size: FramebufferIntSize,
layer: i8,
document_id: u32
) {
assert!(unsafe { is_in_compositor_thread() });
*out_handle = Box::into_raw(Box::new(DocumentHandle::new_with_id(
*out_handle = Box::into_raw(Box::new(DocumentHandle::new(
root_dh.api.clone_sender().create_api_by_client(next_namespace_id()),
doc_size,
layer,
document_id
layer
)));
}
@ -1388,8 +1367,7 @@ pub extern "C" fn wr_transaction_set_document_view(
}
#[no_mangle]
pub extern "C" fn wr_transaction_generate_frame(
txn: &mut Transaction) {
pub extern "C" fn wr_transaction_generate_frame(txn: &mut Transaction) {
txn.generate_frame();
}

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

@ -68,7 +68,6 @@ struct InternerSubReport {
struct Transaction;
struct WrWindowId;
struct DocumentId;
struct WrPipelineInfo;
const uint64_t ROOT_CLIP_CHAIN = ~0;
@ -85,8 +84,7 @@ void apz_deregister_updater(mozilla::wr::WrWindowId aWindowId);
void apz_register_sampler(mozilla::wr::WrWindowId aWindowId);
void apz_sample_transforms(mozilla::wr::WrWindowId aWindowId,
mozilla::wr::Transaction* aTransaction,
mozilla::wr::DocumentId aRenderRootId);
mozilla::wr::Transaction* aTransaction);
void apz_deregister_sampler(mozilla::wr::WrWindowId aWindowId);
} // extern "C"

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше