Skip to content

Commit b50347f

Browse files
committed
Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980 --HG-- extra : moz-landing-system : lando
1 parent 9211d26 commit b50347f

File tree

251 files changed

+512
-500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+512
-500
lines changed

accessible/base/nsAccessiblePivot.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ bool nsAccessiblePivot::IsDescendantOf(Accessible* aAccessible,
398398
bool nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
399399
PivotMoveReason aReason,
400400
bool aIsFromUserInput) {
401-
RefPtr<Accessible> oldPosition = mPosition.forget();
401+
RefPtr<Accessible> oldPosition = std::move(mPosition);
402402
mPosition = aPosition;
403403
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
404404
mStartOffset = mEndOffset = -1;

docshell/base/BrowsingContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ bool IPDLParamTraits<dom::BrowsingContext*>::Read(
15621562
browsingContext.get()->Release();
15631563
}
15641564

1565-
*aResult = browsingContext.forget();
1565+
*aResult = std::move(browsingContext);
15661566
return true;
15671567
}
15681568

docshell/base/CanonicalBrowsingContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ CanonicalBrowsingContext::ChangeFrameRemoteness(const nsAString& aRemoteType,
490490
change->Complete(aContentParent);
491491
},
492492
[change](nsresult aRv) { change->Cancel(aRv); });
493-
return promise.forget();
493+
return promise;
494494
}
495495

496496
already_AddRefed<Promise> CanonicalBrowsingContext::ChangeFrameRemoteness(

docshell/base/WindowContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ bool IPDLParamTraits<dom::WindowContext*>::Read(
214214
windowContext.get()->Release();
215215
}
216216

217-
*aResult = windowContext.forget();
217+
*aResult = std::move(windowContext);
218218
return true;
219219
}
220220

docshell/base/nsDefaultURIFixup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
428428
}
429429

430430
nsCOMPtr<nsIURI> temp = DeserializeURI(uri);
431-
info->mPreferredURI = temp.forget();
431+
info->mPreferredURI = std::move(temp);
432432
return NS_OK;
433433
}
434434

docshell/base/nsDocShellEditorData.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ nsDocShellEditorData::~nsDocShellEditorData() { TearDownEditor(); }
2626

2727
void nsDocShellEditorData::TearDownEditor() {
2828
if (mHTMLEditor) {
29-
RefPtr<HTMLEditor> htmlEditor = mHTMLEditor.forget();
29+
RefPtr<HTMLEditor> htmlEditor = std::move(mHTMLEditor);
3030
htmlEditor->PreDestroy(false);
3131
}
3232
mEditingSession = nullptr;
@@ -43,7 +43,7 @@ nsresult nsDocShellEditorData::MakeEditable(bool aInWaitForUriLoad) {
4343
if (mHTMLEditor) {
4444
NS_WARNING("Destroying existing editor on frame");
4545

46-
RefPtr<HTMLEditor> htmlEditor = mHTMLEditor.forget();
46+
RefPtr<HTMLEditor> htmlEditor = std::move(mHTMLEditor);
4747
htmlEditor->PreDestroy(false);
4848
}
4949

@@ -72,7 +72,7 @@ nsresult nsDocShellEditorData::SetHTMLEditor(HTMLEditor* aHTMLEditor) {
7272
}
7373

7474
if (mHTMLEditor) {
75-
RefPtr<HTMLEditor> htmlEditor = mHTMLEditor.forget();
75+
RefPtr<HTMLEditor> htmlEditor = std::move(mHTMLEditor);
7676
htmlEditor->PreDestroy(false);
7777
MOZ_ASSERT(!mHTMLEditor,
7878
"Nested call of nsDocShellEditorData::SetHTMLEditor() detected");

docshell/shistory/MaybeNewPSHEntry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ bool IPDLParamTraits<dom::CrossProcessSHEntry*>::Read(
8888
newEntry.mSharedID);
8989
dom::ContentChild::GetSingleton()->BindPSHEntryEndpoint(
9090
std::move(newEntry.mEndpoint), do_AddRef(entry).take());
91-
*aEntry = entry.forget();
91+
*aEntry = std::move(entry);
9292
return true;
9393
});
9494
}

docshell/shistory/SHistoryParent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ bool SHistoryParent::RecvFindEntryForBFCache(
232232
*aEntry = nullptr;
233233
*aIndex = -1;
234234
} else {
235-
*aEntry = shEntry.forget();
235+
*aEntry = std::move(shEntry);
236236
*aIndex = i;
237237
}
238238

docshell/shistory/nsSHistory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ nsresult nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
15801580
nsCOMPtr<nsIContentSecurityPolicy> csp = aFrameEntry->GetCsp();
15811581
loadState->SetCsp(csp);
15821582

1583-
aLoadResult.mLoadState = loadState.forget();
1583+
aLoadResult.mLoadState = std::move(loadState);
15841584

15851585
return NS_OK;
15861586
}

dom/animation/Animation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ void Animation::DoFinishNotification(SyncNotifyFlag aSyncNotifyFlag) {
17271727
} else if (!mFinishNotificationTask) {
17281728
RefPtr<MicroTaskRunnable> runnable = new AsyncFinishNotification(this);
17291729
context->DispatchToMicroTask(do_AddRef(runnable));
1730-
mFinishNotificationTask = runnable.forget();
1730+
mFinishNotificationTask = std::move(runnable);
17311731
}
17321732
}
17331733

0 commit comments

Comments
 (0)