Bug 1409446 - Remove unused function. r=jrmuizel

We don't use the code to track the parents of each scroll id, so we can
dump it and just keep a set of scroll ids that we've defined to avoid
redefining them.

MozReview-Commit-ID: HY8y7xt9AJ6

--HG--
extra : rebase_source : 681154ae6494330f74c022243237b50d4921813b
This commit is contained in:
Kartikaya Gupta 2017-10-24 15:45:58 -04:00
Родитель 2878061467
Коммит d3658ef3fb
2 изменённых файлов: 7 добавлений и 23 удалений

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

@ -778,7 +778,7 @@ DisplayListBuilder::PopStickyFrame()
bool
DisplayListBuilder::IsScrollLayerDefined(layers::FrameMetrics::ViewID aScrollId) const
{
return mScrollParents.find(aScrollId) != mScrollParents.end();
return mScrollIdsDefined.find(aScrollId) != mScrollIdsDefined.end();
}
void
@ -794,9 +794,7 @@ DisplayListBuilder::DefineScrollLayer(const layers::FrameMetrics::ViewID& aScrol
aAncestorClipId ? Stringify(aAncestorClipId.ref().id).c_str() : "(nil)",
Stringify(aContentRect).c_str(), Stringify(aClipRect).c_str());
Maybe<layers::FrameMetrics::ViewID> parent =
mScrollIdStack.empty() ? Nothing() : Some(mScrollIdStack.back());
auto it = mScrollParents.insert({aScrollId, parent});
auto it = mScrollIdsDefined.insert(aScrollId);
if (it.second) {
// An insertion took place, which means we haven't defined aScrollId before.
// So let's define it now.
@ -806,10 +804,6 @@ DisplayListBuilder::DefineScrollLayer(const layers::FrameMetrics::ViewID& aScrol
}
wr_dp_define_scroll_layer(mWrState, aScrollId, aAncestorScrollId.ptrOr(nullptr),
ancestorClipId, aContentRect, aClipRect);
} else {
// aScrollId was already a key in mScrollParents so check that the parent
// value is the same.
MOZ_ASSERT(it.first->second == parent);
}
}
@ -1152,12 +1146,5 @@ DisplayListBuilder::TopmostScrollId()
return mScrollIdStack.back();
}
Maybe<layers::FrameMetrics::ViewID>
DisplayListBuilder::ParentScrollIdFor(layers::FrameMetrics::ViewID aScrollId)
{
auto it = mScrollParents.find(aScrollId);
return (it == mScrollParents.end() ? Nothing() : it->second);
}
} // namespace wr
} // namespace mozilla

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

@ -9,6 +9,7 @@
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/layers/SyncObject.h"
@ -401,10 +402,6 @@ public:
Maybe<wr::WrClipId> TopmostClipId();
// Same as TopmostClipId() but for scroll layers.
layers::FrameMetrics::ViewID TopmostScrollId();
// Returns the scroll id that was pushed just before the given scroll id. This
// function returns Nothing() if the given scrollid has not been encountered,
// or if it is the rootmost scroll id (and therefore has no ancestor).
Maybe<layers::FrameMetrics::ViewID> ParentScrollIdFor(layers::FrameMetrics::ViewID aScrollId);
// Try to avoid using this when possible.
wr::WrState* Raw() { return mWrState; }
@ -422,10 +419,10 @@ protected:
std::vector<wr::WrClipId> mClipIdStack;
std::vector<layers::FrameMetrics::ViewID> mScrollIdStack;
// Track the parent scroll id of each scroll id that we encountered. A
// Nothing() value indicates a root scroll id. We also use this structure to
// ensure that we don't define a particular scroll layer multiple times.
std::unordered_map<layers::FrameMetrics::ViewID, Maybe<layers::FrameMetrics::ViewID>> mScrollParents;
// Track each scroll id that we encountered. We use this structure to
// ensure that we don't define a particular scroll layer multiple times,
// as that results in undefined behaviour in WR.
std::unordered_set<layers::FrameMetrics::ViewID> mScrollIdsDefined;
// The number of extra clips that are in the stack.
uint32_t mExtraClipCount;