Bug 1606187 - Part 2b: Update users of nsClassHashtable to handle UniquePtr differences r=KrisWright,froydnj

Differential Revision: https://phabricator.services.mozilla.com/D59042

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eric Rahm 2020-01-13 19:18:56 +00:00
Родитель 5ff63a5642
Коммит 78ee6675cf
53 изменённых файлов: 124 добавлений и 147 удалений

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

@ -314,7 +314,7 @@ CustomElementRegistry::RunCustomElementCreationCallback::Run() {
MOZ_ASSERT(!mRegistry->mElementCreationCallbacks.GetWeak(mAtom),
"Callback should be removed.");
nsAutoPtr<nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>> elements;
mozilla::UniquePtr<nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>> elements;
mRegistry->mElementCreationCallbacksUpgradeCandidatesMap.Remove(mAtom,
&elements);
MOZ_ASSERT(elements, "There should be a list");
@ -601,7 +601,7 @@ void CustomElementRegistry::UpgradeCandidates(
return;
}
nsAutoPtr<nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>> candidates;
mozilla::UniquePtr<nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>> candidates;
if (mCandidatesMap.Remove(aKey, &candidates)) {
MOZ_ASSERT(candidates);
CustomElementReactionsStack* reactionsStack =

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

@ -616,7 +616,7 @@ nsRadioGroupStruct* DocumentOrShadowRoot::GetRadioGroup(
nsRadioGroupStruct* DocumentOrShadowRoot::GetOrCreateRadioGroup(
const nsAString& aName) {
return mRadioGroups.LookupForAdd(aName).OrInsert(
[]() { return new nsRadioGroupStruct(); });
[]() { return new nsRadioGroupStruct(); }).get();
}
void DocumentOrShadowRoot::Traverse(DocumentOrShadowRoot* tmp,

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

@ -288,7 +288,7 @@ void nsMutationReceiver::ContentRemoved(nsIContent* aChild,
if (Observer()->GetReceiverFor(aChild, false, false) != orig) {
bool transientExists = false;
bool isNewEntry = false;
nsCOMArray<nsMutationReceiver>* transientReceivers =
const auto& transientReceivers =
Observer()->mTransientReceivers.LookupForAdd(aChild).OrInsert(
[&isNewEntry]() {
isNewEntry = true;
@ -995,7 +995,7 @@ void nsAutoMutationBatch::Done() {
}
if (allObservers.Length()) {
nsCOMArray<nsMutationReceiver>* transientReceivers =
const auto& transientReceivers =
ob->mTransientReceivers.LookupForAdd(removed).OrInsert(
[]() { return new nsCOMArray<nsMutationReceiver>(); });
for (uint32_t k = 0; k < allObservers.Length(); ++k) {

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

@ -59,7 +59,7 @@ void BroadcastChannelService::RegisterActor(
AssertIsOnBackgroundThread();
MOZ_ASSERT(aParent);
nsTArray<BroadcastChannelParent*>* parents =
const auto& parents =
mAgents.LookupForAdd(aOriginChannelKey).OrInsert([]() {
return new nsTArray<BroadcastChannelParent*>();
});

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

@ -79,7 +79,7 @@ nsCommandManager::AddCommandObserver(nsIObserver* aCommandObserver,
// XXX todo: handle special cases of aCommandToObserve being null, or empty
// for each command in the table, we make a list of observers for that command
ObserverList* commandObservers =
const auto& commandObservers =
mObserversTable.LookupForAdd(aCommandToObserve).OrInsert([]() {
return new ObserverList;
});

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

@ -5181,7 +5181,7 @@ class ConnectionPool::ThreadInfo {
};
struct ConnectionPool::DatabaseInfo final {
friend class nsAutoPtr<DatabaseInfo>;
friend class mozilla::DefaultDelete<DatabaseInfo>;
RefPtr<ConnectionPool> mConnectionPool;
const nsCString mDatabaseId;
@ -5372,7 +5372,7 @@ class ConnectionPool::ThreadRunnable final : public Runnable {
};
class ConnectionPool::TransactionInfo final {
friend class nsAutoPtr<TransactionInfo>;
friend class mozilla::DefaultDelete<TransactionInfo>;
nsTHashtable<nsPtrHashKey<TransactionInfo>> mBlocking;
nsTArray<TransactionInfo*> mBlockingOrdered;
@ -5412,7 +5412,7 @@ class ConnectionPool::TransactionInfo final {
};
struct ConnectionPool::TransactionInfoPair final {
friend class nsAutoPtr<TransactionInfoPair>;
friend class mozilla::DefaultDelete<TransactionInfoPair>;
// Multiple reading transactions can block future writes.
nsTArray<TransactionInfo*> mLastBlockingWrites;
@ -8282,7 +8282,7 @@ class GetFileReferencesHelper final : public Runnable {
******************************************************************************/
struct DatabaseActorInfo final {
friend class nsAutoPtr<DatabaseActorInfo>;
friend class mozilla::DefaultDelete<DatabaseActorInfo>;
RefPtr<FullDatabaseMetadata> mMetadata;
nsTArray<CheckedUnsafePtr<Database>> mLiveDatabases;
@ -10986,7 +10986,7 @@ nsresult DatabaseConnection::UpdateRefcountFunction::WillCommit() {
DatabaseUpdateFunction function(this);
for (const auto& entry : mFileInfoEntries) {
FileInfoEntry* value = entry.GetData();
const auto& value = entry.GetData();
MOZ_ASSERT(value);
if (value->mDelta && !function.Update(entry.GetKey(), value->mDelta)) {
@ -11015,7 +11015,7 @@ void DatabaseConnection::UpdateRefcountFunction::DidCommit() {
DOM);
for (const auto& entry : mFileInfoEntries) {
FileInfoEntry* value = entry.GetData();
const auto& value = entry.GetData();
MOZ_ASSERT(value);
@ -11152,7 +11152,7 @@ void DatabaseConnection::UpdateRefcountFunction::Reset() {
// done asynchronously and with a delay. We want to remove them (and decrease
// quota usage) before we fire the commit event.
for (const auto& entry : mFileInfoEntries) {
FileInfoEntry* const value = entry.GetData();
const auto& value = entry.GetData();
MOZ_ASSERT(value);
FileInfo* const fileInfo = value->mFileInfo.forget().take();

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

@ -713,7 +713,7 @@ void IndexedDatabaseManager::InvalidateAllFileManagers() {
AssertIsOnIOThread();
for (auto iter = mFileManagerInfos.ConstIter(); !iter.Done(); iter.Next()) {
auto value = iter.Data();
auto value = iter.UserData();
MOZ_ASSERT(value);
value->InvalidateAllFileManagers();

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

@ -3552,7 +3552,7 @@ mozilla::ipc::IPCResult ContentChild::RecvDeactivate(PBrowserChild* aTab) {
mozilla::ipc::IPCResult ContentChild::RecvProvideAnonymousTemporaryFile(
const uint64_t& aID, const FileDescOrError& aFDOrError) {
nsAutoPtr<AnonymousTemporaryFileCallback> callback;
mozilla::UniquePtr<AnonymousTemporaryFileCallback> callback;
mPendingAnonymousTemporaryFiles.Remove(aID, &callback);
MOZ_ASSERT(callback);

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

@ -1630,7 +1630,7 @@ void ContentParent::RemoveFromList() {
}
} else if (sBrowserContentParents) {
if (auto entry = sBrowserContentParents->Lookup(mRemoteType)) {
nsTArray<ContentParent*>* contentParents = entry.Data();
const auto& contentParents = entry.Data();
contentParents->RemoveElement(this);
if (contentParents->IsEmpty()) {
entry.Remove();

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

@ -3352,7 +3352,7 @@ bool RecvPBackgroundLSDatabaseConstructor(PBackgroundLSDatabaseParent* aActor,
// registered as a subprotocol).
// ActorDestroy will be called if we fail here.
nsAutoPtr<PreparedDatastore> preparedDatastore;
mozilla::UniquePtr<PreparedDatastore> preparedDatastore;
gPreparedDatastores->Remove(aDatastoreId, &preparedDatastore);
MOZ_ASSERT(preparedDatastore);
@ -3651,7 +3651,7 @@ void DatastoreWriteOptimizer::ApplyAndReset(
LSItemInfo& item = aOrderedItems[index];
if (auto entry = mWriteInfos.Lookup(item.key())) {
WriteInfo* writeInfo = entry.Data();
WriteInfo* writeInfo = entry.Data().get();
switch (writeInfo->GetType()) {
case WriteInfo::DeleteItem:
@ -3666,7 +3666,7 @@ void DatastoreWriteOptimizer::ApplyAndReset(
// about the UpdateWithMove flag.
aOrderedItems.RemoveElementAt(index);
entry.Data() = new InsertItemInfo(updateItemInfo->SerialNumber(),
entry.Data() = MakeUnique<InsertItemInfo>(updateItemInfo->SerialNumber(),
updateItemInfo->GetKey(),
updateItemInfo->GetValue());
} else {
@ -3724,7 +3724,7 @@ nsresult ConnectionWriteOptimizer::Perform(Connection* aConnection,
}
for (auto iter = mWriteInfos.ConstIter(); !iter.Done(); iter.Next()) {
WriteInfo* writeInfo = iter.Data();
WriteInfo* writeInfo = iter.Data().get();
switch (writeInfo->GetType()) {
case WriteInfo::InsertItem:
@ -5597,11 +5597,8 @@ void Datastore::NotifySnapshots(Database* aDatabase, const nsAString& aKey,
void PreparedDatastore::Destroy() {
AssertIsOnBackgroundThread();
MOZ_ASSERT(gPreparedDatastores);
MOZ_ASSERT(gPreparedDatastores->Get(mDatastoreId));
nsAutoPtr<PreparedDatastore> preparedDatastore;
gPreparedDatastores->Remove(mDatastoreId, &preparedDatastore);
MOZ_ASSERT(preparedDatastore);
DebugOnly<bool> removed = gPreparedDatastores->Remove(mDatastoreId);
MOZ_ASSERT(removed);
}
// static
@ -7927,11 +7924,8 @@ void PrepareDatastoreOp::Cleanup() {
// destroy prepared datastore, otherwise it won't be destroyed until the
// timer fires (after 20 seconds).
MOZ_ASSERT(gPreparedDatastores);
MOZ_ASSERT(gPreparedDatastores->Get(mDatastoreId));
nsAutoPtr<PreparedDatastore> preparedDatastore;
gPreparedDatastores->Remove(mDatastoreId, &preparedDatastore);
MOZ_ASSERT(preparedDatastore);
DebugOnly<bool> removed = gPreparedDatastores->Remove(mDatastoreId);
MOZ_ASSERT(removed);
}
// Make sure to release the datastore on this thread.
@ -8612,7 +8606,7 @@ bool ArchivedOriginScope::HasMatches(
bool operator()(const Prefix& aPrefix) {
for (auto iter = mHashtable->ConstIter(); !iter.Done(); iter.Next()) {
ArchivedOriginInfo* archivedOriginInfo = iter.Data();
const auto& archivedOriginInfo = iter.Data();
if (archivedOriginInfo->mOriginNoSuffix == aPrefix.OriginNoSuffix()) {
return true;
@ -8624,7 +8618,7 @@ bool ArchivedOriginScope::HasMatches(
bool operator()(const Pattern& aPattern) {
for (auto iter = mHashtable->ConstIter(); !iter.Done(); iter.Next()) {
ArchivedOriginInfo* archivedOriginInfo = iter.Data();
const auto& archivedOriginInfo = iter.Data();
if (aPattern.GetPattern().Matches(
archivedOriginInfo->mOriginAttributes)) {
@ -8661,7 +8655,7 @@ void ArchivedOriginScope::RemoveMatches(
void operator()(const Prefix& aPrefix) {
for (auto iter = mHashtable->Iter(); !iter.Done(); iter.Next()) {
ArchivedOriginInfo* archivedOriginInfo = iter.Data();
const auto& archivedOriginInfo = iter.Data();
if (archivedOriginInfo->mOriginNoSuffix == aPrefix.OriginNoSuffix()) {
iter.Remove();
@ -8671,7 +8665,7 @@ void ArchivedOriginScope::RemoveMatches(
void operator()(const Pattern& aPattern) {
for (auto iter = mHashtable->Iter(); !iter.Done(); iter.Next()) {
ArchivedOriginInfo* archivedOriginInfo = iter.Data();
const auto& archivedOriginInfo = iter.Data();
if (aPattern.GetPattern().Matches(
archivedOriginInfo->mOriginAttributes)) {
@ -9213,7 +9207,7 @@ void QuotaClient::AbortOperations(const nsACString& aOrigin) {
if (gPreparedDatastores) {
for (auto iter = gPreparedDatastores->ConstIter(); !iter.Done();
iter.Next()) {
PreparedDatastore* preparedDatastore = iter.Data();
const auto& preparedDatastore = iter.Data();
MOZ_ASSERT(preparedDatastore);
if (aOrigin.IsVoid() || preparedDatastore->Origin() == aOrigin) {

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

@ -59,7 +59,7 @@ void LSWriteOptimizerBase::GetSortedWriteInfos(
}
for (auto iter = mWriteInfos.ConstIter(); !iter.Done(); iter.Next()) {
WriteInfo* writeInfo = iter.Data();
WriteInfo* writeInfo = iter.UserData();
aWriteInfos.InsertElementSorted(writeInfo, WriteInfoComparator());
}

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

@ -152,7 +152,7 @@ GeckoMediaPluginService::RunPluginCrashCallbacks(
MOZ_ASSERT(NS_IsMainThread());
GMP_LOG_DEBUG("%s::%s(%i)", __CLASS__, __FUNCTION__, aPluginId);
nsAutoPtr<nsTArray<RefPtr<GMPCrashHelper>>> helpers;
mozilla::UniquePtr<nsTArray<RefPtr<GMPCrashHelper>>> helpers;
{
MutexAutoLock lock(mMutex);
mPluginCrashHelpers.Remove(aPluginId, &helpers);
@ -431,7 +431,7 @@ void GeckoMediaPluginService::DisconnectCrashHelper(GMPCrashHelper* aHelper) {
}
MutexAutoLock lock(mMutex);
for (auto iter = mPluginCrashHelpers.Iter(); !iter.Done(); iter.Next()) {
nsTArray<RefPtr<GMPCrashHelper>>* helpers = iter.Data();
nsTArray<RefPtr<GMPCrashHelper>>* helpers = iter.UserData();
if (!helpers->Contains(aHelper)) {
continue;
}

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

@ -18,7 +18,6 @@
#include "mozilla/StaticPrefs_media.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
#include "nsServiceManagerUtils.h"
#include "DecryptThroughputLimit.h"
@ -156,7 +155,7 @@ class EMEDecryptor : public MediaDataDecoder,
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
MOZ_ASSERT(aDecrypted.mSample);
nsAutoPtr<DecryptPromiseRequestHolder> holder;
UniquePtr<DecryptPromiseRequestHolder> holder;
mDecrypts.Remove(aDecrypted.mSample, &holder);
if (holder) {
holder->Complete();
@ -220,7 +219,7 @@ class EMEDecryptor : public MediaDataDecoder,
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mThroughputLimiter.Flush();
for (auto iter = mDecrypts.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<DecryptPromiseRequestHolder>& holder = iter.Data();
auto holder = iter.UserData();
holder->DisconnectIfExists();
iter.Remove();
}
@ -239,7 +238,7 @@ class EMEDecryptor : public MediaDataDecoder,
MOZ_ASSERT(mDecodePromise.IsEmpty() && !mDecodeRequest.Exists(),
"Must wait for decoding to complete");
for (auto iter = mDecrypts.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<DecryptPromiseRequestHolder>& holder = iter.Data();
auto holder = iter.UserData();
holder->DisconnectIfExists();
iter.Remove();
}

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

@ -12,7 +12,6 @@
#include "MediaUtils.h"
#include "MediaEngine.h"
#include "VideoUtils.h"
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
@ -86,7 +85,7 @@ class OriginKeyStore : public nsISupports {
// Avoid int64_t* <-> void* casting offset
OriginKey since(nsCString(), aSinceWhen / PR_USEC_PER_SEC);
for (auto iter = mKeys.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<OriginKey>& originKey = iter.Data();
auto originKey = iter.UserData();
LOG((((originKey->mSecondsStamp >= since.mSecondsStamp)
? "%s: REMOVE %" PRId64 " >= %" PRId64
: "%s: KEEP %" PRId64 " < %" PRId64),

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

@ -17,7 +17,6 @@
#include "PluginModuleParent.h"
#include "StreamNotifyParent.h"
#include "npfunctions.h"
#include "nsAutoPtr.h"
#include "gfxASurface.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
@ -2105,10 +2104,10 @@ void PluginInstanceParent::UnsubclassPluginWindow() {
if (XRE_IsContentProcess()) {
if (mPluginHWND) {
// Remove 'this' from the plugin list safely
nsAutoPtr<PluginInstanceParent> tmp;
mozilla::UniquePtr<PluginInstanceParent> tmp;
MOZ_ASSERT(sPluginInstanceList);
sPluginInstanceList->Remove((void*)mPluginHWND, &tmp);
tmp.forget();
mozilla::Unused << tmp.release();
if (!sPluginInstanceList->Count()) {
delete sPluginInstanceList;
sPluginInstanceList = nullptr;

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

@ -4192,7 +4192,7 @@ void QuotaManager::RemoveQuota() {
MutexAutoLock lock(mQuotaMutex);
for (auto iter = mGroupInfoPairs.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<GroupInfoPair>& pair = iter.Data();
auto pair = iter.UserData();
MOZ_ASSERT(!iter.Key().IsEmpty(), "Empty key!");
MOZ_ASSERT(pair, "Null pointer!");

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

@ -1698,7 +1698,7 @@ void ServiceWorkerManager::AddScopeAndRegistration(
MOZ_ASSERT(!scopeKey.IsEmpty());
RegistrationDataPerPrincipal* data =
const auto& data =
swm->mRegistrationInfos.LookupForAdd(scopeKey).OrInsert(
[]() { return new RegistrationDataPerPrincipal(); });

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

@ -350,7 +350,7 @@ void LocalStorageManager::ClearCaches(uint32_t aUnloadFlags,
continue;
}
CacheOriginHashtable* table = iter1.Data();
CacheOriginHashtable* table = iter1.UserData();
for (auto iter2 = table->Iter(); !iter2.Done(); iter2.Next()) {
LocalStorageCache* cache = iter2.Get()->cache();

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

@ -265,7 +265,7 @@ void SessionStorageManager::ClearStorages(
continue;
}
OriginKeyHashTable* table = iter1.Data();
OriginKeyHashTable* table = iter1.UserData();
for (auto iter2 = table->Iter(); !iter2.Done(); iter2.Next()) {
if (aOriginScope.IsEmpty() ||
StringBeginsWith(iter2.Key(), aOriginScope)) {

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

@ -1292,7 +1292,7 @@ void StorageDBThread::PendingOperations::Add(
// logic, if we would not delete the update tasks, changes would have been
// stored to the database after clear operations have been executed.
for (auto iter = mUpdates.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<DBOperation>& pendingTask = iter.Data();
const auto& pendingTask = iter.Data();
if (aOperation->Type() == DBOperation::opClear &&
(pendingTask->OriginNoSuffix() != aOperation->OriginNoSuffix() ||
@ -1341,12 +1341,12 @@ bool StorageDBThread::PendingOperations::Prepare() {
// all scope-related update operations we have here now were
// scheduled after the clear operations.
for (auto iter = mClears.Iter(); !iter.Done(); iter.Next()) {
mExecList.AppendElement(iter.Data().forget());
mExecList.AppendElement(iter.Data().release());
}
mClears.Clear();
for (auto iter = mUpdates.Iter(); !iter.Done(); iter.Next()) {
mExecList.AppendElement(iter.Data().forget());
mExecList.AppendElement(iter.Data().release());
}
mUpdates.Clear();

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

@ -11,7 +11,6 @@
#include "nsIFileStreams.h" // New Necko file streams
#include <algorithm>
#include "nsAutoPtr.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIClassOfService.h"
@ -2161,14 +2160,14 @@ nsresult nsWebBrowserPersist::FixRedirectedChannelEntry(
if (matchingKey) {
// If a match was found, remove the data entry with the old channel
// key and re-add it with the new channel key.
nsAutoPtr<OutputData> outputData;
mozilla::UniquePtr<OutputData> outputData;
mOutputMap.Remove(matchingKey, &outputData);
NS_ENSURE_TRUE(outputData, NS_ERROR_FAILURE);
// Store data again with new channel unless told to ignore redirects.
if (!(mPersistFlags & PERSIST_FLAGS_IGNORE_REDIRECTED_DATA)) {
nsCOMPtr<nsISupports> keyPtr = do_QueryInterface(aNewChannel);
mOutputMap.Put(keyPtr, outputData.forget());
mOutputMap.Put(keyPtr, outputData.release());
}
}

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

@ -6,7 +6,6 @@
#include "RuntimeService.h"
#include "nsAutoPtr.h"
#include "nsContentSecurityUtils.h"
#include "nsIContentSecurityPolicy.h"
#include "mozilla/dom/Document.h"
@ -1207,12 +1206,11 @@ bool RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) {
const nsCString& domain = aWorkerPrivate->Domain();
WorkerDomainInfo* domainInfo;
bool queued = false;
{
MutexAutoLock lock(mMutex);
domainInfo = mDomainMap.LookupForAdd(domain).OrInsert([&domain, parent]() {
const auto& domainInfo = mDomainMap.LookupForAdd(domain).OrInsert([&domain, parent]() {
NS_ASSERTION(!parent, "Shouldn't have a parent here!");
Unused << parent; // silence clang -Wunused-lambda-capture in opt builds
WorkerDomainInfo* wdi = new WorkerDomainInfo();
@ -1279,7 +1277,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) {
if (!isServiceWorker) {
// Service workers are excluded since their lifetime is separate from
// that of dom windows.
nsTArray<WorkerPrivate*>* windowArray =
const auto& windowArray =
mWindowMap.LookupForAdd(window).OrInsert(
[]() { return new nsTArray<WorkerPrivate*>(1); });
if (!windowArray->Contains(aWorkerPrivate)) {
@ -1376,8 +1374,8 @@ void RuntimeService::UnregisterWorker(WorkerPrivate* aWorkerPrivate) {
AssertIsOnMainThread();
for (auto iter = mWindowMap.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<nsTArray<WorkerPrivate*>>& workers = iter.Data();
MOZ_ASSERT(workers.get());
const auto& workers = iter.Data();
MOZ_ASSERT(workers);
if (workers->RemoveElement(aWorkerPrivate)) {
MOZ_ASSERT(!workers->Contains(aWorkerPrivate),

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

@ -35,7 +35,6 @@
#include "mozilla/mozalloc.h" // for operator new, etc
#include "mozilla/Telemetry.h"
#include "gfxConfig.h"
#include "nsAutoPtr.h"
#include "nsDebug.h" // for NS_WARNING
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
#include "nsTArray.h" // for nsTArray, nsTArray_Impl
@ -1094,7 +1093,7 @@ bool CompositorBridgeChild::DeallocPWebGPUChild(webgpu::PWebGPUChild* aActor) {
void CompositorBridgeChild::ClearSharedFrameMetricsData(LayersId aLayersId) {
for (auto iter = mFrameMetricsTable.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<SharedFrameMetricsData>& data = iter.Data();
auto data = iter.UserData();
if (data->GetLayersId() == aLayersId) {
iter.Remove();
}

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

@ -166,7 +166,7 @@ void AsyncImagePipelineManager::RemoveAsyncImagePipeline(
uint64_t id = wr::AsUint64(aPipelineId);
if (auto entry = mAsyncImagePipelines.Lookup(id)) {
AsyncImagePipeline* holder = entry.Data();
const auto& holder = entry.Data();
wr::Epoch epoch = GetNextImageEpoch();
aTxn.ClearDisplayList(epoch, aPipelineId);
for (wr::ImageKey key : holder->mKeys) {
@ -320,7 +320,7 @@ void AsyncImagePipelineManager::ApplyAsyncImagesOfImageBridge(
// Update each of them if needed.
for (auto iter = mAsyncImagePipelines.Iter(); !iter.Done(); iter.Next()) {
wr::PipelineId pipelineId = wr::AsPipelineId(iter.Key());
AsyncImagePipeline* pipeline = iter.Data();
AsyncImagePipeline* pipeline = iter.UserData();
// If aync image pipeline does not use ImageBridge, do not need to apply.
if (!pipeline->mImageHost->GetAsyncRef()) {
continue;
@ -591,7 +591,7 @@ void AsyncImagePipelineManager::ProcessPipelineRendered(
const wr::PipelineId& aPipelineId, const wr::Epoch& aEpoch,
wr::RenderedFrameId aRenderedFrameId) {
if (auto entry = mPipelineTexturesHolders.Lookup(wr::AsUint64(aPipelineId))) {
PipelineTexturesHolder* holder = entry.Data();
const auto& holder = entry.Data();
// For TextureHosts that can be released on render submission, using aEpoch
// find the first that we can't release and then release all prior to that.
auto firstSubmittedHostToKeep = std::find_if(
@ -641,7 +641,7 @@ void AsyncImagePipelineManager::ProcessPipelineRemoved(
}
if (auto entry = mPipelineTexturesHolders.Lookup(
wr::AsUint64(aRemovedPipeline.pipeline_id))) {
PipelineTexturesHolder* holder = entry.Data();
const auto& holder = entry.Data();
if (holder->mDestroyedEpoch.isSome()) {
if (!holder->mTextureHostsUntilRenderCompleted.empty()) {
// Move all TextureHosts that must be held until render completed to

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

@ -8,7 +8,6 @@
#include "mozilla/HalWakeLock.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
@ -109,7 +108,7 @@ CleanupOnContentShutdown::Observe(nsISupports* aSubject, const char* aTopic,
props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"), &childID);
if (NS_SUCCEEDED(rv)) {
for (auto iter = sLockTable->Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<ProcessLockTable>& table = iter.Data();
auto table = iter.UserData();
if (table->Get(childID, nullptr)) {
table->Remove(childID);

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

@ -98,7 +98,7 @@ class HashElemIter {
if (done_) {
return nullptr;
}
return iter().Data();
return iter().UserData();
}
const ElemType get() const { return const_cast<Elem*>(this)->get(); }

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

@ -541,9 +541,9 @@ void mozJSComponentLoader::Shutdown() {
}
// This requires that the keys be strings and the values be pointers.
template <class Key, class Data, class UserData>
template <class Key, class Data, class UserData, class Converter>
static size_t SizeOfTableExcludingThis(
const nsBaseHashtable<Key, Data, UserData>& aTable,
const nsBaseHashtable<Key, Data, UserData, Converter>& aTable,
MallocSizeOf aMallocSizeOf) {
size_t n = aTable.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (auto iter = aTable.ConstIter(); !iter.Done(); iter.Next()) {

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

@ -10076,7 +10076,7 @@ void ReflowCountMgr::Add(const char* aName, nsIFrame* aFrame) {
NS_ASSERTION(aName != nullptr, "Name shouldn't be null!");
if (mDumpFrameCounts) {
ReflowCounter* counter = mCounts.LookupForAdd(aName).OrInsert(
const auto& counter = mCounts.LookupForAdd(aName).OrInsert(
[this]() { return new ReflowCounter(this); });
counter->Add();
}
@ -10085,7 +10085,7 @@ void ReflowCountMgr::Add(const char* aName, nsIFrame* aFrame) {
aFrame != nullptr) {
char key[KEY_BUF_SIZE_FOR_PTR];
SprintfLiteral(key, "%p", (void*)aFrame);
IndiReflowCounter* counter =
const auto& counter =
mIndiFrameCounts.LookupForAdd(key).OrInsert([&aName, &aFrame, this]() {
auto counter = new IndiReflowCounter(this);
counter->mFrame = aFrame;
@ -10093,7 +10093,7 @@ void ReflowCountMgr::Add(const char* aName, nsIFrame* aFrame) {
return counter;
});
// this eliminates extra counts from super classes
if (counter != nullptr && counter->mName.EqualsASCII(aName)) {
if (counter && counter->mName.EqualsASCII(aName)) {
counter->mCount++;
counter->mCounter.Add(1);
}
@ -10231,7 +10231,7 @@ void ReflowCountMgr::DoIndiTotalsTree() {
printf("-- Individual Counts of Frames not in Root Tree\n");
printf("------------------------------------------------\n");
for (auto iter = mIndiFrameCounts.Iter(); !iter.Done(); iter.Next()) {
IndiReflowCounter* counter = iter.Data();
IndiReflowCounter* counter = iter.UserData();
if (!counter->mHasBeenOutput) {
char* name = ToNewCString(counter->mName);
printf("%s - %p [%d][", name, (void*)counter->mFrame,

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

@ -281,7 +281,7 @@ nsCounterList* nsCounterManager::CounterListFor(nsAtom* aCounterName) {
MOZ_ASSERT(aCounterName);
return mNames.LookupForAdd(aCounterName).OrInsert([]() {
return new nsCounterList();
});
}).get();
}
void nsCounterManager::RecalcAll() {

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

@ -1333,7 +1333,7 @@ bool nsRefreshDriver::AddImageRequest(imgIRequest* aRequest) {
if (delay == 0) {
mRequests.PutEntry(aRequest);
} else {
ImageStartData* start = mStartTable.LookupForAdd(delay).OrInsert(
const auto& start = mStartTable.LookupForAdd(delay).OrInsert(
[]() { return new ImageStartData(); });
start->mEntries.PutEntry(aRequest);
}

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

@ -12,7 +12,6 @@
#include "mozilla/dom/Document.h"
#include "mozilla/dom/DocumentInlines.h"
#include "nsAutoPtr.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsError.h"
@ -101,7 +100,7 @@ void ImageLoader::AssociateRequestToFrame(imgIRequest* aRequest,
MOZ_ASSERT(observer == this);
FrameSet* frameSet =
const auto& frameSet =
mRequestToFrameMap.LookupForAdd(aRequest).OrInsert([=]() {
nsPresContext* presContext = GetPresContext();
if (presContext) {
@ -111,7 +110,7 @@ void ImageLoader::AssociateRequestToFrame(imgIRequest* aRequest,
return new FrameSet();
});
RequestSet* requestSet =
const auto& requestSet =
mFrameToRequestMap.LookupForAdd(aFrame).OrInsert([=]() {
aFrame->SetHasImageRequest(true);
return new RequestSet();
@ -272,7 +271,7 @@ void ImageLoader::DeregisterCSSImageFromAllLoaders(uint64_t aImageLoadID) {
MOZ_ASSERT(aImageLoadID != 0);
if (auto e = sImages->Lookup(aImageLoadID)) {
ImageTableEntry* tableEntry = e.Data();
const auto& tableEntry = e.Data();
if (imgRequestProxy* request = tableEntry->mCanonicalRequest) {
request->CancelAndForgetObserver(NS_BINDING_ABORTED);
}
@ -303,7 +302,7 @@ void ImageLoader::RemoveRequestToFrameMapping(imgIRequest* aRequest,
#endif
if (auto entry = mRequestToFrameMap.Lookup(aRequest)) {
FrameSet* frameSet = entry.Data();
const auto& frameSet = entry.Data();
MOZ_ASSERT(frameSet, "This should never be null");
// Before we remove aFrame from the frameSet, unblock onload if needed.
@ -333,7 +332,7 @@ void ImageLoader::RemoveRequestToFrameMapping(imgIRequest* aRequest,
void ImageLoader::RemoveFrameToRequestMapping(imgIRequest* aRequest,
nsIFrame* aFrame) {
if (auto entry = mFrameToRequestMap.Lookup(aFrame)) {
RequestSet* requestSet = entry.Data();
const auto& requestSet = entry.Data();
MOZ_ASSERT(requestSet, "This should never be null");
if (recordreplay::IsRecordingOrReplaying()) {
requestSet->RemoveElement(aRequest);
@ -360,7 +359,7 @@ void ImageLoader::DropRequestsForFrame(nsIFrame* aFrame) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aFrame->HasImageRequest(), "why call me?");
nsAutoPtr<RequestSet> requestSet;
UniquePtr<RequestSet> requestSet;
mFrameToRequestMap.Remove(aFrame, &requestSet);
aFrame->SetHasImageRequest(false);
if (MOZ_UNLIKELY(!requestSet)) {
@ -446,16 +445,12 @@ void ImageLoader::LoadImage(const StyleComputedImageUrl& aImage,
return;
}
ImageTableEntry* entry;
{
auto lookup = sImages->LookupForAdd(loadId);
if (lookup) {
// This url has already been loaded.
return;
}
entry = lookup.OrInsert([]() { return new ImageTableEntry(); });
auto lookup = sImages->LookupForAdd(loadId);
if (lookup) {
// This url has already been loaded.
return;
}
const auto& entry = lookup.OrInsert([]() { return new ImageTableEntry(); });
nsIURI* uri = aImage.GetURI();
if (!uri) {

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

@ -2730,10 +2730,10 @@ nsPrefBranch::RemoveObserverImpl(const nsACString& aDomain,
nsCString prefName;
GetPrefName(aDomain).get(prefName);
PrefCallback key(prefName, aObserver, this);
nsAutoPtr<PrefCallback> pCallback;
mozilla::UniquePtr<PrefCallback> pCallback;
mObservers.Remove(&key, &pCallback);
if (pCallback) {
rv = Preferences::UnregisterCallback(NotifyObserver, prefName, pCallback,
rv = Preferences::UnregisterCallback(NotifyObserver, prefName, pCallback.get(),
Preferences::PrefixMatch);
}
@ -2793,7 +2793,7 @@ void nsPrefBranch::FreeObserverList() {
// mFreeingObserverList to keep those calls from touching mObservers.
mFreeingObserverList = true;
for (auto iter = mObservers.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<PrefCallback>& callback = iter.Data();
auto callback = iter.UserData();
Preferences::UnregisterCallback(nsPrefBranch::NotifyObserver,
callback->GetDomain(), callback,
Preferences::PrefixMatch);
@ -3212,7 +3212,7 @@ PreferenceServiceReporter::CollectReports(
nsDataHashtable<nsCStringHashKey, uint32_t> prefCounter;
for (auto iter = rootBranch->mObservers.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<PrefCallback>& callback = iter.Data();
auto callback = iter.UserData();
if (callback->IsWeak()) {
nsCOMPtr<nsIObserver> callbackRef = do_QueryReferent(callback->mWeakRef);

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

@ -280,7 +280,7 @@ nsresult SSLTokensCache::RemoveLocked(const nsACString& aKey) {
LOG(("SSLTokensCache::RemoveLocked [key=%s]",
PromiseFlatCString(aKey).get()));
nsAutoPtr<TokenCacheRecord> rec;
UniquePtr<TokenCacheRecord> rec;
if (!mTokenCacheRecords.Remove(aKey, &rec)) {
LOG((" token not found"));
@ -289,7 +289,7 @@ nsresult SSLTokensCache::RemoveLocked(const nsACString& aKey) {
mCacheSize -= rec->Size();
if (!mExpirationArray.RemoveElement(rec)) {
if (!mExpirationArray.RemoveElement(rec.get())) {
MOZ_ASSERT(false, "token not found in mExpirationArray");
}

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

@ -2290,7 +2290,7 @@ void CacheFile::NotifyListenersAboutOutputRemoval() {
// First fail all chunk listeners that wait for non-existent chunk
for (auto iter = mChunkListeners.Iter(); !iter.Done(); iter.Next()) {
uint32_t idx = iter.Key();
nsAutoPtr<ChunkListeners>& listeners = iter.Data();
auto listeners = iter.UserData();
LOG(
("CacheFile::NotifyListenersAboutOutputRemoval() - fail "

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

@ -25,7 +25,6 @@
#include "nsIURI.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsAutoPtr.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsServiceManagerUtils.h"
@ -1903,7 +1902,7 @@ nsresult CacheStorageService::DoomStorageEntries(
// Since we store memory entries also in the disk entries table
// we need to remove the memory entries from the disk table one
// by one manually.
nsAutoPtr<CacheEntryTable> memoryEntries;
mozilla::UniquePtr<CacheEntryTable> memoryEntries;
sGlobalEntryTables->Remove(memoryStorageID, &memoryEntries);
CacheEntryTable* diskEntries;

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

@ -153,7 +153,7 @@ Http2Session::Http2Session(nsISocketTransport* aSocketTransport,
void Http2Session::Shutdown() {
for (auto iter = mStreamTransactionHash.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<Http2Stream>& stream = iter.Data();
auto stream = iter.UserData();
// On a clean server hangup the server sets the GoAwayID to be the ID of
// the last transaction it processed. If the ID of stream in the
@ -2312,7 +2312,7 @@ nsresult Http2Session::RecvGoAway(Http2Session* self) {
// Do that after the enumerator completes to avoid the risk of
// a restart event re-entrantly modifying this hash. Be sure not to restart
// a pushed (even numbered) stream
nsAutoPtr<Http2Stream>& stream = iter.Data();
auto stream = iter.UserData();
if ((stream->StreamID() > self->mGoAwayID && (stream->StreamID() & 1)) ||
!stream->HasRegisteredID()) {
self->mGoAwayStreamsToRestart.Push(stream);
@ -2449,7 +2449,7 @@ nsresult Http2Session::RecvWindowUpdate(Http2Session* self) {
iter.Next()) {
MOZ_ASSERT(self->mServerSessionWindow > 0);
nsAutoPtr<Http2Stream>& stream = iter.Data();
auto stream = iter.UserData();
if (!stream->BlockedOnRwin() || stream->ServerReceiveWindow() <= 0) {
continue;
}
@ -3279,7 +3279,7 @@ nsresult Http2Session::WriteSegmentsAgain(nsAHttpSegmentWriter* writer,
// Go through and re-start all of our transactions with h2 disabled.
for (auto iter = mStreamTransactionHash.Iter(); !iter.Done();
iter.Next()) {
nsAutoPtr<Http2Stream>& stream = iter.Data();
auto stream = iter.UserData();
stream->Transaction()->DisableSpdy();
CloseStream(stream, NS_ERROR_NET_RESET);
}

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

@ -283,7 +283,7 @@ nsPreflightCache::CacheEntry* nsPreflightCache::GetEntry(
// Try to kick out all the expired entries.
TimeStamp now = TimeStamp::NowLoRes();
for (auto iter = mTable.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<CacheEntry>& entry = iter.Data();
auto entry = iter.UserData();
entry->PurgeExpired(now);
if (entry->mHeaders.IsEmpty() && entry->mMethods.IsEmpty()) {

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

@ -148,7 +148,7 @@ class nsHttpAuthNode {
nsTArray<nsAutoPtr<nsHttpAuthEntry> > mList;
friend class nsHttpAuthCache;
friend class nsAutoPtr<nsHttpAuthNode>; // needs to call the destructor
friend class mozilla::DefaultDelete<nsHttpAuthNode>; // needs to call the destructor
};
//-----------------------------------------------------------------------------

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

@ -866,7 +866,7 @@ void NetlinkService::OnAddrMessage(struct nlmsghdr* aNlh) {
// Remove all neighbors associated with this address
for (auto iter = linkInfo->mNeighbors.Iter(); !iter.Done(); iter.Next()) {
NetlinkNeighbor* neigh = iter.Data();
NetlinkNeighbor* neigh = iter.UserData();
if (neigh->Family() == address->Family() &&
address->ContainsAddr(neigh->GetAddrPtr())) {
if (LOG_ENABLED()) {
@ -1362,7 +1362,7 @@ bool NetlinkService::CalculateIDForFamily(uint8_t aFamily, SHA1Sum* aSHA1) {
// Check only routes on links that are up
for (auto iter = mLinks.ConstIter(); !iter.Done(); iter.Next()) {
LinkInfo* linkInfo = iter.Data();
LinkInfo* linkInfo = iter.UserData();
nsAutoCString linkName;
linkInfo->mLink->GetName(linkName);
@ -1447,7 +1447,7 @@ bool NetlinkService::CalculateIDForFamily(uint8_t aFamily, SHA1Sum* aSHA1) {
// TODO: maybe we could get operator name via AndroidBridge
for (auto iter = mLinks.ConstIter(); !iter.Done(); iter.Next()) {
LinkInfo* linkInfo = iter.Data();
LinkInfo* linkInfo = iter.UserData();
if (linkInfo->mIsUp) {
nsAutoCString linkName;
linkInfo->mLink->GetName(linkName);

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

@ -9,6 +9,7 @@
#include <netinet/in.h>
#include <linux/netlink.h>
#include "nsAutoPtr.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsCOMPtr.h"

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

@ -11,6 +11,7 @@
#include "mozilla/Services.h"
#include "mozilla/UniquePtr.h"
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
#include "nsComponentManagerUtils.h"
#include "nsDataHashtable.h"

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

@ -1258,8 +1258,7 @@ nsresult TelemetryEvent::CreateSnapshots(uint32_t aDataset, bool aClear,
optional_argc,
aEventLimit](EventRecordsMapType& aProcessStorage) {
for (auto iter = aProcessStorage.Iter(); !iter.Done(); iter.Next()) {
const EventRecordArray* eventStorage =
static_cast<EventRecordArray*>(iter.Data());
const EventRecordArray* eventStorage = iter.UserData();
EventRecordArray events;
EventRecordArray leftoverEvents;
@ -1367,8 +1366,7 @@ size_t TelemetryEvent::SizeOfIncludingThis(
auto getSizeOfRecords = [aMallocSizeOf](auto& storageMap) {
size_t partial = storageMap.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (auto iter = storageMap.Iter(); !iter.Done(); iter.Next()) {
EventRecordArray* eventRecords =
static_cast<EventRecordArray*>(iter.Data());
EventRecordArray* eventRecords = iter.UserData();
partial += eventRecords->ShallowSizeOfIncludingThis(aMallocSizeOf);
const uint32_t len = eventRecords->Length();

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

@ -1398,7 +1398,7 @@ nsresult KeyedHistogram::GetSnapshot(const StaticMutexAutoLock& aLock,
// Snapshot every key.
for (auto iter = histogramMap->ConstIter(); !iter.Done(); iter.Next()) {
base::Histogram* keyData = iter.Data();
base::Histogram* keyData = iter.UserData();
if (!keyData) {
return NS_ERROR_FAILURE;
}

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

@ -1019,7 +1019,7 @@ void KeyedScalar::SetMaximum(const StaticMutexAutoLock& locker,
nsresult KeyedScalar::GetValue(const nsACString& aStoreName, bool aClearStorage,
nsTArray<KeyValuePair>& aValues) {
for (auto iter = mScalarKeys.ConstIter(); !iter.Done(); iter.Next()) {
ScalarBase* scalar = static_cast<ScalarBase*>(iter.Data());
ScalarBase* scalar = iter.UserData();
// Get the scalar value.
nsCOMPtr<nsIVariant> scalarValue;
@ -1138,7 +1138,7 @@ ScalarResult KeyedScalar::GetScalarForKey(const StaticMutexAutoLock& locker,
size_t KeyedScalar::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
size_t n = aMallocSizeOf(this);
for (auto iter = mScalarKeys.Iter(); !iter.Done(); iter.Next()) {
ScalarBase* scalar = static_cast<ScalarBase*>(iter.Data());
ScalarBase* scalar = iter.UserData();
n += scalar->SizeOfIncludingThis(aMallocSizeOf);
}
return n;
@ -2001,8 +2001,7 @@ nsresult internal_ScalarSnapshotter(const StaticMutexAutoLock& aLock,
// Iterate the scalars in aProcessStorage. The storage may contain empty or
// yet to be initialized scalars from all the supported processes.
for (auto iter = aProcessStorage.Iter(); !iter.Done(); iter.Next()) {
ScalarStorageMapType* scalarStorage =
static_cast<ScalarStorageMapType*>(iter.Data());
ScalarStorageMapType* scalarStorage = iter.UserData();
ScalarTupleArray& processScalars =
aScalarsToReflect.GetOrInsert(iter.Key());
@ -2013,7 +2012,7 @@ nsresult internal_ScalarSnapshotter(const StaticMutexAutoLock& aLock,
// Iterate each available child storage.
for (auto childIter = scalarStorage->Iter(); !childIter.Done();
childIter.Next()) {
ScalarBase* scalar = static_cast<ScalarBase*>(childIter.Data());
ScalarBase* scalar = childIter.UserData();
// Get the informations for this scalar.
const BaseScalarInfo& info = internal_GetScalarInfo(
@ -2062,8 +2061,7 @@ nsresult internal_KeyedScalarSnapshotter(
// Iterate the scalars in aProcessStorage. The storage may contain empty or
// yet to be initialized scalars from all the supported processes.
for (auto iter = aProcessStorage.Iter(); !iter.Done(); iter.Next()) {
KeyedScalarStorageMapType* scalarStorage =
static_cast<KeyedScalarStorageMapType*>(iter.Data());
KeyedScalarStorageMapType* scalarStorage = iter.UserData();
KeyedScalarTupleArray& processScalars =
aScalarsToReflect.GetOrInsert(iter.Key());
@ -2073,7 +2071,7 @@ nsresult internal_KeyedScalarSnapshotter(
for (auto childIter = scalarStorage->Iter(); !childIter.Done();
childIter.Next()) {
KeyedScalar* scalar = static_cast<KeyedScalar*>(childIter.Data());
KeyedScalar* scalar = childIter.UserData();
// Get the informations for this scalar.
const BaseScalarInfo& info = internal_GetScalarInfo(

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

@ -127,7 +127,7 @@ KeyedStackCapturer::ReflectCapturedStacks(JSContext* cx,
size_t keyIndex = 0;
for (auto iter = mStackInfos.ConstIter(); !iter.Done();
iter.Next(), ++keyIndex) {
const StackFrequencyInfo* info = iter.Data();
const StackFrequencyInfo* info = iter.UserData();
JS::RootedObject infoArray(cx, JS::NewArrayObject(cx, 0));
if (!keysArray) {

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

@ -321,7 +321,7 @@ void LookupCache::InvalidateExpiredCacheEntries() {
int64_t nowSec = PR_Now() / PR_USEC_PER_SEC;
for (auto iter = mFullHashCache.Iter(); !iter.Done(); iter.Next()) {
CachedFullHashResponse* response = iter.Data();
CachedFullHashResponse* response = iter.UserData();
if (response->negativeCacheExpirySec < nowSec) {
iter.Remove();
}
@ -372,7 +372,7 @@ void LookupCache::GetCacheInfo(nsIUrlClassifierCacheInfo** aCache) const {
CStringToHexString(prefix, entry->prefix);
// Set expiry of the cache entry.
CachedFullHashResponse* response = iter.Data();
CachedFullHashResponse* response = iter.UserData();
entry->expirySec = response->negativeCacheExpirySec;
// Set positive cache.
@ -660,7 +660,7 @@ void LookupCache::DumpCache() const {
}
for (auto iter = mFullHashCache.ConstIter(); !iter.Done(); iter.Next()) {
CachedFullHashResponse* response = iter.Data();
CachedFullHashResponse* response = iter.UserData();
nsAutoCString prefix;
CStringToHexString(

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

@ -526,7 +526,7 @@ VLPrefixSet::VLPrefixSet(const PrefixStringMap& aMap) : mCount(0) {
void VLPrefixSet::Merge(PrefixStringMap& aPrefixMap) {
for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) {
nsCString* prefixString = aPrefixMap.LookupOrAdd(iter.Key());
PrefixString* str = iter.Data();
PrefixString* str = iter.UserData();
nsAutoCString remainingString;
str->getRemainingString(remainingString);
@ -540,7 +540,7 @@ void VLPrefixSet::Merge(PrefixStringMap& aPrefixMap) {
bool VLPrefixSet::GetSmallestPrefix(nsACString& aOutString) const {
PrefixString* pick = nullptr;
for (auto iter = mMap.ConstIter(); !iter.Done(); iter.Next()) {
PrefixString* str = iter.Data();
PrefixString* str = iter.UserData();
if (str->remaining() <= 0) {
continue;

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

@ -186,7 +186,7 @@ void CheckContent(LookupCacheV4* aCache, const _PrefixArray& aPrefixArray) {
for (auto iter = vlPSetMap.Iter(); !iter.Done(); iter.Next()) {
nsCString* expectedPrefix = expected.Get(iter.Key());
nsCString* resultPrefix = iter.Data();
nsCString* resultPrefix = iter.UserData();
ASSERT_TRUE(resultPrefix->Equals(*expectedPrefix));
}

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

@ -132,7 +132,7 @@ TEST(UrlClassifierProtocolParser, SingleValueEncoding)
// The fixed-length prefix string from ProtocolParser should
// exactly match the expected prefix string.
nsCString* prefix = iter.Data();
nsCString* prefix = iter.UserData();
ASSERT_TRUE(prefix->Equals(nsCString(expectedPrefix, 4)));
}

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

@ -115,7 +115,7 @@ static void GenerateUpdateData(bool fullUpdate, PrefixStringMap& add,
tableUpdate->SetFullUpdate(fullUpdate);
for (auto iter = add.ConstIter(); !iter.Done(); iter.Next()) {
nsCString* pstring = iter.Data();
nsCString* pstring = iter.UserData();
tableUpdate->NewPrefixes(iter.Key(), *pstring);
}
@ -151,7 +151,7 @@ static void VerifyPrefixSet(PrefixStringMap& expected) {
lookup->GetPrefixes(prefixesInFile);
for (auto iter = expected.ConstIter(); !iter.Done(); iter.Next()) {
nsCString* expectedPrefix = iter.Data();
nsCString* expectedPrefix = iter.UserData();
nsCString* resultPrefix = prefixesInFile.Get(iter.Key());
ASSERT_TRUE(*resultPrefix == *expectedPrefix);

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

@ -11,7 +11,6 @@
#include "KeyboardLayout.h"
#include "WinUtils.h"
#include "npapi.h"
#include "nsAutoPtr.h"
using namespace mozilla;
using namespace mozilla::widget;
@ -221,8 +220,8 @@ nsresult nsWindowBase::ClearNativeTouchSequence(nsIObserver* aObserver) {
// cancel all input points
for (auto iter = mActivePointers.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<PointerInfo>& info = iter.Data();
InjectTouchPoint(info.get()->mPointerId, info.get()->mPosition,
auto info = iter.UserData();
InjectTouchPoint(info->mPointerId, info->mPosition,
POINTER_FLAG_CANCELED);
iter.Remove();
}

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

@ -280,9 +280,9 @@ nsresult nsINIParser::RenameSection(const char* aSection,
return NS_ERROR_ILLEGAL_VALUE;
}
nsAutoPtr<INIValue> val;
mozilla::UniquePtr<INIValue> val;
if (mSections.Remove(aSection, &val)) {
mSections.Put(aNewName, val.forget());
mSections.Put(aNewName, val.release());
} else {
return NS_ERROR_FAILURE;
}
@ -295,7 +295,7 @@ nsresult nsINIParser::WriteToFile(nsIFile* aFile) {
for (auto iter = mSections.Iter(); !iter.Done(); iter.Next()) {
buffer.AppendPrintf("[%s]\n", iter.Key());
INIValue* val = iter.Data();
INIValue* val = iter.UserData();
while (val) {
buffer.AppendPrintf("%s=%s\n", val->key, val->value);
val = val->next.get();

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

@ -320,7 +320,7 @@ static BloatEntry* GetBloatEntry(const char* aTypeName,
static void DumpSerialNumbers(const SerialHash::Iterator& aHashEntry, FILE* aFd,
bool aDumpAsStringBuffer) {
SerialNumberRecord* record = aHashEntry.Data();
SerialNumberRecord* record = aHashEntry.UserData();
auto* outputFile = aFd;
#ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
fprintf(outputFile, "%" PRIdPTR " @%p (%d references; %d from COMPtrs)\n",
@ -393,7 +393,7 @@ nsresult nsTraceRefcnt::DumpStatistics() {
BloatEntry total("TOTAL", 0);
for (auto iter = gBloatView->Iter(); !iter.Done(); iter.Next()) {
BloatEntry* entry = iter.Data();
BloatEntry* entry = iter.UserData();
if (nsCRT::strcmp(entry->GetClassName(), "TOTAL") != 0) {
entry->Total(&total);
}
@ -409,7 +409,7 @@ nsresult nsTraceRefcnt::DumpStatistics() {
nsTArray<BloatEntry*> entries;
for (auto iter = gBloatView->Iter(); !iter.Done(); iter.Next()) {
entries.AppendElement(iter.Data());
entries.AppendElement(iter.UserData());
}
const uint32_t count = entries.Length();