Bug 1184468 - Use nsTHashtable::Keys where possible. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D108588
This commit is contained in:
@@ -53,8 +53,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EffectCompositor)
|
||||
for (const auto& elementSet : tmp->mElementsToRestyle) {
|
||||
for (const auto& element : elementSet) {
|
||||
CycleCollectionNoteChild(cb, element.GetKey().mElement,
|
||||
for (const auto& key : elementSet.Keys()) {
|
||||
CycleCollectionNoteChild(cb, key.mElement,
|
||||
"EffectCompositor::mElementsToRestyle[]",
|
||||
cb.Flags());
|
||||
}
|
||||
|
||||
@@ -3932,8 +3932,7 @@ static void IntersectionObserverPropertyDtor(void* aObject,
|
||||
void* aData) {
|
||||
auto* element = static_cast<Element*>(aObject);
|
||||
auto* observers = static_cast<IntersectionObserverList*>(aPropertyValue);
|
||||
for (const auto& entry : *observers) {
|
||||
DOMIntersectionObserver* observer = entry.GetKey();
|
||||
for (DOMIntersectionObserver* observer : observers->Keys()) {
|
||||
observer->UnlinkTarget(*element);
|
||||
}
|
||||
delete observers;
|
||||
|
||||
@@ -104,8 +104,7 @@ nsresult ImageTracker::SetLockingState(bool aLocked) {
|
||||
if (mLocking == aLocked) return NS_OK;
|
||||
|
||||
// Otherwise, iterate over our images and perform the appropriate action.
|
||||
for (const auto& entry : mImages) {
|
||||
imgIRequest* image = entry.GetKey();
|
||||
for (imgIRequest* image : mImages.Keys()) {
|
||||
if (aLocked) {
|
||||
image->LockImage();
|
||||
} else {
|
||||
@@ -124,8 +123,7 @@ void ImageTracker::SetAnimatingState(bool aAnimating) {
|
||||
if (mAnimating == aAnimating) return;
|
||||
|
||||
// Otherwise, iterate over our images and perform the appropriate action.
|
||||
for (const auto& entry : mImages) {
|
||||
imgIRequest* image = entry.GetKey();
|
||||
for (imgIRequest* image : mImages.Keys()) {
|
||||
if (aAnimating) {
|
||||
image->IncrementAnimationConsumers();
|
||||
} else {
|
||||
@@ -138,8 +136,8 @@ void ImageTracker::SetAnimatingState(bool aAnimating) {
|
||||
}
|
||||
|
||||
void ImageTracker::RequestDiscardAll() {
|
||||
for (const auto& entry : mImages) {
|
||||
entry.GetKey()->RequestDiscard();
|
||||
for (imgIRequest* image : mImages.Keys()) {
|
||||
image->RequestDiscard();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,8 +151,7 @@ void ImageTracker::MediaFeatureValuesChangedAllDocuments(
|
||||
// Pull the images out into an array and iterate over them, in case the
|
||||
// image notifications do something that ends up modifying the table.
|
||||
nsTArray<nsCOMPtr<imgIContainer>> images;
|
||||
for (const auto& entry : mImages) {
|
||||
imgIRequest* req = entry.GetKey();
|
||||
for (imgIRequest* req : mImages.Keys()) {
|
||||
nsCOMPtr<imgIContainer> image;
|
||||
req->GetImage(getter_AddRefs(image));
|
||||
if (!image) {
|
||||
|
||||
@@ -171,11 +171,8 @@ nsControllerCommandTable::GetCommandState(const char* aCommandName,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsControllerCommandTable::GetSupportedCommands(nsTArray<nsCString>& aCommands) {
|
||||
aCommands.SetCapacity(mCommandsTable.Count());
|
||||
mozilla::AppendToArray(aCommands, mCommandsTable.Keys());
|
||||
|
||||
for (auto iter = mCommandsTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
aCommands.AppendElement(iter.Key());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,8 +169,8 @@ void GamepadManager::RemoveListener(nsGlobalWindowInner* aWindow) {
|
||||
return; // doesn't exist
|
||||
}
|
||||
|
||||
for (auto iter = mGamepads.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
aWindow->RemoveGamepad(iter.Key());
|
||||
for (const auto& key : mGamepads.Keys()) {
|
||||
aWindow->RemoveGamepad(key);
|
||||
}
|
||||
|
||||
mListeners.RemoveElement(aWindow);
|
||||
|
||||
@@ -309,9 +309,7 @@ void HTMLFormControlsCollection::GetSupportedNames(nsTArray<nsString>& aNames) {
|
||||
// Just enumerate mNameLookupTable. This won't guarantee order, but
|
||||
// that's OK, because the HTML5 spec doesn't define an order for
|
||||
// this enumeration.
|
||||
for (auto iter = mNameLookupTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
aNames.AppendElement(iter.Key());
|
||||
}
|
||||
AppendToArray(aNames, mNameLookupTable.Keys());
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
|
||||
@@ -3559,10 +3559,8 @@ void HTMLMediaElement::UpdateOutputTrackSources() {
|
||||
}
|
||||
|
||||
// ...and all MediaElementTrackSources.
|
||||
AutoTArray<nsString, 4> trackSourcesToRemove;
|
||||
for (const auto& entry : mOutputTrackSources) {
|
||||
trackSourcesToRemove.AppendElement(entry.GetKey());
|
||||
}
|
||||
auto trackSourcesToRemove =
|
||||
ToTArray<AutoTArray<nsString, 4>>(mOutputTrackSources.Keys());
|
||||
|
||||
// Then work out the differences.
|
||||
mediaTracksToAdd.RemoveLastElements(
|
||||
|
||||
@@ -90,10 +90,7 @@ Result<Ok, nsresult> SharedStringMapBuilder::Finalize(
|
||||
|
||||
MOZ_ASSERT(mEntries.Count() == mKeyTable.Count());
|
||||
|
||||
nsTArray<nsCString> keys(mEntries.Count());
|
||||
for (auto iter = mEntries.Iter(); !iter.Done(); iter.Next()) {
|
||||
keys.AppendElement(iter.Key());
|
||||
}
|
||||
auto keys = ToTArray<nsTArray<nsCString>>(mEntries.Keys());
|
||||
keys.Sort();
|
||||
|
||||
Header header = {kSharedStringMapMagic, uint32_t(keys.Length())};
|
||||
|
||||
@@ -318,9 +318,7 @@ nsresult LSSnapshot::GetKeys(nsTArray<nsString>& aKeys) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (auto iter = mValues.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
aKeys.AppendElement(iter.Key());
|
||||
}
|
||||
AppendToArray(aKeys, mValues.Keys());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -498,11 +498,7 @@ void GMPServiceChild::RemoveGMPContentParent(
|
||||
|
||||
void GMPServiceChild::GetAlreadyBridgedTo(
|
||||
nsTArray<base::ProcessId>& aAlreadyBridgedTo) {
|
||||
aAlreadyBridgedTo.SetCapacity(mContentParents.Count());
|
||||
for (auto iter = mContentParents.Iter(); !iter.Done(); iter.Next()) {
|
||||
const uint64_t& id = iter.Key();
|
||||
aAlreadyBridgedTo.AppendElement(id);
|
||||
}
|
||||
AppendToArray(aAlreadyBridgedTo, mContentParents.Keys());
|
||||
}
|
||||
|
||||
class OpenPGMPServiceChild : public mozilla::Runnable {
|
||||
|
||||
@@ -119,8 +119,7 @@ void MediaSystemResourceService::ReleaseResource(
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto iter = mResources.Iter(); !iter.Done(); iter.Next()) {
|
||||
const uint32_t& key = iter.Key();
|
||||
for (const uint32_t& key : mResources.Keys()) {
|
||||
RemoveRequests(aParent, static_cast<MediaSystemResourceType>(key));
|
||||
UpdateRequests(static_cast<MediaSystemResourceType>(key));
|
||||
}
|
||||
|
||||
@@ -308,11 +308,7 @@ void MessagePortService::CloseAll(const nsID& aUUID, bool aForced) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
for (auto iter = mPorts.Iter(); !iter.Done(); iter.Next()) {
|
||||
MOZ_ASSERT(!aUUID.Equals(iter.Key()));
|
||||
}
|
||||
#endif
|
||||
MOZ_ASSERT(!mPorts.Contains(aUUID));
|
||||
|
||||
MaybeShutdown();
|
||||
}
|
||||
|
||||
@@ -310,8 +310,7 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
|
||||
// When we sample the child time containers they will simply record the sample
|
||||
// time in document time.
|
||||
TimeContainerHashtable activeContainers(mChildContainerTable.Count());
|
||||
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SMILTimeContainer* container = iter.Get()->GetKey();
|
||||
for (SMILTimeContainer* container : mChildContainerTable.Keys()) {
|
||||
if (!container) {
|
||||
continue;
|
||||
}
|
||||
@@ -351,8 +350,7 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
|
||||
nsTArray<RefPtr<SVGAnimationElement>> animElems(
|
||||
mAnimationElementTable.Count());
|
||||
|
||||
for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SVGAnimationElement* animElem = iter.Get()->GetKey();
|
||||
for (SVGAnimationElement* animElem : mAnimationElementTable.Keys()) {
|
||||
SampleTimedElement(animElem, &activeContainers);
|
||||
AddAnimationToCompositorTable(animElem, currentCompositorTable.get(),
|
||||
isStyleFlushNeeded);
|
||||
@@ -379,9 +377,8 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
|
||||
// * For each compositor in current sample's hash table, remove entry from
|
||||
// prev sample's hash table -- we don't need to clear animation
|
||||
// effects of those compositors, since they're still being animated.
|
||||
for (auto iter = currentCompositorTable->Iter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
mLastCompositorTable->RemoveEntry(iter.Get()->GetKey());
|
||||
for (const auto& key : currentCompositorTable->Keys()) {
|
||||
mLastCompositorTable->RemoveEntry(key);
|
||||
}
|
||||
|
||||
// * For each entry that remains in prev sample's hash table (i.e. for
|
||||
@@ -424,27 +421,21 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
|
||||
}
|
||||
|
||||
void SMILAnimationController::RewindElements() {
|
||||
bool rewindNeeded = false;
|
||||
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SMILTimeContainer* container = iter.Get()->GetKey();
|
||||
if (container->NeedsRewind()) {
|
||||
rewindNeeded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const bool rewindNeeded = std::any_of(
|
||||
mChildContainerTable.Keys().cbegin(), mChildContainerTable.Keys().cend(),
|
||||
[](SMILTimeContainer* container) { return container->NeedsRewind(); });
|
||||
|
||||
if (!rewindNeeded) return;
|
||||
|
||||
for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SVGAnimationElement* animElem = iter.Get()->GetKey();
|
||||
for (SVGAnimationElement* animElem : mAnimationElementTable.Keys()) {
|
||||
SMILTimeContainer* timeContainer = animElem->GetTimeContainer();
|
||||
if (timeContainer && timeContainer->NeedsRewind()) {
|
||||
animElem->TimedElement().Rewind();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
iter.Get()->GetKey()->ClearNeedsRewind();
|
||||
for (SMILTimeContainer* container : mChildContainerTable.Keys()) {
|
||||
container->ClearNeedsRewind();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,8 +466,7 @@ void SMILAnimationController::DoMilestoneSamples() {
|
||||
// before that. Any other milestones will be dealt with in a subsequent
|
||||
// sample.
|
||||
SMILMilestone nextMilestone(GetCurrentTimeAsSMILTime() + 1, true);
|
||||
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SMILTimeContainer* container = iter.Get()->GetKey();
|
||||
for (SMILTimeContainer* container : mChildContainerTable.Keys()) {
|
||||
if (container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN)) {
|
||||
continue;
|
||||
}
|
||||
@@ -493,8 +483,7 @@ void SMILAnimationController::DoMilestoneSamples() {
|
||||
}
|
||||
|
||||
nsTArray<RefPtr<mozilla::dom::SVGAnimationElement>> elements;
|
||||
for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SMILTimeContainer* container = iter.Get()->GetKey();
|
||||
for (SMILTimeContainer* container : mChildContainerTable.Keys()) {
|
||||
if (container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN)) {
|
||||
continue;
|
||||
}
|
||||
@@ -663,9 +652,7 @@ bool SMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
|
||||
}
|
||||
|
||||
bool foundElementsNeedingRestyle = false;
|
||||
for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
SVGAnimationElement* animElement = iter.Get()->GetKey();
|
||||
|
||||
for (SVGAnimationElement* animElement : mAnimationElementTable.Keys()) {
|
||||
SMILTargetIdentifier key;
|
||||
if (!GetTargetIdentifierForAnimation(animElement, key)) {
|
||||
// Something's wrong/missing about animation's target; skip this animation
|
||||
|
||||
@@ -2085,7 +2085,7 @@ void SMILTimedElement::NotifyNewInterval() {
|
||||
container->SyncPauseTime();
|
||||
}
|
||||
|
||||
for (auto iter = mTimeDependents.Iter(); !iter.Done(); iter.Next()) {
|
||||
for (SMILTimeValueSpec* spec : mTimeDependents.Keys()) {
|
||||
SMILInterval* interval = mCurrentInterval.get();
|
||||
// It's possible that in notifying one new time dependent of a new interval
|
||||
// that a chain reaction is triggered which results in the original
|
||||
@@ -2094,7 +2094,6 @@ void SMILTimedElement::NotifyNewInterval() {
|
||||
if (!interval) {
|
||||
break;
|
||||
}
|
||||
SMILTimeValueSpec* spec = iter.Get()->GetKey();
|
||||
spec->HandleNewInterval(*interval, container);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,9 +306,7 @@ void LocalStorageCache::GetKeys(const LocalStorage* aStorage,
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto iter = DataSet(aStorage).mKeys.Iter(); !iter.Done(); iter.Next()) {
|
||||
aKeys.AppendElement(iter.Key());
|
||||
}
|
||||
AppendToArray(aKeys, DataSet(aStorage).mKeys.Keys());
|
||||
}
|
||||
|
||||
nsresult LocalStorageCache::GetItem(const LocalStorage* aStorage,
|
||||
|
||||
@@ -133,10 +133,7 @@ void SessionStorageCache::GetItem(DataSetType aDataSetType,
|
||||
|
||||
void SessionStorageCache::GetKeys(DataSetType aDataSetType,
|
||||
nsTArray<nsString>& aKeys) {
|
||||
for (auto iter = Set(aDataSetType)->mKeys.ConstIter(); !iter.Done();
|
||||
iter.Next()) {
|
||||
aKeys.AppendElement(iter.Key());
|
||||
}
|
||||
AppendToArray(aKeys, Set(aDataSetType)->mKeys.Keys());
|
||||
}
|
||||
|
||||
nsresult SessionStorageCache::SetItem(DataSetType aDataSetType,
|
||||
|
||||
@@ -1824,16 +1824,16 @@ void nsWebBrowserPersist::Cleanup() {
|
||||
MutexAutoLock lock(mOutputMapMutex);
|
||||
mOutputMap.SwapElements(outputMapCopy);
|
||||
}
|
||||
for (auto iter = outputMapCopy.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(iter.Key());
|
||||
for (const auto& key : outputMapCopy.Keys()) {
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(key);
|
||||
if (channel) {
|
||||
channel->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
}
|
||||
outputMapCopy.Clear();
|
||||
|
||||
for (auto iter = mUploadList.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(iter.Key());
|
||||
for (const auto& key : mUploadList.Keys()) {
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(key);
|
||||
if (channel) {
|
||||
channel->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
@@ -2379,8 +2379,7 @@ nsresult nsWebBrowserPersist::FixRedirectedChannelEntry(
|
||||
nsCOMPtr<nsIURI> originalURI;
|
||||
aNewChannel->GetOriginalURI(getter_AddRefs(originalURI));
|
||||
nsISupports* matchingKey = nullptr;
|
||||
for (auto iter = mOutputMap.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
nsISupports* key = iter.Key();
|
||||
for (nsISupports* key : mOutputMap.Keys()) {
|
||||
nsCOMPtr<nsIChannel> thisChannel = do_QueryInterface(key);
|
||||
nsCOMPtr<nsIURI> thisURI;
|
||||
|
||||
|
||||
@@ -216,8 +216,8 @@ NS_IMETHODIMP mozHunspell::SetPersonalDictionary(
|
||||
NS_IMETHODIMP mozHunspell::GetDictionaryList(
|
||||
nsTArray<nsCString>& aDictionaries) {
|
||||
MOZ_ASSERT(aDictionaries.IsEmpty());
|
||||
for (auto iter = mDictionaries.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
aDictionaries.AppendElement(NS_ConvertUTF16toUTF8(iter.Key()));
|
||||
for (const auto& key : mDictionaries.Keys()) {
|
||||
aDictionaries.AppendElement(NS_ConvertUTF16toUTF8(key));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -2156,10 +2156,9 @@ Maybe<nsTArray<ScrollPositionUpdate>> LayerManager::GetPendingScrollInfoUpdate(
|
||||
|
||||
std::unordered_set<ScrollableLayerGuid::ViewID>
|
||||
LayerManager::ClearPendingScrollInfoUpdate() {
|
||||
std::unordered_set<ScrollableLayerGuid::ViewID> scrollIds;
|
||||
for (auto it = mPendingScrollUpdates.Iter(); !it.Done(); it.Next()) {
|
||||
scrollIds.insert(it.Key());
|
||||
}
|
||||
std::unordered_set<ScrollableLayerGuid::ViewID> scrollIds(
|
||||
mPendingScrollUpdates.Keys().cbegin(),
|
||||
mPendingScrollUpdates.Keys().cend());
|
||||
mPendingScrollUpdates.Clear();
|
||||
return scrollIds;
|
||||
}
|
||||
|
||||
@@ -26,11 +26,11 @@ StaticAutoPtr<SharedSurfacesParent> SharedSurfacesParent::sInstance;
|
||||
SharedSurfacesParent::SharedSurfacesParent() = default;
|
||||
|
||||
SharedSurfacesParent::~SharedSurfacesParent() {
|
||||
for (auto i = mSurfaces.Iter(); !i.Done(); i.Next()) {
|
||||
for (const auto& key : mSurfaces.Keys()) {
|
||||
// There may be lingering consumers of the surfaces that didn't get shutdown
|
||||
// yet but since we are here, we know the render thread is finished and we
|
||||
// can unregister everything.
|
||||
wr::RenderThread::Get()->UnregisterExternalImageDuringShutdown(i.Key());
|
||||
wr::RenderThread::Get()->UnregisterExternalImageDuringShutdown(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -295,9 +295,8 @@ bool WebRenderLayerManager::EndEmptyTransaction(EndTransactionFlags aFlags) {
|
||||
transactionData->mLargeShmems);
|
||||
}
|
||||
transactionData->mScrollUpdates = std::move(mPendingScrollUpdates);
|
||||
for (auto it = transactionData->mScrollUpdates.Iter(); !it.Done();
|
||||
it.Next()) {
|
||||
nsLayoutUtils::NotifyPaintSkipTransaction(/*scroll id=*/it.Key());
|
||||
for (const auto& scrollId : transactionData->mScrollUpdates.Keys()) {
|
||||
nsLayoutUtils::NotifyPaintSkipTransaction(/*scroll id=*/scrollId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -844,11 +844,7 @@ void FontList::SetLocalNames(
|
||||
if (header.mLocalFaceCount > 0) {
|
||||
return; // already been done!
|
||||
}
|
||||
nsTArray<nsCString> faceArray;
|
||||
faceArray.SetCapacity(aLocalNameTable.Count());
|
||||
for (auto i = aLocalNameTable.ConstIter(); !i.Done(); i.Next()) {
|
||||
faceArray.AppendElement(i.Key());
|
||||
}
|
||||
auto faceArray = ToTArray<nsTArray<nsCString>>(aLocalNameTable.Keys());
|
||||
faceArray.Sort();
|
||||
size_t count = faceArray.Length();
|
||||
Family* families = Families();
|
||||
|
||||
@@ -418,8 +418,8 @@ void RealmPrivate::UnregisterStackFrame(JSStackFrameBase* aFrame) {
|
||||
}
|
||||
|
||||
void RealmPrivate::NukeJSStackFrames() {
|
||||
for (auto iter = mJSStackFrames.Iter(); !iter.Done(); iter.Next()) {
|
||||
iter.Get()->GetKey()->Clear();
|
||||
for (const auto& key : mJSStackFrames.Keys()) {
|
||||
key->Clear();
|
||||
}
|
||||
|
||||
mJSStackFrames.Clear();
|
||||
|
||||
@@ -3131,11 +3131,11 @@ void RestyleManager::ProcessAllPendingAttributeAndStateInvalidations() {
|
||||
if (mSnapshots.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (auto iter = mSnapshots.Iter(); !iter.Done(); iter.Next()) {
|
||||
for (const auto& key : mSnapshots.Keys()) {
|
||||
// Servo data for the element might have been dropped. (e.g. by removing
|
||||
// from its document)
|
||||
if (iter.Key()->HasFlag(ELEMENT_HAS_SNAPSHOT)) {
|
||||
Servo_ProcessInvalidations(StyleSet()->RawSet(), iter.Key(), &mSnapshots);
|
||||
if (key->HasFlag(ELEMENT_HAS_SNAPSHOT)) {
|
||||
Servo_ProcessInvalidations(StyleSet()->RawSet(), key, &mSnapshots);
|
||||
}
|
||||
}
|
||||
ClearSnapshots();
|
||||
|
||||
@@ -53,10 +53,7 @@ nsLayoutHistoryState::GetKeys(nsTArray<nsCString>& aKeys) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aKeys.SetCapacity(mStates.Count());
|
||||
for (auto iter = mStates.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
aKeys.AppendElement(iter.Key());
|
||||
}
|
||||
AppendToArray(aKeys, mStates.Keys());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ void FontFaceSet::Disconnect() {
|
||||
mDocument->CSSLoader()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
for (auto it = mLoaders.Iter(); !it.Done(); it.Next()) {
|
||||
it.Get()->GetKey()->Cancel();
|
||||
for (const auto& key : mLoaders.Keys()) {
|
||||
key->Cancel();
|
||||
}
|
||||
|
||||
mLoaders.Clear();
|
||||
|
||||
@@ -1339,8 +1339,8 @@ nsresult KeyedHistogram::GetKeys(const StaticMutexAutoLock& aLock,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
for (auto iter = histogramMap->ConstIter(); !iter.Done(); iter.Next()) {
|
||||
if (!aKeys.AppendElement(iter.Key(), mozilla::fallible)) {
|
||||
for (const auto& key : histogramMap->Keys()) {
|
||||
if (!aKeys.AppendElement(key, mozilla::fallible)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ nsresult VariableLengthPrefixSet::SetPrefixes(PrefixStringMap& aPrefixMap) {
|
||||
auto scopeExit = MakeScopeExit([&]() { aPrefixMap.Clear(); });
|
||||
|
||||
// Prefix size should not less than 4-bytes or greater than 32-bytes
|
||||
for (auto iter = aPrefixMap.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
if (iter.Key() < PREFIX_SIZE_FIXED || iter.Key() > COMPLETE_SIZE) {
|
||||
for (const auto& key : aPrefixMap.Keys()) {
|
||||
if (key < PREFIX_SIZE_FIXED || key > COMPLETE_SIZE) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,8 +411,8 @@ struct ParamTraits<mozilla::ModulePaths> {
|
||||
// NB: This function must write out the set in the same format as WriteVector
|
||||
static void WriteSet(Message* aMsg, const paramType::SetType& aSet) {
|
||||
aMsg->WriteUInt32(aSet.Count());
|
||||
for (auto iter = aSet.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
WriteParam(aMsg, iter.Get()->GetKey());
|
||||
for (const auto& key : aSet.Keys()) {
|
||||
WriteParam(aMsg, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -168,8 +168,8 @@ nsresult nsINIParser::GetString(const char* aSection, const char* aKey,
|
||||
}
|
||||
|
||||
nsresult nsINIParser::GetSections(INISectionCallback aCB, void* aClosure) {
|
||||
for (auto iter = mSections.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
if (!aCB(iter.Key(), aClosure)) {
|
||||
for (const auto& key : mSections.Keys()) {
|
||||
if (!aCB(key, aClosure)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1599,11 +1599,7 @@ nsComponentManagerImpl::IsContractIDRegistered(const char* aClass,
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::GetContractIDs(nsTArray<nsCString>& aResult) {
|
||||
aResult.Clear();
|
||||
|
||||
for (auto iter = mContractIDs.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
aResult.AppendElement(iter.Key());
|
||||
}
|
||||
aResult = ToTArray<nsTArray<nsCString>>(mContractIDs.Keys());
|
||||
|
||||
for (const auto& entry : gContractEntries) {
|
||||
if (!entry.Invalid()) {
|
||||
@@ -1659,10 +1655,10 @@ size_t nsComponentManagerImpl::SizeOfIncludingThis(
|
||||
}
|
||||
|
||||
n += mContractIDs.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (auto iter = mContractIDs.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
for (const auto& key : mContractIDs.Keys()) {
|
||||
// We don't measure the nsFactoryEntry data because it's owned by
|
||||
// mFactories (which is measured above).
|
||||
n += iter.Key().SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
n += key.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
n += sExtraStaticModules->ShallowSizeOfIncludingThis(aMallocSizeOf);
|
||||
|
||||
@@ -53,12 +53,7 @@ nsProperties::Has(const char* prop, bool* result) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsProperties::GetKeys(nsTArray<nsCString>& aKeys) {
|
||||
uint32_t count = Count();
|
||||
aKeys.SetCapacity(count);
|
||||
|
||||
for (auto iter = this->Iter(); !iter.Done(); iter.Next()) {
|
||||
aKeys.AppendElement(iter.Key());
|
||||
}
|
||||
AppendToArray(aKeys, this->Keys());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ SharedThreadPoolShutdownObserver::Observe(nsISupports* aSubject,
|
||||
#ifdef EARLY_BETA_OR_EARLIER
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(*sMonitor);
|
||||
if (!sPools->Iter().Done()) {
|
||||
if (!sPools->IsEmpty()) {
|
||||
nsAutoCString str;
|
||||
for (auto i = sPools->Iter(); !i.Done(); i.Next()) {
|
||||
str.AppendPrintf("\"%s\" ", nsAutoCString(i.Key()).get());
|
||||
for (const auto& key : sPools->Keys()) {
|
||||
str.AppendPrintf("\"%s\" ", nsAutoCString(key).get());
|
||||
}
|
||||
printf_stderr(
|
||||
"SharedThreadPool in xpcom-shutdown-threads. Waiting for "
|
||||
|
||||
Reference in New Issue
Block a user