Bug 1611415 - Prefer using std::move over forget. r=froydnj

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-02-13 14:38:48 +00:00
Родитель 9211d26984
Коммит b50347f917
251 изменённых файлов: 512 добавлений и 500 удалений

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

@ -398,7 +398,7 @@ bool nsAccessiblePivot::IsDescendantOf(Accessible* aAccessible,
bool nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
PivotMoveReason aReason,
bool aIsFromUserInput) {
RefPtr<Accessible> oldPosition = mPosition.forget();
RefPtr<Accessible> oldPosition = std::move(mPosition);
mPosition = aPosition;
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = mEndOffset = -1;

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

@ -1562,7 +1562,7 @@ bool IPDLParamTraits<dom::BrowsingContext*>::Read(
browsingContext.get()->Release();
}
*aResult = browsingContext.forget();
*aResult = std::move(browsingContext);
return true;
}

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

@ -490,7 +490,7 @@ CanonicalBrowsingContext::ChangeFrameRemoteness(const nsAString& aRemoteType,
change->Complete(aContentParent);
},
[change](nsresult aRv) { change->Cancel(aRv); });
return promise.forget();
return promise;
}
already_AddRefed<Promise> CanonicalBrowsingContext::ChangeFrameRemoteness(

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

@ -214,7 +214,7 @@ bool IPDLParamTraits<dom::WindowContext*>::Read(
windowContext.get()->Release();
}
*aResult = windowContext.forget();
*aResult = std::move(windowContext);
return true;
}

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

@ -428,7 +428,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
}
nsCOMPtr<nsIURI> temp = DeserializeURI(uri);
info->mPreferredURI = temp.forget();
info->mPreferredURI = std::move(temp);
return NS_OK;
}

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

@ -26,7 +26,7 @@ nsDocShellEditorData::~nsDocShellEditorData() { TearDownEditor(); }
void nsDocShellEditorData::TearDownEditor() {
if (mHTMLEditor) {
RefPtr<HTMLEditor> htmlEditor = mHTMLEditor.forget();
RefPtr<HTMLEditor> htmlEditor = std::move(mHTMLEditor);
htmlEditor->PreDestroy(false);
}
mEditingSession = nullptr;
@ -43,7 +43,7 @@ nsresult nsDocShellEditorData::MakeEditable(bool aInWaitForUriLoad) {
if (mHTMLEditor) {
NS_WARNING("Destroying existing editor on frame");
RefPtr<HTMLEditor> htmlEditor = mHTMLEditor.forget();
RefPtr<HTMLEditor> htmlEditor = std::move(mHTMLEditor);
htmlEditor->PreDestroy(false);
}
@ -72,7 +72,7 @@ nsresult nsDocShellEditorData::SetHTMLEditor(HTMLEditor* aHTMLEditor) {
}
if (mHTMLEditor) {
RefPtr<HTMLEditor> htmlEditor = mHTMLEditor.forget();
RefPtr<HTMLEditor> htmlEditor = std::move(mHTMLEditor);
htmlEditor->PreDestroy(false);
MOZ_ASSERT(!mHTMLEditor,
"Nested call of nsDocShellEditorData::SetHTMLEditor() detected");

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

@ -88,7 +88,7 @@ bool IPDLParamTraits<dom::CrossProcessSHEntry*>::Read(
newEntry.mSharedID);
dom::ContentChild::GetSingleton()->BindPSHEntryEndpoint(
std::move(newEntry.mEndpoint), do_AddRef(entry).take());
*aEntry = entry.forget();
*aEntry = std::move(entry);
return true;
});
}

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

@ -232,7 +232,7 @@ bool SHistoryParent::RecvFindEntryForBFCache(
*aEntry = nullptr;
*aIndex = -1;
} else {
*aEntry = shEntry.forget();
*aEntry = std::move(shEntry);
*aIndex = i;
}

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

@ -1580,7 +1580,7 @@ nsresult nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
nsCOMPtr<nsIContentSecurityPolicy> csp = aFrameEntry->GetCsp();
loadState->SetCsp(csp);
aLoadResult.mLoadState = loadState.forget();
aLoadResult.mLoadState = std::move(loadState);
return NS_OK;
}

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

@ -1727,7 +1727,7 @@ void Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag) {
} else if (!mFinishNotificationTask) {
RefPtr<MicroTaskRunnable> runnable = new AsyncFinishNotification(this);
context->DispatchToMicroTask(do_AddRef(runnable));
mFinishNotificationTask = runnable.forget();
mFinishNotificationTask = std::move(runnable);
}
}

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

@ -641,7 +641,7 @@ void BodyConsumer::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength,
mBodyConsumed = true;
MOZ_ASSERT(mConsumePromise);
RefPtr<Promise> localPromise = mConsumePromise.forget();
RefPtr<Promise> localPromise = std::move(mConsumePromise);
RefPtr<BodyConsumer> self = this;
auto autoReleaseObject =
@ -751,7 +751,7 @@ void BodyConsumer::ContinueConsumeBlobBody(BlobImpl* aBlobImpl,
mBodyConsumed = true;
MOZ_ASSERT(mConsumePromise);
RefPtr<Promise> localPromise = mConsumePromise.forget();
RefPtr<Promise> localPromise = std::move(mConsumePromise);
if (!aShuttingDown) {
RefPtr<dom::Blob> blob = dom::Blob::Create(mGlobal, aBlobImpl);

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

@ -121,7 +121,7 @@ void BodyStream::Create(JSContext* aCx, BodyStreamHolder* aStreamHolder,
// Note, this will create a ref-cycle between the holder and the stream.
// The cycle is broken when the stream is closed or the worker begins
// shutting down.
stream->mWorkerRef = workerRef.forget();
stream->mWorkerRef = std::move(workerRef);
}
aRv.MightThrowJSException();

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

@ -337,7 +337,7 @@ class IdleDispatchRunnable final : public IdleRunnable,
RefPtr<IdleDeadline> idleDeadline =
new IdleDeadline(mParent, mTimedOut, deadline.ToMilliseconds());
RefPtr<IdleRequestCallback> callback(mCallback.forget());
RefPtr<IdleRequestCallback> callback(std::move(mCallback));
MOZ_ASSERT(!mCallback);
callback->Call(*idleDeadline, "ChromeUtils::IdleDispatch handler");
mParent = nullptr;

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

@ -5987,7 +5987,7 @@ Result<nsCOMPtr<nsIURI>, nsresult> Document::ResolveWithBaseURI(
nsCOMPtr<nsIURI> resolvedURI;
MOZ_TRY(
NS_NewURI(getter_AddRefs(resolvedURI), aURI, nullptr, GetDocBaseURI()));
return std::move(resolvedURI);
return resolvedURI;
}
URLExtraData* Document::DefaultStyleAttrURLData() {
@ -8708,7 +8708,7 @@ mozilla::dom::Nullable<mozilla::dom::WindowProxyHolder> Document::Open(
if (!newBC) {
return nullptr;
}
return WindowProxyHolder(newBC.forget());
return WindowProxyHolder(std::move(newBC));
}
Document* Document::Open(const Optional<nsAString>& /* unused */,
@ -8868,7 +8868,7 @@ Document* Document::Open(const Optional<nsAString>& /* unused */,
aError.Throw(rv);
return nullptr;
}
newURI = noFragmentURI.forget();
newURI = std::move(noFragmentURI);
}
// UpdateURLAndHistory might do various member-setting, so make sure we're
@ -11696,7 +11696,7 @@ static already_AddRefed<nsPIDOMWindowOuter> FindTopWindowForElement(
// Trying to find the top window (equivalent to window.top).
if (nsCOMPtr<nsPIDOMWindowOuter> top = window->GetInProcessTop()) {
window = top.forget();
window = std::move(top);
}
return window.forget();
}
@ -11707,11 +11707,11 @@ static already_AddRefed<nsPIDOMWindowOuter> FindTopWindowForElement(
*/
class nsAutoFocusEvent : public Runnable {
public:
explicit nsAutoFocusEvent(already_AddRefed<Element>&& aElement,
already_AddRefed<nsPIDOMWindowOuter>&& aTopWindow)
explicit nsAutoFocusEvent(nsCOMPtr<Element>&& aElement,
nsCOMPtr<nsPIDOMWindowOuter>&& aTopWindow)
: mozilla::Runnable("nsAutoFocusEvent"),
mElement(aElement),
mTopWindow(aTopWindow) {}
mElement(std::move(aElement)),
mTopWindow(std::move(aTopWindow)) {}
NS_IMETHOD Run() override {
nsCOMPtr<nsPIDOMWindowOuter> currentTopWindow =
@ -11784,7 +11784,7 @@ void Document::TriggerAutoFocus() {
}
nsCOMPtr<nsIRunnable> event =
new nsAutoFocusEvent(autoFocusElement.forget(), topWindow.forget());
new nsAutoFocusEvent(std::move(autoFocusElement), topWindow.forget());
nsresult rv = NS_DispatchToCurrentThread(event.forget());
NS_ENSURE_SUCCESS_VOID(rv);
}
@ -12876,7 +12876,7 @@ class PendingFullscreenChangeList {
nsCOMPtr<nsIDocShellTreeItem> root;
mRootShellForIteration->GetInProcessRootTreeItem(
getter_AddRefs(root));
mRootShellForIteration = root.forget();
mRootShellForIteration = std::move(root);
}
SkipToNextMatch();
}
@ -12911,7 +12911,7 @@ class PendingFullscreenChangeList {
while (docShell && docShell != mRootShellForIteration) {
nsCOMPtr<nsIDocShellTreeItem> parent;
docShell->GetInProcessParent(getter_AddRefs(parent));
docShell = parent.forget();
docShell = std::move(parent);
}
if (docShell) {
break;
@ -15690,7 +15690,7 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
ContentPermissionRequestBase::DelayedTaskType::Request);
});
return p.forget();
return std::move(p);
};
AntiTrackingCommon::AddFirstPartyStorageAccessGrantedFor(
NodePrincipal(), inner, AntiTrackingCommon::eStorageAccessAPI,
@ -15986,7 +15986,7 @@ void Document::RecomputeLanguageFromCharset() {
}
mMayNeedFontPrefsUpdate = true;
mLanguageFromCharset = language.forget();
mLanguageFromCharset = std::move(language);
}
nsICookieSettings* Document::CookieSettings() {

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

@ -57,7 +57,7 @@ void IdleRequest::IdleRun(nsPIDOMWindowInner* aWindow,
RefPtr<IdleDeadline> deadline =
new IdleDeadline(aWindow, aDidTimeout, aDeadline);
RefPtr<IdleRequestCallback> callback(mCallback.forget());
RefPtr<IdleRequestCallback> callback(std::move(mCallback));
MOZ_ASSERT(!mCallback);
callback->Call(*deadline, "requestIdleCallback handler");
}

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

@ -99,7 +99,7 @@ class EncodingCompleteEvent : public CancelableRunnable {
nsresult rv = NS_OK;
// We want to null out mEncodeCompleteCallback no matter what.
RefPtr<EncodeCompleteCallback> callback(mEncodeCompleteCallback.forget());
RefPtr<EncodeCompleteCallback> callback(std::move(mEncodeCompleteCallback));
if (!mFailed) {
RefPtr<BlobImpl> blobImpl = new MemoryBlobImpl(mImgData, mImgSize, mType);
rv = callback->ReceiveBlobImpl(blobImpl.forget());

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

@ -69,7 +69,7 @@ PostMessageEvent::Run() {
// The document URI is just used for the principal mismatch error message
// below. Use a stack variable so mCallerURI is not held onto after
// this method finishes, regardless of the method outcome.
nsCOMPtr<nsIURI> callerURI = mCallerURI.forget();
nsCOMPtr<nsIURI> callerURI = std::move(mCallerURI);
// If we bailed before this point we're going to leak mMessage, but
// that's probably better than crashing.

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

@ -134,7 +134,7 @@ already_AddRefed<ResizeObserver> ResizeObserver::Constructor(
return nullptr;
}
return do_AddRef(new ResizeObserver(window.forget(), doc, aCb));
return do_AddRef(new ResizeObserver(std::move(window), doc, aCb));
}
void ResizeObserver::Observe(Element& aTarget,
@ -306,7 +306,7 @@ void ResizeObserverEntry::SetContentRectAndSize(const nsSize& aSize) {
nsRect rect(nsPoint(padding.left, padding.top), aSize);
RefPtr<DOMRect> contentRect = new DOMRect(this);
contentRect->SetLayoutRect(rect);
mContentRect = contentRect.forget();
mContentRect = std::move(contentRect);
// 2. Update mContentBoxSize.
const WritingMode wm = frame ? frame->GetWritingMode() : WritingMode();

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

@ -88,9 +88,9 @@ class ResizeObserver final : public nsISupports, public nsWrapperCache {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserver)
ResizeObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner,
Document* aDocument, ResizeObserverCallback& aCb)
: mOwner(aOwner), mDocument(aDocument), mCallback(&aCb) {
ResizeObserver(nsCOMPtr<nsPIDOMWindowInner>&& aOwner, Document* aDocument,
ResizeObserverCallback& aCb)
: mOwner(std::move(aOwner)), mDocument(aDocument), mCallback(&aCb) {
MOZ_ASSERT(mOwner, "Need a non-null owner window");
MOZ_ASSERT(mDocument, "Need a non-null doc");
MOZ_ASSERT(mDocument == mOwner->GetExtantDoc());

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

@ -138,7 +138,7 @@ void SelectionChangeEventDispatcher::OnSelectionChange(Document* aDoc,
root = root->GetParent();
}
target = root.forget();
target = std::move(root);
}
}

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

@ -106,7 +106,7 @@ bool WindowNamedPropertiesHandler::getOwnPropDescriptor(
// global scope is still allowed, since |var| only looks up |own|
// properties. But unqualified shadowing will fail, per-spec.
JS::Rooted<JS::Value> v(aCx);
if (!ToJSValue(aCx, WindowProxyHolder(child.forget()), &v)) {
if (!ToJSValue(aCx, WindowProxyHolder(std::move(child)), &v)) {
return false;
}
FillPropertyDescriptor(aDesc, aProxy, 0, v);

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

@ -33,7 +33,7 @@ class WindowProxyHolder {
explicit WindowProxyHolder(BrowsingContext* aBC) : mBrowsingContext(aBC) {
MOZ_ASSERT(mBrowsingContext, "Don't set WindowProxyHolder to null.");
}
explicit WindowProxyHolder(already_AddRefed<BrowsingContext>&& aBC)
explicit WindowProxyHolder(RefPtr<BrowsingContext>&& aBC)
: mBrowsingContext(std::move(aBC)) {
MOZ_ASSERT(mBrowsingContext, "Don't set WindowProxyHolder to null.");
}
@ -42,7 +42,7 @@ class WindowProxyHolder {
MOZ_ASSERT(mBrowsingContext, "Don't set WindowProxyHolder to null.");
return *this;
}
WindowProxyHolder& operator=(already_AddRefed<BrowsingContext>&& aBC) {
WindowProxyHolder& operator=(RefPtr<BrowsingContext>&& aBC) {
mBrowsingContext = std::move(aBC);
MOZ_ASSERT(mBrowsingContext, "Don't set WindowProxyHolder to null.");
return *this;

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

@ -1412,7 +1412,8 @@ void nsContentSink::DropParserAndPerfHint(void) {
// actually broken.
// Drop our reference to the parser to get rid of a circular
// reference.
RefPtr<nsParserBase> kungFuDeathGrip(mParser.forget());
RefPtr<nsParserBase> kungFuDeathGrip = std::move(mParser);
mozilla::Unused << kungFuDeathGrip;
if (mDynamicLowerValue) {
// Reset the performance hint which was set to FALSE

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

@ -702,7 +702,7 @@ void nsDOMMutationObserver::TakeRecords(
current->mNext.swap(next);
if (!mMergeAttributeRecords ||
!MergeableAttributeRecord(aRetVal.SafeLastElement(nullptr), current)) {
*aRetVal.AppendElement() = current.forget();
*aRetVal.AppendElement() = std::move(current);
}
current.swap(next);
}
@ -755,7 +755,7 @@ already_AddRefed<nsDOMMutationObserver> nsDOMMutationObserver::Constructor(
}
bool isChrome = nsContentUtils::IsChromeDoc(window->GetExtantDoc());
RefPtr<nsDOMMutationObserver> observer =
new nsDOMMutationObserver(window.forget(), aCb, isChrome);
new nsDOMMutationObserver(std::move(window), aCb, isChrome);
return observer.forget();
}

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

@ -432,9 +432,9 @@ class nsAnimationReceiver : public nsMutationReceiver {
class nsDOMMutationObserver final : public nsISupports, public nsWrapperCache {
public:
nsDOMMutationObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner,
nsDOMMutationObserver(nsCOMPtr<nsPIDOMWindowInner>&& aOwner,
mozilla::dom::MutationCallback& aCb, bool aChrome)
: mOwner(aOwner),
: mOwner(std::move(aOwner)),
mLastPendingMutation(nullptr),
mPendingMutationCount(0),
mCallback(&aCb),
@ -490,11 +490,11 @@ class nsDOMMutationObserver final : public nsISupports, public nsWrapperCache {
MOZ_ASSERT(record);
if (!mLastPendingMutation) {
MOZ_ASSERT(!mFirstPendingMutation);
mFirstPendingMutation = record.forget();
mFirstPendingMutation = std::move(record);
mLastPendingMutation = mFirstPendingMutation;
} else {
MOZ_ASSERT(mFirstPendingMutation);
mLastPendingMutation->mNext = record.forget();
mLastPendingMutation->mNext = std::move(record);
mLastPendingMutation = mLastPendingMutation->mNext;
}
++mPendingMutationCount;
@ -503,11 +503,11 @@ class nsDOMMutationObserver final : public nsISupports, public nsWrapperCache {
void ClearPendingRecords() {
// Break down the pending mutation record list so that cycle collector
// can delete the objects sooner.
RefPtr<nsDOMMutationRecord> current = mFirstPendingMutation.forget();
RefPtr<nsDOMMutationRecord> current = std::move(mFirstPendingMutation);
mLastPendingMutation = nullptr;
mPendingMutationCount = 0;
while (current) {
current = current->mNext.forget();
current = std::move(current->mNext);
}
}

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

@ -630,11 +630,11 @@ bool mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Read(
}
timing->mNavigationType = nsDOMNavigationTiming::Type(type);
if (unloadedURI) {
timing->mUnloadedURI = unloadedURI->forget();
timing->mUnloadedURI = std::move(*unloadedURI);
}
if (loadedURI) {
timing->mLoadedURI = loadedURI->forget();
timing->mLoadedURI = std::move(*loadedURI);
}
*aResult = timing.forget();
*aResult = std::move(timing);
return true;
}

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

@ -903,7 +903,7 @@ nsFocusManager::WindowHidden(mozIDOMWindowProxy* aWindow) {
// window, or an ancestor of the focused window. Either way, the focus is no
// longer valid, so it needs to be updated.
RefPtr<Element> oldFocusedElement = mFocusedElement.forget();
RefPtr<Element> oldFocusedElement = std::move(mFocusedElement);
nsCOMPtr<nsIDocShell> focusedDocShell = mFocusedWindow->GetDocShell();
RefPtr<PresShell> presShell = focusedDocShell->GetPresShell();

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

@ -5497,7 +5497,7 @@ RefPtr<ServiceWorker> nsGlobalWindowInner::GetOrCreateServiceWorker(
return;
}
ref = sw.forget();
ref = std::move(sw);
*aDoneOut = true;
});
@ -5505,7 +5505,7 @@ RefPtr<ServiceWorker> nsGlobalWindowInner::GetOrCreateServiceWorker(
ref = ServiceWorker::Create(this, aDescriptor);
}
return ref.forget();
return ref;
}
RefPtr<mozilla::dom::ServiceWorkerRegistration>
@ -5520,10 +5520,10 @@ nsGlobalWindowInner::GetServiceWorkerRegistration(
return;
}
ref = swr.forget();
ref = std::move(swr);
*aDoneOut = true;
});
return ref.forget();
return ref;
}
RefPtr<ServiceWorkerRegistration>
@ -5535,7 +5535,7 @@ nsGlobalWindowInner::GetOrCreateServiceWorkerRegistration(
if (!ref) {
ref = ServiceWorkerRegistration::CreateForMainThread(this, aDescriptor);
}
return ref.forget();
return ref;
}
nsresult nsGlobalWindowInner::FireDelayedDOMEvents() {
@ -6876,7 +6876,7 @@ void nsGlobalWindowInner::GetSidebar(OwningExternalOrWindowProxy& aResult,
RefPtr<BrowsingContext> domWindow =
GetChildWindow(NS_LITERAL_STRING("sidebar"));
if (domWindow) {
aResult.SetAsWindowProxy() = domWindow.forget();
aResult.SetAsWindowProxy() = std::move(domWindow);
return;
}

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

@ -3218,7 +3218,7 @@ nsPIDOMWindowOuter* nsGlobalWindowOuter::GetSameProcessOpener() {
Nullable<WindowProxyHolder> nsGlobalWindowOuter::GetOpenerWindowOuter() {
if (RefPtr<BrowsingContext> opener = GetOpenerBrowsingContext()) {
return WindowProxyHolder(opener.forget());
return WindowProxyHolder(std::move(opener));
}
return nullptr;
}
@ -5442,7 +5442,7 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::OpenOuter(
if (!bc) {
return nullptr;
}
return WindowProxyHolder(bc.forget());
return WindowProxyHolder(std::move(bc));
}
nsresult nsGlobalWindowOuter::Open(const nsAString& aUrl,
@ -5540,7 +5540,7 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::OpenDialogOuter(
if (!dialog) {
return nullptr;
}
return WindowProxyHolder(dialog.forget());
return WindowProxyHolder(std::move(dialog));
}
WindowProxyHolder nsGlobalWindowOuter::GetFramesOuter() {

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

@ -1628,10 +1628,10 @@ void nsINode::DisconnectChild(nsIContent* aKid) {
aKid->mPreviousOrLastSibling = nullptr;
if (previousSibling) {
previousSibling->mNextSibling = aKid->mNextSibling.forget();
previousSibling->mNextSibling = std::move(aKid->mNextSibling);
} else {
// aKid is the first child in the list
mFirstChild = aKid->mNextSibling.forget();
mFirstChild = std::move(aKid->mNextSibling);
}
--mChildCount;

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

@ -3369,7 +3369,7 @@ nsresult UnwrapWindowProxyArg(JSContext* cx, JS::Handle<JSObject*> src,
nsCOMPtr<nsPIDOMWindowOuter> outer = inner->GetOuterWindow();
RefPtr<BrowsingContext> bc = outer ? outer->GetBrowsingContext() : nullptr;
ppArg = bc.forget();
ppArg = std::move(bc);
return NS_OK;
}

2
dom/cache/CacheStreamControlChild.cpp поставляемый
Просмотреть файл

@ -115,7 +115,7 @@ void CacheStreamControlChild::OpenStream(const nsID& aId,
SendOpenStream(aId)->Then(
GetCurrentThreadSerialEventTarget(), __func__,
[aResolver, holder](RefPtr<nsIInputStream>&& aOptionalStream) {
aResolver(nsCOMPtr<nsIInputStream>(aOptionalStream.forget()));
aResolver(nsCOMPtr<nsIInputStream>(std::move(aOptionalStream)));
},
[aResolver, holder](ResponseRejectReason&& aReason) {
aResolver(nullptr);

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

@ -1337,8 +1337,8 @@ bool CanvasRenderingContext2D::EnsureTarget(const gfx::Rect* aCoveredRect,
newTarget->ClearRect(canvasRect);
}
mTarget = newTarget.forget();
mBufferProvider = newProvider.forget();
mTarget = std::move(newTarget);
mBufferProvider = std::move(newProvider);
RegisterAllocation();
@ -4366,8 +4366,8 @@ CanvasRenderingContext2D::CachedSurfaceFromElement(Element* aElement) {
}
res.mSize = res.mIntrinsicSize = res.mSourceSurface->GetSize();
res.mPrincipal = principal.forget();
res.mImageRequest = imgRequest.forget();
res.mPrincipal = std::move(principal);
res.mImageRequest = std::move(imgRequest);
res.mIsWriteOnly = CheckWriteOnlySecurity(res.mCORSUsed, res.mPrincipal,
res.mHadCrossOriginRedirects);

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

@ -41,7 +41,7 @@ void CanvasRenderingContextHelper::ToBlob(
blob = Blob::Create(mGlobal, blobImpl);
}
RefPtr<BlobCallback> callback(mBlobCallback.forget());
RefPtr<BlobCallback> callback(std::move(mBlobCallback));
ErrorResult rv;
callback->Call(blob, rv);
@ -173,7 +173,7 @@ already_AddRefed<nsISupports> CanvasRenderingContextHelper::GetContext(
return nullptr;
}
mCurrentContext = context.forget();
mCurrentContext = std::move(context);
mCurrentContextType = contextType;
nsresult rv = UpdateContext(aCx, aContextOptions, aRv);

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

@ -121,7 +121,7 @@ RefPtr<GenericErrorResultPromise> ClientHandle::Control(
outerPromise->Reject(aResult.get_CopyableErrorResult(), __func__);
});
return outerPromise.forget();
return outerPromise;
}
RefPtr<ClientStatePromise> ClientHandle::Focus(CallerType aCallerType) {
@ -138,7 +138,7 @@ RefPtr<ClientStatePromise> ClientHandle::Focus(CallerType aCallerType) {
outerPromise->Reject(aResult.get_CopyableErrorResult(), __func__);
});
return outerPromise.forget();
return outerPromise;
}
RefPtr<GenericErrorResultPromise> ClientHandle::PostMessage(
@ -171,7 +171,7 @@ RefPtr<GenericErrorResultPromise> ClientHandle::PostMessage(
outerPromise->Reject(aResult.get_CopyableErrorResult(), __func__);
});
return outerPromise.forget();
return outerPromise;
}
RefPtr<GenericPromise> ClientHandle::OnDetach() {

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

@ -195,7 +195,7 @@ RefPtr<ClientOpPromise> ClientManager::StartOp(
promise->Reject(rv, __func__);
});
return promise.forget();
return promise;
}
// static

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

@ -103,7 +103,7 @@ RefPtr<GenericPromise> OnShutdown() {
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
return ref.forget();
return ref;
}
} // anonymous namespace
@ -310,7 +310,7 @@ RefPtr<ClientOpPromise> ClientManagerService::Navigate(
promise->Reject(rv, __func__);
}
return promise.forget();
return promise;
}
namespace {
@ -472,7 +472,7 @@ RefPtr<ClientOpPromise> ClaimOnMainThread(
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise.forget();
return promise;
}
} // anonymous namespace
@ -657,7 +657,7 @@ RefPtr<ClientOpPromise> ClientManagerService::OpenWindow(
new OpenWindowRunnable(promise, aArgs, std::move(aSourceProcess));
MOZ_ALWAYS_SUCCEEDS(SystemGroup::Dispatch(TaskCategory::Other, r.forget()));
return promise.forget();
return promise;
}
bool ClientManagerService::HasWindow(

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

@ -284,7 +284,7 @@ RefPtr<ClientOpPromise> ClientNavigateOpChild::DoNavigate(
// XXXbz Can we throw something better here?
result.Throw(rv);
promise->Reject(result, __func__);
return promise.forget();
return promise;
}
return promise->Then(

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

@ -460,13 +460,13 @@ RefPtr<ClientOpPromise> ClientOpenWindowInCurrentProcess(
if (NS_WARN_IF(rv.Failed())) {
promise->Reject(rv, __func__);
return promise.forget();
return promise;
}
MOZ_DIAGNOSTIC_ASSERT(outerWindow);
WaitForLoad(aArgs, outerWindow, promise);
return promise.forget();
return promise;
}
} // namespace dom

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

@ -650,7 +650,7 @@ RefPtr<ClientOpPromise> ClientSource::Claim(const ClientClaimArgs& aArgs) {
})
->Track(*holder);
return outerPromise.forget();
return outerPromise;
}
RefPtr<ClientOpPromise> ClientSource::GetInfoAndState(

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

@ -289,7 +289,7 @@ RefPtr<ClientOpPromise> ClientSourceParent::StartOp(
new ClientSourceOpParent(std::move(aArgs), promise);
Unused << SendPClientSourceOpConstructor(actor, actor->Args());
return promise.forget();
return promise;
}
} // namespace dom

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

@ -27,7 +27,7 @@ AsyncEventDispatcher::AsyncEventDispatcher(EventTarget* aTarget,
MOZ_ASSERT(mTarget);
RefPtr<Event> event =
EventDispatcher::CreateEvent(aTarget, nullptr, &aEvent, EmptyString());
mEvent = event.forget();
mEvent = std::move(event);
mEventType.SetIsVoid(true);
NS_ASSERTION(mEvent, "Should never fail to create an event");
mEvent->DuplicatePrivateData();

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

@ -209,7 +209,7 @@ class EventListenerManager final : public EventListenerManagerBase {
Listener(Listener&& aOther)
: mListener(std::move(aOther.mListener)),
mTypeAtom(aOther.mTypeAtom.forget()),
mTypeAtom(std::move(aOther.mTypeAtom)),
mEventMessage(aOther.mEventMessage),
mListenerType(aOther.mListenerType),
mListenerIsHandler(aOther.mListenerIsHandler),

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

@ -3996,7 +3996,7 @@ void EventStateManager::UpdateCursor(nsPresContext* aPresContext,
return;
}
cursor = framecursor->mCursor;
container = customCursor.mContainer.forget();
container = std::move(customCursor.mContainer);
hotspot = Some(customCursor.mHotspot);
}

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

@ -2079,7 +2079,7 @@ void IMEContentObserver::DocumentObserver::Observe(Document* aDocument) {
StopObserving();
mDocument = newDocument.forget();
mDocument = std::move(newDocument);
mDocument->AddObserver(this);
}
@ -2089,10 +2089,10 @@ void IMEContentObserver::DocumentObserver::StopObserving() {
}
// Grab IMEContentObserver which could be destroyed during method calls.
RefPtr<IMEContentObserver> observer = mIMEContentObserver.forget();
RefPtr<IMEContentObserver> observer = std::move(mIMEContentObserver);
// Stop observing the document first.
RefPtr<Document> document = mDocument.forget();
RefPtr<Document> document = std::move(mDocument);
document->RemoveObserver(this);
// Notify IMEContentObserver of ending of document updates if this already

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

@ -279,7 +279,7 @@ AlternativeDataStreamListener::OnStopRequest(nsIRequest* aRequest,
// Alternative data loading is going to finish, breaking the reference cycle
// here by taking the ownership to a loacl variable.
RefPtr<FetchDriver> fetchDriver = mFetchDriver.forget();
RefPtr<FetchDriver> fetchDriver = std::move(mFetchDriver);
if (mStatus == AlternativeDataStreamListener::CANCELED) {
// do nothing
@ -1206,7 +1206,7 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
// main data loading is going to finish, breaking the reference cycle.
RefPtr<AlternativeDataStreamListener> altDataListener =
mAltDataListener.forget();
std::move(mAltDataListener);
// We need to check mObserver, which is nulled by FailWithNetworkError(),
// because in the case of "error" redirect mode, aStatusCode may be NS_OK but

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

@ -82,7 +82,7 @@ nsresult FetchStreamReader::Create(JSContext* aCx, nsIGlobalObject* aGlobal,
// These 2 objects create a ref-cycle here that is broken when the stream is
// closed or the worker shutsdown.
streamReader->mWorkerRef = workerRef.forget();
streamReader->mWorkerRef = std::move(workerRef);
}
pipeIn.forget(aInputStream);

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

@ -273,7 +273,7 @@ class WorkerStreamOwner final {
struct Destroyer final : CancelableRunnable {
RefPtr<WorkerStreamOwner> mDoomed;
explicit Destroyer(already_AddRefed<WorkerStreamOwner>&& aDoomed)
explicit Destroyer(RefPtr<WorkerStreamOwner>&& aDoomed)
: CancelableRunnable("WorkerStreamOwner::Destroyer"),
mDoomed(std::move(aDoomed)) {}
@ -332,7 +332,8 @@ class JSStreamConsumer final : public nsIInputStreamCallback {
destroyer = new WindowStreamOwner::Destroyer(mWindowStreamOwner.forget());
} else {
MOZ_DIAGNOSTIC_ASSERT(mWorkerStreamOwner);
destroyer = new WorkerStreamOwner::Destroyer(mWorkerStreamOwner.forget());
destroyer =
new WorkerStreamOwner::Destroyer(std::move(mWorkerStreamOwner));
}
MOZ_ALWAYS_SUCCEEDS(mOwningEventTarget->Dispatch(destroyer.forget()));

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

@ -77,7 +77,7 @@ void StreamBlobImpl::CreateInputStream(nsIInputStream** aStream,
}
if (replacementStream) {
mInputStream = replacementStream.forget();
mInputStream = std::move(replacementStream);
}
nsCOMPtr<nsIInputStream> wrappedStream =

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

@ -1090,7 +1090,7 @@ void BackgroundMutableFileParentBase::Invalidate() {
if (count) {
for (uint32_t index = 0; index < count; index++) {
RefPtr<FileHandle> fileHandle = fileHandles[index].forget();
RefPtr<FileHandle> fileHandle = std::move(fileHandles[index]);
MOZ_ASSERT(fileHandle);
fileHandle->Invalidate();

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

@ -1674,7 +1674,7 @@ nsresult HTMLFormElement::GetActionURL(nsIURI** aActionURL,
nsCOMPtr<nsIURI> upgradedActionURL;
rv = NS_GetSecureUpgradedURI(actionURL, getter_AddRefs(upgradedActionURL));
NS_ENSURE_SUCCESS(rv, rv);
actionURL = upgradedActionURL.forget();
actionURL = std::move(upgradedActionURL);
// let's log a message to the console that we are upgrading a request
nsAutoCString scheme;

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

@ -3050,7 +3050,7 @@ MediaResult HTMLMediaElement::LoadResource() {
RefPtr<ChannelLoader> loader = new ChannelLoader;
nsresult rv = loader->Load(this);
if (NS_SUCCEEDED(rv)) {
mChannelLoader = loader.forget();
mChannelLoader = std::move(loader);
}
return MediaResult(rv, "Failed to load channel");
}

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

@ -15,8 +15,7 @@
nsGenericHTMLElement* NS_NewHTMLSlotElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser) {
RefPtr<mozilla::dom::NodeInfo> nodeInfo(std::move(aNodeInfo));
return new mozilla::dom::HTMLSlotElement(nodeInfo.forget());
return new mozilla::dom::HTMLSlotElement(std::move(aNodeInfo));
}
namespace mozilla {

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

@ -525,7 +525,7 @@ nsresult nsHTMLDocument::StartDocumentLoad(const char* aCommand,
docShell->GetContentViewer(getter_AddRefs(cv));
}
if (!cv) {
cv = parentContentViewer.forget();
cv = std::move(parentContentViewer);
}
nsAutoCString urlSpec;

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

@ -22498,7 +22498,7 @@ TransactionDatabaseOperationBase::TransactionDatabaseOperationBase(
RefPtr<TransactionBase> aTransaction)
: DatabaseOperationBase(aTransaction->GetLoggingInfo()->Id(),
aTransaction->GetLoggingInfo()->NextRequestSN()),
mTransaction(aTransaction.forget()),
mTransaction(std::move(aTransaction)),
mTransactionIsAborted((*mTransaction)->IsAborted()),
mTransactionLoggingSerialNumber((*mTransaction)->LoggingSerialNumber()) {
MOZ_ASSERT(LoggingSerialNumber());
@ -22508,7 +22508,7 @@ TransactionDatabaseOperationBase::TransactionDatabaseOperationBase(
RefPtr<TransactionBase> aTransaction, uint64_t aLoggingSerialNumber)
: DatabaseOperationBase(aTransaction->GetLoggingInfo()->Id(),
aLoggingSerialNumber),
mTransaction(aTransaction.forget()),
mTransaction(std::move(aTransaction)),
mTransactionIsAborted((*mTransaction)->IsAborted()),
mTransactionLoggingSerialNumber((*mTransaction)->LoggingSerialNumber()) {}

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

@ -92,7 +92,7 @@ nsresult BrowserBridgeParent::InitWithProcess(
}
// Set our BrowserParent object to the newly created browser.
mBrowserParent = browserParent.forget();
mBrowserParent = std::move(browserParent);
mBrowserParent->SetOwnerElement(Manager()->GetOwnerElement());
mBrowserParent->InitRendering();

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

@ -3825,7 +3825,7 @@ NS_IMETHODIMP BrowserChild::OnSecurityChange(nsIWebProgress* aWebProgress,
}
securityChangeData.emplace();
securityChangeData->securityInfo() = securityInfo.forget();
securityChangeData->securityInfo() = ToRefPtr(std::move(securityInfo));
securityChangeData->isSecureContext() = isSecureContext;
}

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

@ -52,7 +52,7 @@ bool ParamTraits<nsIContentSecurityPolicy*>::Read(
nsCOMPtr<nsIContentSecurityPolicy> csp = do_QueryInterface(iSupports);
NS_ENSURE_TRUE(csp, false);
*aResult = csp.forget();
*aResult = ToRefPtr(std::move(csp));
return true;
}

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

@ -80,7 +80,7 @@ void ClonedErrorHolder::Init(JSContext* aCx, JS::Handle<JSObject*> aError,
if (NS_SUCCEEDED(UNWRAP_OBJECT(DOMException, aError, domExn))) {
mType = Type::DOMException;
mCode = domExn->Code();
exn = domExn.forget();
exn = std::move(domExn);
} else if (NS_SUCCEEDED(UNWRAP_OBJECT(Exception, aError, exn))) {
mType = Type::Exception;
} else {

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

@ -55,7 +55,7 @@ struct IPDLParamTraits<nsIPrincipal*> {
if (!Read(aMsg, aIter, aActor, &result)) {
return false;
}
*aResult = result.forget();
*aResult = std::move(result);
return true;
}
};

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

@ -202,7 +202,7 @@ bool IPDLParamTraits<nsIVariant*>::Read(const Message* aMsg,
MOZ_CRASH("Non handled variant type, patch welcome");
return false;
}
*aResult = variant.forget();
*aResult = std::move(variant);
return true;
}
@ -237,11 +237,11 @@ bool IPDLParamTraits<nsIPropertyBag2*>::Read(const Message* aMsg,
auto properties = MakeRefPtr<nsHashPropertyBag>();
for (auto& entry : bag) {
nsCOMPtr<nsIVariant> variant = entry.value().forget();
nsCOMPtr<nsIVariant> variant = std::move(entry.value());
MOZ_ALWAYS_SUCCEEDS(
properties->SetProperty(std::move(entry.name()), variant));
}
*aResult = properties.forget();
*aResult = std::move(properties);
return true;
}

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

@ -45,7 +45,7 @@ bool ParamTraits<nsIReferrerInfo*>::Read(const Message* aMsg,
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsIReferrerInfo> referrerInfo = do_QueryInterface(iSupports);
NS_ENSURE_TRUE(referrerInfo, false);
*aResult = referrerInfo.forget();
*aResult = ToRefPtr(std::move(referrerInfo));
return true;
}

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

@ -1718,10 +1718,9 @@ class Datastore final
// Created by PrepareDatastoreOp.
Datastore(const nsACString& aGroup, const nsACString& aOrigin,
uint32_t aPrivateBrowsingId, int64_t aUsage, int64_t aSizeOfKeys,
int64_t aSizeOfItems,
already_AddRefed<DirectoryLock>&& aDirectoryLock,
already_AddRefed<Connection>&& aConnection,
already_AddRefed<QuotaObject>&& aQuotaObject,
int64_t aSizeOfItems, RefPtr<DirectoryLock>&& aDirectoryLock,
RefPtr<Connection>&& aConnection,
RefPtr<QuotaObject>&& aQuotaObject,
nsDataHashtable<nsStringHashKey, LSValue>& aValues,
nsTArray<LSItemInfo>& aOrderedItems);
@ -4768,9 +4767,9 @@ void ConnectionThread::Shutdown() {
Datastore::Datastore(const nsACString& aGroup, const nsACString& aOrigin,
uint32_t aPrivateBrowsingId, int64_t aUsage,
int64_t aSizeOfKeys, int64_t aSizeOfItems,
already_AddRefed<DirectoryLock>&& aDirectoryLock,
already_AddRefed<Connection>&& aConnection,
already_AddRefed<QuotaObject>&& aQuotaObject,
RefPtr<DirectoryLock>&& aDirectoryLock,
RefPtr<Connection>&& aConnection,
RefPtr<QuotaObject>&& aQuotaObject,
nsDataHashtable<nsStringHashKey, LSValue>& aValues,
nsTArray<LSItemInfo>& aOrderedItems)
: mDirectoryLock(std::move(aDirectoryLock)),
@ -7198,7 +7197,7 @@ nsresult PrepareDatastoreOp::OpenDirectory() {
MOZ_ASSERT(pendingDirectoryLock);
if (mNestedState == NestedState::DirectoryOpenPending) {
mPendingDirectoryLock = pendingDirectoryLock.forget();
mPendingDirectoryLock = std::move(pendingDirectoryLock);
}
mRequestedDirectoryLock = true;
@ -7868,10 +7867,10 @@ void PrepareDatastoreOp::GetResponse(LSRequestResponse& aResponse) {
}
}
mDatastore = new Datastore(mGroup, mOrigin, mPrivateBrowsingId, mUsage,
mSizeOfKeys, mSizeOfItems,
mDirectoryLock.forget(), mConnection.forget(),
quotaObject.forget(), mValues, mOrderedItems);
mDatastore = new Datastore(
mGroup, mOrigin, mPrivateBrowsingId, mUsage, mSizeOfKeys, mSizeOfItems,
std::move(mDirectoryLock), std::move(mConnection),
std::move(quotaObject), mValues, mOrderedItems);
mDatastore->NoteLivePrepareDatastoreOp(this);

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

@ -397,7 +397,7 @@ class AudioSegment : public MediaSegmentBase<AudioSegment, AudioChunk> {
// in the segment.
AudioChunk* AppendAndConsumeChunk(AudioChunk* aChunk) {
AudioChunk* chunk = AppendChunk(aChunk->mDuration);
chunk->mBuffer = aChunk->mBuffer.forget();
chunk->mBuffer = std::move(aChunk->mBuffer);
chunk->mChannelData.SwapElements(aChunk->mChannelData);
MOZ_ASSERT(chunk->mBuffer || aChunk->mChannelData.IsEmpty(),

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

@ -46,15 +46,15 @@ void OutputStreamDriver::EndTrack() {
}
}
void OutputStreamDriver::SetImage(const RefPtr<layers::Image>& aImage,
void OutputStreamDriver::SetImage(RefPtr<layers::Image>&& aImage,
const TimeStamp& aTime) {
MOZ_ASSERT(NS_IsMainThread());
TRACE_COMMENT("SourceMediaTrack %p", mSourceStream.get());
VideoSegment segment;
segment.AppendFrame(do_AddRef(aImage), aImage->GetSize(), mPrincipalHandle,
false, aTime);
const auto size = aImage->GetSize();
segment.AppendFrame(aImage.forget(), size, mPrincipalHandle, false, aTime);
mSourceStream->AppendData(&segment);
}
@ -92,7 +92,7 @@ class TimerDriver : public OutputStreamDriver {
}
mFrameCaptureRequested = false;
SetImage(image.forget(), aTime);
SetImage(std::move(image), aTime);
}
void Forget() override {
@ -126,7 +126,7 @@ class AutoDriver : public OutputStreamDriver {
// after something changed.
RefPtr<Image> image = aImage;
SetImage(image.forget(), aTime);
SetImage(std::move(image), aTime);
}
protected:

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

@ -70,7 +70,7 @@ class OutputStreamDriver : public FrameCaptureListener {
* Sub classes can SetImage() to update the image being appended to the
* output stream. It will be appended on the next NotifyPull from MTG.
*/
void SetImage(const RefPtr<layers::Image>& aImage, const TimeStamp& aTime);
void SetImage(RefPtr<layers::Image>&& aImage, const TimeStamp& aTime);
/*
* Ends the track in mSourceStream when we know there won't be any more images

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

@ -774,7 +774,7 @@ RefPtr<MediaCache> MediaCache::GetMediaCache(int64_t aContentLength) {
NS_WARNING("Failed to create a thread for MediaCache.");
return nullptr;
}
sThread = thread.forget();
sThread = ToRefPtr(std::move(thread));
static struct ClearThread {
// Called during shutdown to clear sThread.

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

@ -1699,7 +1699,7 @@ class MediaDecoderStateMachine::VideoOnlySeekingState
// changes.
mMaster->mOnPlaybackEvent.Notify(MediaPlaybackEvent::VideoOnlySeekBegin);
return p.forget();
return p;
}
void Exit() override {
@ -3767,7 +3767,7 @@ RefPtr<GenericPromise> MediaDecoderStateMachine::RequestDebugInfo(
AbstractThread::TailDispatch);
MOZ_DIAGNOSTIC_ASSERT(NS_SUCCEEDED(rv));
Unused << rv;
return p.forget();
return p;
}
class VideoQueueMemoryFunctor : public nsDequeFunctor {

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

@ -266,7 +266,7 @@ void MediaFormatReader::DecoderFactory::RunStage(Data& aData) {
mOwner->OwnerThread(), __func__,
[this, &aData](RefPtr<Token> aToken) {
aData.mTokenRequest.Complete();
aData.mToken = aToken.forget();
aData.mToken = std::move(aToken);
aData.mStage = Stage::CreateDecoder;
RunStage(aData);
},
@ -408,7 +408,7 @@ void MediaFormatReader::DecoderFactory::DoInitDecoder(Data& aData) {
aData.mInitRequest.Complete();
aData.mStage = Stage::None;
MutexAutoLock lock(ownerData.mMutex);
ownerData.mDecoder = aData.mDecoder.forget();
ownerData.mDecoder = std::move(aData.mDecoder);
ownerData.mDescription = ownerData.mDecoder->GetDescriptionName();
DDLOGEX2("MediaFormatReader::DecoderFactory", this,
DDLogCategory::Log, "decoder_initialized", DDNoValue{});
@ -456,7 +456,7 @@ class MediaFormatReader::DemuxerProxy {
~DemuxerProxy() { MOZ_COUNT_DTOR(DemuxerProxy); }
RefPtr<ShutdownPromise> Shutdown() {
RefPtr<Data> data = mData.forget();
RefPtr<Data> data = std::move(mData);
return InvokeAsync(mTaskQueue, __func__, [data]() {
// We need to clear our reference to the demuxer now. So that in the event
// the init promise wasn't resolved, such as what can happen with the
@ -676,7 +676,7 @@ class MediaFormatReader::DemuxerProxy::Wrapper : public MediaTrackDemuxer {
friend class DemuxerProxy;
~Wrapper() {
RefPtr<MediaTrackDemuxer> trackDemuxer = mTrackDemuxer.forget();
RefPtr<MediaTrackDemuxer> trackDemuxer = std::move(mTrackDemuxer);
nsresult rv = mTaskQueue->Dispatch(NS_NewRunnableFunction(
"MediaFormatReader::DemuxerProxy::Wrapper::~Wrapper",
[trackDemuxer]() { trackDemuxer->BreakCycles(); }));

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

@ -1970,7 +1970,7 @@ void MediaRecorder::NotifyError(nsresult aRv) {
"mSecurityDomException was not initialized"));
mSecurityDomException = DOMException::Create(NS_ERROR_DOM_SECURITY_ERR);
}
init.mError = mSecurityDomException.forget();
init.mError = std::move(mSecurityDomException);
break;
default:
if (!mUnknownDomException) {
@ -1981,7 +1981,7 @@ void MediaRecorder::NotifyError(nsresult aRv) {
LOG(LogLevel::Debug, ("MediaRecorder.NotifyError: "
"mUnknownDomException being fired for aRv: %X",
uint32_t(aRv)));
init.mError = mUnknownDomException.forget();
init.mError = std::move(mUnknownDomException);
}
RefPtr<MediaRecorderErrorEvent> event = MediaRecorderErrorEvent::Constructor(

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

@ -59,7 +59,7 @@ static nsCOMPtr<nsIAsyncShutdownClient> GetShutdownBarrier() {
}
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
MOZ_RELEASE_ASSERT(barrier);
return barrier.forget();
return barrier;
}
void MediaShutdownManager::InitStatics() {

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

@ -36,7 +36,7 @@ void VideoFrame::SetNull() {
}
void VideoFrame::TakeFrom(VideoFrame* aFrame) {
mImage = aFrame->mImage.forget();
mImage = std::move(aFrame->mImage);
mIntrinsicSize = aFrame->mIntrinsicSize;
mForceBlack = aFrame->GetForceBlack();
mPrincipalHandle = aFrame->mPrincipalHandle;

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

@ -292,7 +292,7 @@ RefPtr<GenericPromise> InvokeUntil(Work aWork, Condition aCondition) {
};
Helper::Iteration(p, aWork, aCondition);
return p.forget();
return p;
}
// Simple timer to run a runnable after a timeout.

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

@ -32,7 +32,6 @@ nsCString CDMStorageIdProvider::ComputeStorageId(const nsCString& aOriginSalt) {
std::string originSalt(aOriginSalt.BeginReading(), aOriginSalt.Length());
std::string input =
machineId + originSalt + CDMStorageIdProvider::kBrowserIdentifier;
nsAutoCString storageId;
nsresult rv;
nsCOMPtr<nsICryptoHash> hasher =
do_CreateInstance("@mozilla.org/security/hash;1", &rv);
@ -63,6 +62,7 @@ nsCString CDMStorageIdProvider::ComputeStorageId(const nsCString& aOriginSalt) {
return EmptyCString();
}
nsCString storageId;
rv = hasher->Finish(false, storageId);
if (NS_WARN_IF(NS_FAILED(rv))) {
GMP_LOG_DEBUG(
@ -71,7 +71,7 @@ nsCString CDMStorageIdProvider::ComputeStorageId(const nsCString& aOriginSalt) {
static_cast<uint32_t>(rv));
return EmptyCString();
}
return std::move(storageId);
return storageId;
#endif
}

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

@ -68,7 +68,7 @@ class GMPServiceCreateHelper final : public mozilla::Runnable {
SystemGroup::EventTargetFor(mozilla::TaskCategory::Other),
createHelper, true);
service = createHelper->mService.forget();
service = std::move(createHelper->mService);
}
return service.forget();

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

@ -1509,7 +1509,7 @@ static nsCOMPtr<nsIAsyncShutdownClient> GetShutdownBarrier() {
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
MOZ_RELEASE_ASSERT(barrier);
return barrier.forget();
return barrier;
}
NS_IMETHODIMP

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

@ -92,7 +92,7 @@ RefPtr<ShutdownPromise> RemoteMediaDataDecoder::Shutdown() {
// task queue for the *DecoderChild thread to keep
// it alive until we send the delete message.
p->Then(RemoteDecoderManagerChild::GetManagerThread(), __func__,
[child = RefPtr<IRemoteDecoderChild>(self->mChild.forget())](
[child = std::move(self->mChild)](
const ShutdownPromise::ResolveOrRejectValue& aValue) {
MOZ_ASSERT(aValue.IsResolve());
child->DestroyIPDL();

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

@ -46,7 +46,7 @@ auto AllocPolicyImpl::Alloc() -> RefPtr<Promise> {
RefPtr<PromisePrivate> p = new PromisePrivate(__func__);
mPromises.push(p);
ResolvePromise(mon);
return p.forget();
return p;
}
void AllocPolicyImpl::Dealloc() {
@ -60,7 +60,7 @@ void AllocPolicyImpl::ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock) {
if (mDecoderLimit > 0 && !mPromises.empty()) {
--mDecoderLimit;
RefPtr<PromisePrivate> p = mPromises.front().forget();
RefPtr<PromisePrivate> p = std::move(mPromises.front());
mPromises.pop();
p->Resolve(new AutoDeallocToken(this), __func__);
}
@ -69,7 +69,7 @@ void AllocPolicyImpl::ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock) {
void AllocPolicyImpl::RejectAll() {
ReentrantMonitorAutoEnter mon(mMonitor);
while (!mPromises.empty()) {
RefPtr<PromisePrivate> p = mPromises.front().forget();
RefPtr<PromisePrivate> p = std::move(mPromises.front());
mPromises.pop();
p->Reject(true, __func__);
}
@ -137,7 +137,7 @@ auto SingleAllocPolicy::Alloc() -> RefPtr<Promise> {
return AllocPolicyImpl::Alloc()->Then(
mOwnerThread, __func__,
[self](RefPtr<Token> aToken) {
RefPtr<Token> localToken = aToken.forget();
RefPtr<Token> localToken = std::move(aToken);
RefPtr<Promise> p = self->mPendingPromise.Ensure(__func__);
GlobalAllocPolicy::Instance(self->mTrack)
->Alloc()
@ -186,8 +186,8 @@ AllocationWrapper::~AllocationWrapper() {
}
RefPtr<ShutdownPromise> AllocationWrapper::Shutdown() {
RefPtr<MediaDataDecoder> decoder = mDecoder.forget();
RefPtr<Token> token = mToken.forget();
RefPtr<MediaDataDecoder> decoder = std::move(mDecoder);
RefPtr<Token> token = std::move(mToken);
return decoder->Shutdown()->Then(
AbstractThread::GetCurrent(), __func__,
[token]() { return ShutdownPromise::CreateAndResolve(true, __func__); });

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

@ -294,7 +294,7 @@ already_AddRefed<MediaDataDecoder> PDMFactory::CreateDecoderWithPDM(
// or there wasn't enough initialization data to do so (such as what can
// happen with AVC3). Otherwise, there was some problem, for example WMF
// DLLs were missing.
m = h.forget();
m = std::move(h);
} else if (aParams.mError) {
*aParams.mError = result;
}

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

@ -253,7 +253,7 @@ class EMEDecryptor : public MediaDataDecoder,
mIsShutdown = true;
mSamplesWaitingForKey->BreakCycles();
mSamplesWaitingForKey = nullptr;
RefPtr<MediaDataDecoder> decoder = mDecoder.forget();
RefPtr<MediaDataDecoder> decoder = std::move(mDecoder);
mProxy = nullptr;
return decoder->Shutdown();
});

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

@ -412,7 +412,7 @@ RefPtr<ShutdownPromise> MediaChangeMonitor::Shutdown() {
if (mShutdownPromise) {
// We have a shutdown in progress, return that promise instead as we can't
// shutdown a decoder twice.
RefPtr<ShutdownPromise> p = mShutdownPromise.forget();
RefPtr<ShutdownPromise> p = std::move(mShutdownPromise);
return p;
}
return ShutdownDecoder();
@ -424,7 +424,7 @@ RefPtr<ShutdownPromise> MediaChangeMonitor::ShutdownDecoder() {
return InvokeAsync(mTaskQueue, __func__, [self, this]() {
mConversionRequired.reset();
if (mDecoder) {
RefPtr<MediaDataDecoder> decoder = mDecoder.forget();
RefPtr<MediaDataDecoder> decoder = std::move(mDecoder);
return decoder->Shutdown();
}
return ShutdownPromise::CreateAndResolve(true, __func__);

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

@ -158,7 +158,7 @@ void AudioBlock::AllocateChannels(uint32_t aChannelCount) {
for (uint32_t i = 0; i < aChannelCount; ++i) {
mChannelData[i] = buffer->ChannelData(i);
}
mBuffer = buffer.forget();
mBuffer = std::move(buffer);
mVolume = 1.0f;
mBufferFormat = AUDIO_FORMAT_FLOAT32;
}

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

@ -209,7 +209,7 @@ void AudioBuffer::SetSharedChannels(
for (uint32_t i = 0; i < channelCount; ++i) {
mSharedChannels.mChannelData[i] = buffer->GetData(i);
}
mSharedChannels.mBuffer = buffer.forget();
mSharedChannels.mBuffer = std::move(buffer);
mSharedChannels.mBufferFormat = AUDIO_FORMAT_FLOAT32;
}

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

@ -168,7 +168,7 @@ void AudioNode::DisconnectFromGraph() {
while (!mOutputNodes.IsEmpty()) {
size_t i = mOutputNodes.Length() - 1;
RefPtr<AudioNode> output = mOutputNodes[i].forget();
RefPtr<AudioNode> output = std::move(mOutputNodes[i]);
mOutputNodes.RemoveElementAt(i);
size_t inputIndex = FindIndexOfNode(output->mInputNodes, this);
// It doesn't matter which one we remove, since we're going to remove all
@ -180,7 +180,7 @@ void AudioNode::DisconnectFromGraph() {
while (!mOutputParams.IsEmpty()) {
size_t i = mOutputParams.Length() - 1;
RefPtr<AudioParam> output = mOutputParams[i].forget();
RefPtr<AudioParam> output = std::move(mOutputParams[i]);
mOutputParams.RemoveElementAt(i);
size_t inputIndex = FindIndexOfNode(output->InputNodes(), this);
// It doesn't matter which one we remove, since we're going to remove all
@ -336,7 +336,7 @@ bool AudioNode::DisconnectFromOutputIfConnected<AudioNode>(
// Remove one instance of 'dest' from mOutputNodes. There could be
// others, and it's not correct to remove them all since some of them
// could be for different output ports.
RefPtr<AudioNode> output = mOutputNodes[aOutputNodeIndex].forget();
RefPtr<AudioNode> output = std::move(mOutputNodes[aOutputNodeIndex]);
mOutputNodes.RemoveElementAt(aOutputNodeIndex);
// Destroying the InputNode here sends a message to the graph thread
// to disconnect the tracks, which should be sent before the

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

@ -504,7 +504,7 @@ void MediaDecodeTask::FinishDecode() {
data += resampledFrames;
}
#endif
mDecodeJob.mBuffer.mBuffer = buffer.forget();
mDecodeJob.mBuffer.mBuffer = std::move(buffer);
mDecodeJob.mBuffer.mVolume = 1.0f;
mDecodeJob.mBuffer.mBufferFormat = AUDIO_OUTPUT_FORMAT;

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

@ -114,7 +114,7 @@ class WebMPacketQueue {
}
already_AddRefed<NesteggPacketHolder> PopFront() {
RefPtr<NesteggPacketHolder> result = mQueue.front().forget();
RefPtr<NesteggPacketHolder> result = std::move(mQueue.front());
mQueue.pop_front();
return result.forget();
}

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

@ -47,13 +47,13 @@ class MediaRawDataQueue {
}
already_AddRefed<MediaRawData> PopFront() {
RefPtr<MediaRawData> result = mQueue.front().forget();
RefPtr<MediaRawData> result = std::move(mQueue.front());
mQueue.pop_front();
return result.forget();
}
already_AddRefed<MediaRawData> Pop() {
RefPtr<MediaRawData> result = mQueue.back().forget();
RefPtr<MediaRawData> result = std::move(mQueue.back());
mQueue.pop_back();
return result.forget();
}

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

@ -94,7 +94,7 @@ bool MIDIAccessManager::AddObserver(Observer<MIDIPortList>* aObserver) {
return false;
}
MOZ_ASSERT(constructedMgr == mgr);
mChild = mgr.forget();
mChild = std::move(mgr);
// Add a ref to mChild here, that will be deref'd by
// BackgroundChildImpl::DeallocPMIDIManagerChild on IPC cleanup.
mChild->SetActorAlive();

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

@ -1717,7 +1717,7 @@ class WorkerGetCallback final : public ScopeCheckingGetCallback {
AssertIsOnMainThread();
MOZ_ASSERT(mPromiseProxy, "Was Done() called twice?");
RefPtr<PromiseWorkerProxy> proxy = mPromiseProxy.forget();
RefPtr<PromiseWorkerProxy> proxy = std::move(mPromiseProxy);
MutexAutoLock lock(proxy->Lock());
if (proxy->CleanedUp()) {
return NS_OK;

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

@ -171,7 +171,7 @@ nsresult PaymentDetailsModifier::Create(
return rv;
}
}
displayItems = items.forget();
displayItems = std::move(items);
}
nsCOMPtr<nsIPaymentDetailsModifier> modifier =
new PaymentDetailsModifier(aIPCModifier.supportedMethods(), total,
@ -322,7 +322,7 @@ nsresult PaymentDetails::Create(const IPCPaymentDetails& aIPCDetails,
return rv;
}
}
displayItems = items.forget();
displayItems = std::move(items);
nsCOMPtr<nsIArray> shippingOptions;
nsCOMPtr<nsIMutableArray> options = do_CreateInstance(NS_ARRAY_CONTRACTID);
@ -339,7 +339,7 @@ nsresult PaymentDetails::Create(const IPCPaymentDetails& aIPCDetails,
return rv;
}
}
shippingOptions = options.forget();
shippingOptions = std::move(options);
nsCOMPtr<nsIArray> modifiers;
nsCOMPtr<nsIMutableArray> detailsModifiers =
@ -357,7 +357,7 @@ nsresult PaymentDetails::Create(const IPCPaymentDetails& aIPCDetails,
return rv;
}
}
modifiers = detailsModifiers.forget();
modifiers = std::move(detailsModifiers);
nsCOMPtr<nsIPaymentDetails> details = new PaymentDetails(
aIPCDetails.id(), total, displayItems, shippingOptions, modifiers,

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

@ -1028,7 +1028,7 @@ nsresult PresentationControllingInfo::NotifyReconnectResult(nsresult aStatus) {
mIsReconnecting = false;
nsCOMPtr<nsIPresentationServiceCallback> callback =
mReconnectCallback.forget();
std::move(mReconnectCallback);
if (NS_FAILED(aStatus)) {
return callback->NotifyError(aStatus);
}

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

@ -378,14 +378,14 @@ class PromiseNativeHandlerShim final : public PromiseNativeHandler {
MOZ_CAN_RUN_SCRIPT
void ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override {
RefPtr<PromiseNativeHandler> inner = mInner.forget();
RefPtr<PromiseNativeHandler> inner = std::move(mInner);
inner->ResolvedCallback(aCx, aValue);
MOZ_ASSERT(!mInner);
}
MOZ_CAN_RUN_SCRIPT
void RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override {
RefPtr<PromiseNativeHandler> inner = mInner.forget();
RefPtr<PromiseNativeHandler> inner = std::move(mInner);
inner->RejectedCallback(aCx, aValue);
MOZ_ASSERT(!mInner);
}

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

@ -94,7 +94,7 @@ nsresult GetSubscriptionParams(nsIPushSubscription* aSubscription,
class GetSubscriptionResultRunnable final : public WorkerRunnable {
public:
GetSubscriptionResultRunnable(WorkerPrivate* aWorkerPrivate,
already_AddRefed<PromiseWorkerProxy>&& aProxy,
RefPtr<PromiseWorkerProxy>&& aProxy,
nsresult aStatus, const nsAString& aEndpoint,
const nsAString& aScope,
nsTArray<uint8_t>&& aRawP256dhKey,
@ -171,7 +171,7 @@ class GetSubscriptionCallback final : public nsIPushSubscriptionCallback {
WorkerPrivate* worker = mProxy->GetWorkerPrivate();
RefPtr<GetSubscriptionResultRunnable> r = new GetSubscriptionResultRunnable(
worker, mProxy.forget(), aStatus, endpoint, mScope,
worker, std::move(mProxy), aStatus, endpoint, mScope,
std::move(rawP256dhKey), std::move(authSecret),
std::move(appServerKey));
MOZ_ALWAYS_TRUE(r->Dispatch());

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

@ -55,7 +55,7 @@ NS_IMPL_ISUPPORTS(UnsubscribeResultCallback, nsIUnsubscribeResultCallback)
class UnsubscribeResultRunnable final : public WorkerRunnable {
public:
UnsubscribeResultRunnable(WorkerPrivate* aWorkerPrivate,
already_AddRefed<PromiseWorkerProxy>&& aProxy,
RefPtr<PromiseWorkerProxy>&& aProxy,
nsresult aStatus, bool aSuccess)
: WorkerRunnable(aWorkerPrivate),
mProxy(std::move(aProxy)),
@ -110,7 +110,7 @@ class WorkerUnsubscribeResultCallback final
WorkerPrivate* worker = mProxy->GetWorkerPrivate();
RefPtr<UnsubscribeResultRunnable> r = new UnsubscribeResultRunnable(
worker, mProxy.forget(), aStatus, aSuccess);
worker, std::move(mProxy), aStatus, aSuccess);
MOZ_ALWAYS_TRUE(r->Dispatch());
return NS_OK;

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

@ -2028,8 +2028,8 @@ NotifyOffThreadScriptLoadCompletedRunnable::Run() {
// We want these to be dropped on the main thread, once we return from this
// function.
RefPtr<ScriptLoadRequest> request = mRequest.forget();
RefPtr<ScriptLoader> loader = mLoader.forget();
RefPtr<ScriptLoadRequest> request = std::move(mRequest);
RefPtr<ScriptLoader> loader = std::move(mLoader);
request->mOffThreadToken = mToken;
nsresult rv = loader->ProcessOffThreadRequest(request);

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

@ -48,7 +48,7 @@ void DOMSecurityManager::Initialize() {
obs->AddObserver(service, NS_HTTP_ON_EXAMINE_RESPONSE_TOPIC, false);
obs->AddObserver(service, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
gDOMSecurityManager = service.forget();
gDOMSecurityManager = std::move(service);
}
/* static */

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

@ -307,12 +307,12 @@ bool IPDLParamTraits<dom::FeaturePolicy*>::Read(
nsString declaredString = info.declaredString();
if (declaredString.IsEmpty() || !info.selfOrigin()) {
*aResult = featurePolicy.forget();
*aResult = std::move(featurePolicy);
return true;
}
featurePolicy->SetDeclaredPolicy(nullptr, declaredString, info.selfOrigin(),
info.srcOrigin());
*aResult = featurePolicy.forget();
*aResult = std::move(featurePolicy);
return true;
}
} // namespace ipc

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

@ -180,7 +180,7 @@ void ServiceWorkerContainer::ReceiveMessage(
const ClientPostMessageArgs& aArgs) {
RefPtr<ReceivedMessage> message = new ReceivedMessage(aArgs);
if (mMessagesStarted) {
EnqueueReceivedMessageDispatch(message.forget());
EnqueueReceivedMessageDispatch(std::move(message));
} else {
mPendingMessages.AppendElement(message.forget());
}
@ -287,13 +287,13 @@ already_AddRefed<Promise> ServiceWorkerContainer::Register(
if (aRv.Failed()) {
return nullptr;
}
scriptURI = cloneWithoutRef.forget();
scriptURI = std::move(cloneWithoutRef);
aRv = NS_GetURIWithoutRef(scopeURI, getter_AddRefs(cloneWithoutRef));
if (aRv.Failed()) {
return nullptr;
}
scopeURI = cloneWithoutRef.forget();
scopeURI = std::move(cloneWithoutRef);
ServiceWorkerScopeAndScriptAreValid(clientInfo.ref(), scopeURI, scriptURI,
aRv);

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

@ -392,7 +392,7 @@ RefPtr<GenericErrorResultPromise> ServiceWorkerManager::StartControllingClient(
auto entry = mControlledClients.LookupForAdd(aClientInfo.Id());
if (entry) {
RefPtr<ServiceWorkerRegistrationInfo> old =
entry.Data()->mRegistrationInfo.forget();
std::move(entry.Data()->mRegistrationInfo);
if (aControlClientHandle) {
promise = entry.Data()->mClientHandle->Control(active);
@ -468,7 +468,7 @@ void ServiceWorkerManager::StopControllingClient(
}
RefPtr<ServiceWorkerRegistrationInfo> reg =
entry.Data()->mRegistrationInfo.forget();
std::move(entry.Data()->mRegistrationInfo);
entry.Remove();

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

@ -106,7 +106,7 @@ ServiceWorkerPrivate::ServiceWorkerPrivate(ServiceWorkerInfo* aInfo)
MOZ_ALWAYS_SUCCEEDS(inner->Initialize());
#endif
mInner = inner.forget();
mInner = std::move(inner);
}
}
@ -1798,7 +1798,8 @@ void ServiceWorkerPrivate::TerminateWorker() {
}
Unused << NS_WARN_IF(!mWorkerPrivate->Cancel());
RefPtr<WorkerPrivate> workerPrivate(mWorkerPrivate.forget());
RefPtr<WorkerPrivate> workerPrivate = std::move(mWorkerPrivate);
mozilla::Unused << workerPrivate;
mSupportsArray.Clear();
// Any pending events are never going to fire on this worker. Cancel
@ -1869,7 +1870,7 @@ void ServiceWorkerPrivate::UpdateState(ServiceWorkerState aState) {
mPendingFunctionalEvents.SwapElements(pendingEvents);
for (uint32_t i = 0; i < pendingEvents.Length(); ++i) {
RefPtr<WorkerRunnable> r = pendingEvents[i].forget();
RefPtr<WorkerRunnable> r = std::move(pendingEvents[i]);
if (NS_WARN_IF(!r->Dispatch())) {
NS_WARNING("Failed to dispatch pending functional event!");
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше