зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1617542 - Remove nsRefPtrHashtable::Put overload accepting already_AddRefed and adapt all uses. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D63865 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
166369d19b
Коммит
32c9aeaad4
|
@ -963,7 +963,7 @@ void CustomElementRegistry::Define(
|
|||
disableInternals, disableShadow);
|
||||
|
||||
CustomElementDefinition* def = definition.get();
|
||||
mCustomDefinitions.Put(nameAtom, definition.forget());
|
||||
mCustomDefinitions.Put(nameAtom, std::move(definition));
|
||||
|
||||
MOZ_ASSERT(mCustomDefinitions.Count() == mConstructors.count(),
|
||||
"Number of entries should be the same");
|
||||
|
@ -1022,7 +1022,7 @@ void CustomElementRegistry::SetElementCreationCallback(
|
|||
}
|
||||
|
||||
RefPtr<CustomElementCreationCallback> callback = &aCallback;
|
||||
mElementCreationCallbacks.Put(nameAtom, callback.forget());
|
||||
mElementCreationCallbacks.Put(nameAtom, std::move(callback));
|
||||
}
|
||||
|
||||
void CustomElementRegistry::Upgrade(nsINode& aRoot) {
|
||||
|
|
|
@ -11410,7 +11410,7 @@ void Document::MaybePreLoadImage(nsIURI* uri, const nsAString& aCrossOriginAttr,
|
|||
// the "real" load occurs. Unpinned in DispatchContentLoadedEvents and
|
||||
// unlink
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mPreloadingImages.Put(uri, request.forget());
|
||||
mPreloadingImages.Put(uri, std::move(request));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12870,7 +12870,7 @@ RefPtr<FullDatabaseMetadata> FullDatabaseMetadata::Duplicate() const {
|
|||
newIndexMetadata->mCommonMetadata = value->mCommonMetadata;
|
||||
|
||||
if (NS_WARN_IF(!newOSMetadata->mIndexes.Put(
|
||||
indexEntry.GetKey(), newIndexMetadata.forget(), fallible))) {
|
||||
indexEntry.GetKey(), std::move(newIndexMetadata), fallible))) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -12879,7 +12879,7 @@ RefPtr<FullDatabaseMetadata> FullDatabaseMetadata::Duplicate() const {
|
|||
newOSMetadata->mIndexes.Count());
|
||||
|
||||
if (NS_WARN_IF(!newMetadata->mObjectStores.Put(
|
||||
objectStoreEntry.GetKey(), newOSMetadata.forget(), fallible))) {
|
||||
objectStoreEntry.GetKey(), std::move(newOSMetadata), fallible))) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2772,7 +2772,7 @@ RefPtr<MediaManager::StreamPromise> MediaManager::GetUserMedia(
|
|||
focusSource);
|
||||
|
||||
// Store the task w/callbacks.
|
||||
self->mActiveCallbacks.Put(callID, task.forget());
|
||||
self->mActiveCallbacks.Put(callID, std::move(task));
|
||||
|
||||
// Add a WindowID cross-reference so OnNavigation can tear
|
||||
// things down
|
||||
|
@ -3396,7 +3396,7 @@ void MediaManager::AddWindowID(uint64_t aWindowId,
|
|||
return;
|
||||
}
|
||||
|
||||
GetActiveWindows()->Put(aWindowId, aListener.forget());
|
||||
GetActiveWindows()->Put(aWindowId, std::move(aListener));
|
||||
}
|
||||
|
||||
void MediaManager::RemoveWindowID(uint64_t aWindowId) {
|
||||
|
|
|
@ -3319,9 +3319,7 @@ void nsPermissionManager::WhenPermissionsAvailable(nsIPrincipal* aPrincipal,
|
|||
// promise, and send the request to the parent (if we have not already
|
||||
// done so).
|
||||
promise = new GenericNonExclusivePromise::Private(__func__);
|
||||
mPermissionKeyPromiseMap.Put(
|
||||
pair.first(),
|
||||
RefPtr<GenericNonExclusivePromise::Private>(promise).forget());
|
||||
mPermissionKeyPromiseMap.Put(pair.first(), promise);
|
||||
}
|
||||
|
||||
if (promise) {
|
||||
|
|
|
@ -192,7 +192,7 @@ void SharedSurfacesParent::Add(const wr::ExternalImageId& aId,
|
|||
wr::RenderThread::Get()->RegisterExternalImage(id, texture.forget());
|
||||
|
||||
surface->AddConsumer();
|
||||
sInstance->mSurfaces.Put(id, surface.forget());
|
||||
sInstance->mSurfaces.Put(id, std::move(surface));
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -49,7 +49,7 @@ class LiveSet final {
|
|||
|
||||
void Put(IUnknown* aKey, already_AddRefed<IWeakReference> aValue) {
|
||||
mMutex.AssertCurrentThreadOwns();
|
||||
mLiveSet.Put(aKey, std::move(aValue));
|
||||
mLiveSet.Put(aKey, RefPtr<IWeakReference>{std::move(aValue)});
|
||||
}
|
||||
|
||||
RefPtr<IWeakReference> Get(IUnknown* aKey) {
|
||||
|
|
|
@ -95,7 +95,7 @@ ComputedStyle* nsTreeStyleCache::GetComputedStyle(
|
|||
mCache = MakeUnique<ComputedStyleCache>();
|
||||
}
|
||||
result = newResult.get();
|
||||
mCache->Put(currState, newResult.forget());
|
||||
mCache->Put(currState, std::move(newResult));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -358,7 +358,7 @@ struct ParamTraits<mozilla::ModulesMap> {
|
|||
return false;
|
||||
}
|
||||
|
||||
aResult->Put(key, rec.forget());
|
||||
aResult->Put(key, std::move(rec));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -983,7 +983,7 @@ RefPtr<ModulesTrustPromise> UntrustedModulesProcessor::GetModulesTrustInternal(
|
|||
NS_ERROR_ILLEGAL_DURING_SHUTDOWN, __func__);
|
||||
}
|
||||
|
||||
modMap.Put(resolvedNtPath, module.forget());
|
||||
modMap.Put(resolvedNtPath, std::move(module));
|
||||
}
|
||||
|
||||
return ModulesTrustPromise::CreateAndResolve(std::move(result), __func__);
|
||||
|
|
|
@ -3697,7 +3697,7 @@ gboolean nsWindow::OnTouchEvent(GdkEventTouch* aEvent) {
|
|||
event.mTime = aEvent->time;
|
||||
|
||||
if (aEvent->type == GDK_TOUCH_BEGIN || aEvent->type == GDK_TOUCH_UPDATE) {
|
||||
mTouches.Put(aEvent->sequence, touch.forget());
|
||||
mTouches.Put(aEvent->sequence, std::move(touch));
|
||||
// add all touch points to event object
|
||||
for (auto iter = mTouches.Iter(); !iter.Done(); iter.Next()) {
|
||||
event.mTouches.AppendElement(new dom::Touch(*iter.UserData()));
|
||||
|
|
|
@ -53,11 +53,6 @@ class nsRefPtrHashtable
|
|||
// Overload Put, rather than overriding it.
|
||||
using base_type::Put;
|
||||
|
||||
void Put(KeyType aKey, already_AddRefed<PtrType> aData);
|
||||
|
||||
MOZ_MUST_USE bool Put(KeyType aKey, already_AddRefed<PtrType> aData,
|
||||
const mozilla::fallible_t&);
|
||||
|
||||
template <typename U,
|
||||
typename = std::enable_if_t<std::is_base_of_v<PtrType, U>>>
|
||||
void Put(KeyType aKey, RefPtr<U>&& aData);
|
||||
|
@ -154,19 +149,6 @@ PtrType* nsRefPtrHashtable<KeyClass, PtrType>::GetWeak(KeyType aKey,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
template <class KeyClass, class PtrType>
|
||||
void nsRefPtrHashtable<KeyClass, PtrType>::Put(
|
||||
KeyType aKey, already_AddRefed<PtrType> aData) {
|
||||
Put(aKey, RefPtr<PtrType>{aData});
|
||||
}
|
||||
|
||||
template <class KeyClass, class PtrType>
|
||||
bool nsRefPtrHashtable<KeyClass, PtrType>::Put(KeyType aKey,
|
||||
already_AddRefed<PtrType> aData,
|
||||
const mozilla::fallible_t&) {
|
||||
return Put(aKey, RefPtr<PtrType>{aData}, mozilla::fallible);
|
||||
}
|
||||
|
||||
template <class KeyClass, class PtrType>
|
||||
template <typename U, typename>
|
||||
void nsRefPtrHashtable<KeyClass, PtrType>::Put(KeyType aKey,
|
||||
|
|
Загрузка…
Ссылка в новой задаче