зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1182964 - Replace use of nsTHashtable::EnumerateEntries with nsTHashtable::Iterator in layout/{style,svg}/. r=njn
This commit is contained in:
Родитель
c00da5ced5
Коммит
c896fb268a
|
@ -125,19 +125,14 @@ FontFaceSet::FontFaceSet(nsPIDOMWindow* aWindow, nsIDocument* aDocument)
|
|||
mUserFontSet = new UserFontSet(this);
|
||||
}
|
||||
|
||||
static PLDHashOperator DestroyIterator(nsPtrHashKey<nsFontFaceLoader>* aKey,
|
||||
void* aUserArg)
|
||||
{
|
||||
aKey->GetKey()->Cancel();
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
FontFaceSet::~FontFaceSet()
|
||||
{
|
||||
MOZ_COUNT_DTOR(FontFaceSet);
|
||||
|
||||
Disconnect();
|
||||
mLoaders.EnumerateEntries(DestroyIterator, nullptr);
|
||||
for (auto it = mLoaders.Iter(); !it.Done(); it.Next()) {
|
||||
it.Get()->GetKey()->Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
|
|
@ -45,22 +45,6 @@ ImageLoader::SetAnimationModeEnumerator(nsISupports* aKey, FrameSet* aValue,
|
|||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
ClearImageHashSet(nsPtrHashKey<ImageLoader::Image>* aKey, void* aClosure)
|
||||
{
|
||||
nsIDocument* doc = static_cast<nsIDocument*>(aClosure);
|
||||
ImageLoader::Image* image = aKey->GetKey();
|
||||
|
||||
imgIRequest* request = image->mRequests.GetWeak(doc);
|
||||
if (request) {
|
||||
request->CancelAndForgetObserver(NS_BINDING_ABORTED);
|
||||
}
|
||||
|
||||
image->mRequests.Remove(doc);
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
ImageLoader::DropDocumentReference()
|
||||
{
|
||||
|
@ -68,7 +52,17 @@ ImageLoader::DropDocumentReference()
|
|||
// on the document being null) as that means the presshell has already
|
||||
// been destroyed, and it also calls ClearFrames when it is destroyed.
|
||||
ClearFrames(GetPresContext());
|
||||
mImages.EnumerateEntries(&ClearImageHashSet, mDocument);
|
||||
|
||||
for (auto it = mImages.Iter(); !it.Done(); it.Next()) {
|
||||
ImageLoader::Image* image = it.Get()->GetKey();
|
||||
imgIRequest* request = image->mRequests.GetWeak(mDocument);
|
||||
if (request) {
|
||||
request->CancelAndForgetObserver(NS_BINDING_ABORTED);
|
||||
}
|
||||
image->mRequests.Remove(mDocument);
|
||||
}
|
||||
mImages.Clear();
|
||||
|
||||
mDocument = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -659,30 +659,6 @@ nsSVGEffects::GetFilterProperty(nsIFrame *aFrame)
|
|||
(aFrame->Properties().Get(FilterProperty()));
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
GatherEnumerator(nsPtrHashKey<nsSVGRenderingObserver>* aEntry, void* aArg)
|
||||
{
|
||||
nsTArray<nsSVGRenderingObserver*>* array =
|
||||
static_cast<nsTArray<nsSVGRenderingObserver*>*>(aArg);
|
||||
array->AppendElement(aEntry->GetKey());
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
GatherEnumeratorForReflow(nsPtrHashKey<nsSVGRenderingObserver>* aEntry, void* aArg)
|
||||
{
|
||||
if (!aEntry->GetKey()->ObservesReflow()) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsTArray<nsSVGRenderingObserver*>* array =
|
||||
static_cast<nsTArray<nsSVGRenderingObserver*>*>(aArg);
|
||||
array->AppendElement(aEntry->GetKey());
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGRenderingObserverList::InvalidateAll()
|
||||
{
|
||||
|
@ -691,8 +667,10 @@ nsSVGRenderingObserverList::InvalidateAll()
|
|||
|
||||
nsAutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||
|
||||
// The PL_DHASH_REMOVE in GatherEnumerator drops all our observers here:
|
||||
mObservers.EnumerateEntries(GatherEnumerator, &observers);
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
observers.AppendElement(it.Get()->GetKey());
|
||||
}
|
||||
mObservers.Clear();
|
||||
|
||||
for (uint32_t i = 0; i < observers.Length(); ++i) {
|
||||
observers[i]->InvalidateViaReferencedElement();
|
||||
|
@ -707,8 +685,13 @@ nsSVGRenderingObserverList::InvalidateAllForReflow()
|
|||
|
||||
nsAutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||
|
||||
// The PL_DHASH_REMOVE in GatherEnumerator drops all our observers here:
|
||||
mObservers.EnumerateEntries(GatherEnumeratorForReflow, &observers);
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
nsSVGRenderingObserver* obs = it.Get()->GetKey();
|
||||
if (obs->ObservesReflow()) {
|
||||
observers.AppendElement(obs);
|
||||
it.Remove();
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < observers.Length(); ++i) {
|
||||
observers[i]->InvalidateViaReferencedElement();
|
||||
|
@ -720,8 +703,10 @@ nsSVGRenderingObserverList::RemoveAll()
|
|||
{
|
||||
nsAutoTArray<nsSVGRenderingObserver*,10> observers;
|
||||
|
||||
// The PL_DHASH_REMOVE in GatherEnumerator drops all our observers here:
|
||||
mObservers.EnumerateEntries(GatherEnumerator, &observers);
|
||||
for (auto it = mObservers.Iter(); !it.Done(); it.Next()) {
|
||||
observers.AppendElement(it.Get()->GetKey());
|
||||
}
|
||||
mObservers.Clear();
|
||||
|
||||
// Our list is now cleared. We need to notify the observers we've removed,
|
||||
// so they can update their state & remove themselves as mutation-observers.
|
||||
|
|
|
@ -623,19 +623,14 @@ nsDisplayOuterSVG::Paint(nsDisplayListBuilder* aBuilder,
|
|||
#endif
|
||||
}
|
||||
|
||||
static PLDHashOperator CheckForeignObjectInvalidatedArea(nsPtrHashKey<nsSVGForeignObjectFrame>* aEntry, void* aData)
|
||||
{
|
||||
nsRegion* region = static_cast<nsRegion*>(aData);
|
||||
region->Or(*region, aEntry->GetKey()->GetInvalidRegion());
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
nsRegion
|
||||
nsSVGOuterSVGFrame::FindInvalidatedForeignObjectFrameChildren(nsIFrame* aFrame)
|
||||
{
|
||||
nsRegion result;
|
||||
if (mForeignObjectHash && mForeignObjectHash->Count()) {
|
||||
mForeignObjectHash->EnumerateEntries(CheckForeignObjectInvalidatedArea, &result);
|
||||
for (auto it = mForeignObjectHash->Iter(); !it.Done(); it.Next()) {
|
||||
result.Or(result, it.Get()->GetKey()->GetInvalidRegion());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче