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, bool nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
PivotMoveReason aReason, PivotMoveReason aReason,
bool aIsFromUserInput) { bool aIsFromUserInput) {
RefPtr<Accessible> oldPosition = mPosition.forget(); RefPtr<Accessible> oldPosition = std::move(mPosition);
mPosition = aPosition; mPosition = aPosition;
int32_t oldStart = mStartOffset, oldEnd = mEndOffset; int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
mStartOffset = mEndOffset = -1; mStartOffset = mEndOffset = -1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1727,7 +1727,7 @@ void Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag) {
} else if (!mFinishNotificationTask) { } else if (!mFinishNotificationTask) {
RefPtr<MicroTaskRunnable> runnable = new AsyncFinishNotification(this); RefPtr<MicroTaskRunnable> runnable = new AsyncFinishNotification(this);
context->DispatchToMicroTask(do_AddRef(runnable)); 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; mBodyConsumed = true;
MOZ_ASSERT(mConsumePromise); MOZ_ASSERT(mConsumePromise);
RefPtr<Promise> localPromise = mConsumePromise.forget(); RefPtr<Promise> localPromise = std::move(mConsumePromise);
RefPtr<BodyConsumer> self = this; RefPtr<BodyConsumer> self = this;
auto autoReleaseObject = auto autoReleaseObject =
@ -751,7 +751,7 @@ void BodyConsumer::ContinueConsumeBlobBody(BlobImpl* aBlobImpl,
mBodyConsumed = true; mBodyConsumed = true;
MOZ_ASSERT(mConsumePromise); MOZ_ASSERT(mConsumePromise);
RefPtr<Promise> localPromise = mConsumePromise.forget(); RefPtr<Promise> localPromise = std::move(mConsumePromise);
if (!aShuttingDown) { if (!aShuttingDown) {
RefPtr<dom::Blob> blob = dom::Blob::Create(mGlobal, aBlobImpl); 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. // 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 // The cycle is broken when the stream is closed or the worker begins
// shutting down. // shutting down.
stream->mWorkerRef = workerRef.forget(); stream->mWorkerRef = std::move(workerRef);
} }
aRv.MightThrowJSException(); aRv.MightThrowJSException();

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

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

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

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

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

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

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

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

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

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

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

@ -134,7 +134,7 @@ already_AddRefed<ResizeObserver> ResizeObserver::Constructor(
return nullptr; 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, void ResizeObserver::Observe(Element& aTarget,
@ -306,7 +306,7 @@ void ResizeObserverEntry::SetContentRectAndSize(const nsSize& aSize) {
nsRect rect(nsPoint(padding.left, padding.top), aSize); nsRect rect(nsPoint(padding.left, padding.top), aSize);
RefPtr<DOMRect> contentRect = new DOMRect(this); RefPtr<DOMRect> contentRect = new DOMRect(this);
contentRect->SetLayoutRect(rect); contentRect->SetLayoutRect(rect);
mContentRect = contentRect.forget(); mContentRect = std::move(contentRect);
// 2. Update mContentBoxSize. // 2. Update mContentBoxSize.
const WritingMode wm = frame ? frame->GetWritingMode() : WritingMode(); 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_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserver) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserver)
ResizeObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner, ResizeObserver(nsCOMPtr<nsPIDOMWindowInner>&& aOwner, Document* aDocument,
Document* aDocument, ResizeObserverCallback& aCb) ResizeObserverCallback& aCb)
: mOwner(aOwner), mDocument(aDocument), mCallback(&aCb) { : mOwner(std::move(aOwner)), mDocument(aDocument), mCallback(&aCb) {
MOZ_ASSERT(mOwner, "Need a non-null owner window"); MOZ_ASSERT(mOwner, "Need a non-null owner window");
MOZ_ASSERT(mDocument, "Need a non-null doc"); MOZ_ASSERT(mDocument, "Need a non-null doc");
MOZ_ASSERT(mDocument == mOwner->GetExtantDoc()); MOZ_ASSERT(mDocument == mOwner->GetExtantDoc());

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

@ -138,7 +138,7 @@ void SelectionChangeEventDispatcher::OnSelectionChange(Document* aDoc,
root = root->GetParent(); 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| // global scope is still allowed, since |var| only looks up |own|
// properties. But unqualified shadowing will fail, per-spec. // properties. But unqualified shadowing will fail, per-spec.
JS::Rooted<JS::Value> v(aCx); JS::Rooted<JS::Value> v(aCx);
if (!ToJSValue(aCx, WindowProxyHolder(child.forget()), &v)) { if (!ToJSValue(aCx, WindowProxyHolder(std::move(child)), &v)) {
return false; return false;
} }
FillPropertyDescriptor(aDesc, aProxy, 0, v); FillPropertyDescriptor(aDesc, aProxy, 0, v);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -2079,7 +2079,7 @@ void IMEContentObserver::DocumentObserver::Observe(Document* aDocument) {
StopObserving(); StopObserving();
mDocument = newDocument.forget(); mDocument = std::move(newDocument);
mDocument->AddObserver(this); mDocument->AddObserver(this);
} }
@ -2089,10 +2089,10 @@ void IMEContentObserver::DocumentObserver::StopObserving() {
} }
// Grab IMEContentObserver which could be destroyed during method calls. // 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. // Stop observing the document first.
RefPtr<Document> document = mDocument.forget(); RefPtr<Document> document = std::move(mDocument);
document->RemoveObserver(this); document->RemoveObserver(this);
// Notify IMEContentObserver of ending of document updates if this already // 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 // Alternative data loading is going to finish, breaking the reference cycle
// here by taking the ownership to a loacl variable. // here by taking the ownership to a loacl variable.
RefPtr<FetchDriver> fetchDriver = mFetchDriver.forget(); RefPtr<FetchDriver> fetchDriver = std::move(mFetchDriver);
if (mStatus == AlternativeDataStreamListener::CANCELED) { if (mStatus == AlternativeDataStreamListener::CANCELED) {
// do nothing // do nothing
@ -1206,7 +1206,7 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) {
// main data loading is going to finish, breaking the reference cycle. // main data loading is going to finish, breaking the reference cycle.
RefPtr<AlternativeDataStreamListener> altDataListener = RefPtr<AlternativeDataStreamListener> altDataListener =
mAltDataListener.forget(); std::move(mAltDataListener);
// We need to check mObserver, which is nulled by FailWithNetworkError(), // We need to check mObserver, which is nulled by FailWithNetworkError(),
// because in the case of "error" redirect mode, aStatusCode may be NS_OK but // 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 // These 2 objects create a ref-cycle here that is broken when the stream is
// closed or the worker shutsdown. // closed or the worker shutsdown.
streamReader->mWorkerRef = workerRef.forget(); streamReader->mWorkerRef = std::move(workerRef);
} }
pipeIn.forget(aInputStream); pipeIn.forget(aInputStream);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -397,7 +397,7 @@ class AudioSegment : public MediaSegmentBase<AudioSegment, AudioChunk> {
// in the segment. // in the segment.
AudioChunk* AppendAndConsumeChunk(AudioChunk* aChunk) { AudioChunk* AppendAndConsumeChunk(AudioChunk* aChunk) {
AudioChunk* chunk = AppendChunk(aChunk->mDuration); AudioChunk* chunk = AppendChunk(aChunk->mDuration);
chunk->mBuffer = aChunk->mBuffer.forget(); chunk->mBuffer = std::move(aChunk->mBuffer);
chunk->mChannelData.SwapElements(aChunk->mChannelData); chunk->mChannelData.SwapElements(aChunk->mChannelData);
MOZ_ASSERT(chunk->mBuffer || aChunk->mChannelData.IsEmpty(), 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) { const TimeStamp& aTime) {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
TRACE_COMMENT("SourceMediaTrack %p", mSourceStream.get()); TRACE_COMMENT("SourceMediaTrack %p", mSourceStream.get());
VideoSegment segment; VideoSegment segment;
segment.AppendFrame(do_AddRef(aImage), aImage->GetSize(), mPrincipalHandle, const auto size = aImage->GetSize();
false, aTime); segment.AppendFrame(aImage.forget(), size, mPrincipalHandle, false, aTime);
mSourceStream->AppendData(&segment); mSourceStream->AppendData(&segment);
} }
@ -92,7 +92,7 @@ class TimerDriver : public OutputStreamDriver {
} }
mFrameCaptureRequested = false; mFrameCaptureRequested = false;
SetImage(image.forget(), aTime); SetImage(std::move(image), aTime);
} }
void Forget() override { void Forget() override {
@ -126,7 +126,7 @@ class AutoDriver : public OutputStreamDriver {
// after something changed. // after something changed.
RefPtr<Image> image = aImage; RefPtr<Image> image = aImage;
SetImage(image.forget(), aTime); SetImage(std::move(image), aTime);
} }
protected: protected:

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

@ -70,7 +70,7 @@ class OutputStreamDriver : public FrameCaptureListener {
* Sub classes can SetImage() to update the image being appended to the * Sub classes can SetImage() to update the image being appended to the
* output stream. It will be appended on the next NotifyPull from MTG. * 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 * 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."); NS_WARNING("Failed to create a thread for MediaCache.");
return nullptr; return nullptr;
} }
sThread = thread.forget(); sThread = ToRefPtr(std::move(thread));
static struct ClearThread { static struct ClearThread {
// Called during shutdown to clear sThread. // Called during shutdown to clear sThread.

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

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

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

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

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

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

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

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

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

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

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

@ -292,7 +292,7 @@ RefPtr<GenericPromise> InvokeUntil(Work aWork, Condition aCondition) {
}; };
Helper::Iteration(p, aWork, aCondition); Helper::Iteration(p, aWork, aCondition);
return p.forget(); return p;
} }
// Simple timer to run a runnable after a timeout. // 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 originSalt(aOriginSalt.BeginReading(), aOriginSalt.Length());
std::string input = std::string input =
machineId + originSalt + CDMStorageIdProvider::kBrowserIdentifier; machineId + originSalt + CDMStorageIdProvider::kBrowserIdentifier;
nsAutoCString storageId;
nsresult rv; nsresult rv;
nsCOMPtr<nsICryptoHash> hasher = nsCOMPtr<nsICryptoHash> hasher =
do_CreateInstance("@mozilla.org/security/hash;1", &rv); do_CreateInstance("@mozilla.org/security/hash;1", &rv);
@ -63,6 +62,7 @@ nsCString CDMStorageIdProvider::ComputeStorageId(const nsCString& aOriginSalt) {
return EmptyCString(); return EmptyCString();
} }
nsCString storageId;
rv = hasher->Finish(false, storageId); rv = hasher->Finish(false, storageId);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
GMP_LOG_DEBUG( GMP_LOG_DEBUG(
@ -71,7 +71,7 @@ nsCString CDMStorageIdProvider::ComputeStorageId(const nsCString& aOriginSalt) {
static_cast<uint32_t>(rv)); static_cast<uint32_t>(rv));
return EmptyCString(); return EmptyCString();
} }
return std::move(storageId); return storageId;
#endif #endif
} }

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

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

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

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

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

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

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

@ -46,7 +46,7 @@ auto AllocPolicyImpl::Alloc() -> RefPtr<Promise> {
RefPtr<PromisePrivate> p = new PromisePrivate(__func__); RefPtr<PromisePrivate> p = new PromisePrivate(__func__);
mPromises.push(p); mPromises.push(p);
ResolvePromise(mon); ResolvePromise(mon);
return p.forget(); return p;
} }
void AllocPolicyImpl::Dealloc() { void AllocPolicyImpl::Dealloc() {
@ -60,7 +60,7 @@ void AllocPolicyImpl::ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock) {
if (mDecoderLimit > 0 && !mPromises.empty()) { if (mDecoderLimit > 0 && !mPromises.empty()) {
--mDecoderLimit; --mDecoderLimit;
RefPtr<PromisePrivate> p = mPromises.front().forget(); RefPtr<PromisePrivate> p = std::move(mPromises.front());
mPromises.pop(); mPromises.pop();
p->Resolve(new AutoDeallocToken(this), __func__); p->Resolve(new AutoDeallocToken(this), __func__);
} }
@ -69,7 +69,7 @@ void AllocPolicyImpl::ResolvePromise(ReentrantMonitorAutoEnter& aProofOfLock) {
void AllocPolicyImpl::RejectAll() { void AllocPolicyImpl::RejectAll() {
ReentrantMonitorAutoEnter mon(mMonitor); ReentrantMonitorAutoEnter mon(mMonitor);
while (!mPromises.empty()) { while (!mPromises.empty()) {
RefPtr<PromisePrivate> p = mPromises.front().forget(); RefPtr<PromisePrivate> p = std::move(mPromises.front());
mPromises.pop(); mPromises.pop();
p->Reject(true, __func__); p->Reject(true, __func__);
} }
@ -137,7 +137,7 @@ auto SingleAllocPolicy::Alloc() -> RefPtr<Promise> {
return AllocPolicyImpl::Alloc()->Then( return AllocPolicyImpl::Alloc()->Then(
mOwnerThread, __func__, mOwnerThread, __func__,
[self](RefPtr<Token> aToken) { [self](RefPtr<Token> aToken) {
RefPtr<Token> localToken = aToken.forget(); RefPtr<Token> localToken = std::move(aToken);
RefPtr<Promise> p = self->mPendingPromise.Ensure(__func__); RefPtr<Promise> p = self->mPendingPromise.Ensure(__func__);
GlobalAllocPolicy::Instance(self->mTrack) GlobalAllocPolicy::Instance(self->mTrack)
->Alloc() ->Alloc()
@ -186,8 +186,8 @@ AllocationWrapper::~AllocationWrapper() {
} }
RefPtr<ShutdownPromise> AllocationWrapper::Shutdown() { RefPtr<ShutdownPromise> AllocationWrapper::Shutdown() {
RefPtr<MediaDataDecoder> decoder = mDecoder.forget(); RefPtr<MediaDataDecoder> decoder = std::move(mDecoder);
RefPtr<Token> token = mToken.forget(); RefPtr<Token> token = std::move(mToken);
return decoder->Shutdown()->Then( return decoder->Shutdown()->Then(
AbstractThread::GetCurrent(), __func__, AbstractThread::GetCurrent(), __func__,
[token]() { return ShutdownPromise::CreateAndResolve(true, __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 // 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 // happen with AVC3). Otherwise, there was some problem, for example WMF
// DLLs were missing. // DLLs were missing.
m = h.forget(); m = std::move(h);
} else if (aParams.mError) { } else if (aParams.mError) {
*aParams.mError = result; *aParams.mError = result;
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -378,14 +378,14 @@ class PromiseNativeHandlerShim final : public PromiseNativeHandler {
MOZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT
void ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override { 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); inner->ResolvedCallback(aCx, aValue);
MOZ_ASSERT(!mInner); MOZ_ASSERT(!mInner);
} }
MOZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT
void RejectedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override { 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); inner->RejectedCallback(aCx, aValue);
MOZ_ASSERT(!mInner); MOZ_ASSERT(!mInner);
} }

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

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

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

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

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

@ -2028,8 +2028,8 @@ NotifyOffThreadScriptLoadCompletedRunnable::Run() {
// We want these to be dropped on the main thread, once we return from this // We want these to be dropped on the main thread, once we return from this
// function. // function.
RefPtr<ScriptLoadRequest> request = mRequest.forget(); RefPtr<ScriptLoadRequest> request = std::move(mRequest);
RefPtr<ScriptLoader> loader = mLoader.forget(); RefPtr<ScriptLoader> loader = std::move(mLoader);
request->mOffThreadToken = mToken; request->mOffThreadToken = mToken;
nsresult rv = loader->ProcessOffThreadRequest(request); 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_HTTP_ON_EXAMINE_RESPONSE_TOPIC, false);
obs->AddObserver(service, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); obs->AddObserver(service, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
gDOMSecurityManager = service.forget(); gDOMSecurityManager = std::move(service);
} }
/* static */ /* static */

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

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

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

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

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

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

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

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

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