Bug 708901 - Migrate to nsTHashSet in accessible. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D108589
This commit is contained in:
Simon Giesecke 2021-03-23 10:36:32 +00:00
Родитель 67753c4382
Коммит 485ec92560
6 изменённых файлов: 14 добавлений и 12 удалений

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

@ -654,9 +654,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
}
// Process rendered text change notifications.
for (auto iter = mTextHash.ConstIter(); !iter.Done(); iter.Next()) {
const nsCOMPtrHashKey<nsIContent>* entry = iter.Get();
nsIContent* textNode = entry->GetKey();
for (nsIContent* textNode : mTextHash) {
LocalAccessible* textAcc = mDocument->GetAccessible(textNode);
// If the text node is not in tree or doesn't have a frame, or placed in

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

@ -12,6 +12,7 @@
#include "mozilla/Tuple.h"
#include "nsCycleCollectionParticipant.h"
#include "nsRefreshObservers.h"
#include "nsTHashSet.h"
#include <utility>
@ -173,7 +174,7 @@ class NotificationController final : public EventQueue,
MOZ_ASSERT(aTextNode->GetPrimaryFrame()->StyleVisibility()->IsVisible(),
"A text node is not visible");
mTextHash.PutEntry(aTextNode);
mTextHash.Insert(aTextNode);
ScheduleProcessing();
}
@ -383,7 +384,7 @@ class NotificationController final : public EventQueue,
/**
* Pending accessible tree update notifications for rendered text changes.
*/
nsTHashtable<nsCOMPtrHashKey<nsIContent>> mTextHash;
nsTHashSet<nsCOMPtrHashKey<nsIContent>> mTextHash;
/**
* Other notifications like DOM events. Don't make this an AutoTArray; we

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

@ -38,6 +38,7 @@
#include "nsIURI.h"
#include "nsIWebNavigation.h"
#include "nsFocusManager.h"
#include "nsTHashSet.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/EventStates.h"
@ -2038,7 +2039,7 @@ class InsertIterator final {
TreeWalker mWalker;
const nsTArray<nsCOMPtr<nsIContent>>* mNodes;
nsTHashtable<nsPtrHashKey<const nsIContent>> mProcessedNodes;
nsTHashSet<nsPtrHashKey<const nsIContent>> mProcessedNodes;
uint32_t mNodesIdx;
};

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

@ -9,6 +9,7 @@
#define mozilla_a11y_DocAccessibleWrap_h__
#include "DocAccessible.h"
#include "nsTHashSet.h"
namespace mozilla {
@ -36,7 +37,7 @@ class DocAccessibleWrap : public DocAccessible {
virtual void DoInitialUpdate() override;
private:
nsTHashtable<nsVoidPtrHashKey> mNewLiveRegions;
nsTHashSet<void*> mNewLiveRegions;
};
} // namespace a11y

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

@ -84,13 +84,13 @@ void DocAccessibleWrap::QueueNewLiveRegion(LocalAccessible* aAccessible) {
return;
}
mNewLiveRegions.PutEntry(aAccessible->UniqueID());
mNewLiveRegions.Insert(aAccessible->UniqueID());
}
void DocAccessibleWrap::ProcessNewLiveRegions() {
for (auto iter = mNewLiveRegions.Iter(); !iter.Done(); iter.Next()) {
for (const auto& uniqueID : mNewLiveRegions) {
if (LocalAccessible* liveRegion =
GetAccessibleByUniqueID(const_cast<void*>(iter.Get()->GetKey()))) {
GetAccessibleByUniqueID(const_cast<void*>(uniqueID))) {
FireDelayedEvent(nsIAccessibleEvent::EVENT_LIVE_REGION_ADDED, liveRegion);
}
}

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

@ -12,6 +12,7 @@
#include "mozilla/WindowsVersion.h"
#include "nsTHashMap.h"
#include "nsTHashSet.h"
#include "nsPrintfCString.h"
#include "nsReadableUtils.h"
#include "nsString.h"
@ -224,7 +225,7 @@ Maybe<bool> Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam) {
const DWORD ourPid = ::GetCurrentProcessId();
Maybe<PVOID> kernelObject;
static Maybe<USHORT> sectionObjTypeIndex;
nsTHashtable<nsUint32HashKey> nonSectionObjTypes;
nsTHashSet<uint32_t> nonSectionObjTypes;
nsTHashMap<nsVoidPtrHashKey, DWORD> objMap;
auto handleInfo =
@ -275,7 +276,7 @@ Maybe<bool> Compatibility::OnUIAMessage(WPARAM aWParam, LPARAM aLParam) {
nsDependentSubstring objTypeName(
objType->TypeName.Buffer, objType->TypeName.Length / sizeof(wchar_t));
if (!objTypeName.Equals(u"Section"_ns)) {
nonSectionObjTypes.PutEntry(
nonSectionObjTypes.Insert(
static_cast<uint32_t>(curHandle.mObjectTypeIndex));
continue;
}