mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 07:45:30 +00:00
Bug 1610386 - Remove nsAutoPtr usage from docshell/. r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D60454 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c0aff2f5ef
commit
ac2d94a930
@ -162,7 +162,6 @@
|
||||
|
||||
#include "nsArray.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsContentDLF.h"
|
||||
#include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...)
|
||||
@ -6795,7 +6794,7 @@ void nsDocShell::ReattachEditorToWindow(nsISHEntry* aSHEntry) {
|
||||
return;
|
||||
}
|
||||
|
||||
mEditorData = aSHEntry->ForgetEditorData();
|
||||
mEditorData = WrapUnique(aSHEntry->ForgetEditorData());
|
||||
if (mEditorData) {
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
@ -6824,7 +6823,7 @@ void nsDocShell::DetachEditorFromWindow() {
|
||||
MOZ_ASSERT(!mIsBeingDestroyed || !mOSHE->HasDetachedEditor(),
|
||||
"We should not set the editor data again once after we "
|
||||
"detached the editor data during destroying this docshell");
|
||||
mOSHE->SetEditorData(mEditorData.forget());
|
||||
mOSHE->SetEditorData(mEditorData.release());
|
||||
} else {
|
||||
mEditorData = nullptr;
|
||||
}
|
||||
@ -7316,13 +7315,13 @@ nsresult nsDocShell::RestoreFromHistory() {
|
||||
|
||||
// Hack to keep nsDocShellEditorData alive across the
|
||||
// SetContentViewer(nullptr) call below.
|
||||
nsAutoPtr<nsDocShellEditorData> data(mLSHE->ForgetEditorData());
|
||||
UniquePtr<nsDocShellEditorData> data(mLSHE->ForgetEditorData());
|
||||
|
||||
// Now remove it from the cached presentation.
|
||||
mLSHE->SetContentViewer(nullptr);
|
||||
mEODForCurrentDocument = false;
|
||||
|
||||
mLSHE->SetEditorData(data.forget());
|
||||
mLSHE->SetEditorData(data.release());
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -11827,7 +11826,7 @@ nsresult nsDocShell::EnsureEditorData() {
|
||||
// we're shutting down, or we already have a detached editor data
|
||||
// stored in the session history. We should only have one editordata
|
||||
// per docshell.
|
||||
mEditorData = new nsDocShellEditorData(this);
|
||||
mEditorData = MakeUnique<nsDocShellEditorData>(this);
|
||||
}
|
||||
|
||||
return mEditorData ? NS_OK : NS_ERROR_NOT_AVAILABLE;
|
||||
|
@ -1159,7 +1159,7 @@ class nsDocShell final : public nsDocLoader,
|
||||
nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
|
||||
|
||||
// Editor data, if this document is designMode or contentEditable.
|
||||
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
||||
mozilla::UniquePtr<nsDocShellEditorData> mEditorData;
|
||||
|
||||
// Secure browser UI object
|
||||
nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
|
||||
|
@ -893,14 +893,14 @@ NS_IMETHODIMP_(void)
|
||||
SHEntryChild::SyncPresentationState() { mShared->SyncPresentationState(); }
|
||||
|
||||
nsDocShellEditorData* SHEntryChild::ForgetEditorData() {
|
||||
return mShared->mEditorData.forget();
|
||||
return mShared->mEditorData.release();
|
||||
}
|
||||
|
||||
void SHEntryChild::SetEditorData(nsDocShellEditorData* aData) {
|
||||
NS_ASSERTION(!(aData && mShared->mEditorData),
|
||||
"We're going to overwrite an owning ref!");
|
||||
if (mShared->mEditorData != aData) {
|
||||
mShared->mEditorData = aData;
|
||||
mShared->mEditorData = WrapUnique(aData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1144,14 +1144,14 @@ nsLegacySHEntry::SyncPresentationState() {
|
||||
|
||||
nsDocShellEditorData* nsLegacySHEntry::ForgetEditorData() {
|
||||
// XXX jlebar Check how this is used.
|
||||
return GetState()->mEditorData.forget();
|
||||
return GetState()->mEditorData.release();
|
||||
}
|
||||
|
||||
void nsLegacySHEntry::SetEditorData(nsDocShellEditorData* aData) {
|
||||
NS_ASSERTION(!(aData && GetState()->mEditorData),
|
||||
"We're going to overwrite an owning ref!");
|
||||
if (GetState()->mEditorData != aData) {
|
||||
GetState()->mEditorData = aData;
|
||||
GetState()->mEditorData = mozilla::WrapUnique(aData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef nsSHEntryShared_h__
|
||||
#define nsSHEntryShared_h__
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsExpirationTracker.h"
|
||||
@ -18,6 +17,7 @@
|
||||
#include "nsStubMutationObserver.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
class nsSHEntry;
|
||||
class nsISHEntry;
|
||||
@ -122,7 +122,7 @@ class SHEntrySharedChildState {
|
||||
// FIXME Move to parent?
|
||||
nsCOMPtr<nsIMutableArray> mRefreshURIList;
|
||||
nsExpirationState mExpirationState;
|
||||
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
||||
UniquePtr<nsDocShellEditorData> mEditorData;
|
||||
|
||||
// FIXME Move to parent?
|
||||
bool mSaveLayoutState;
|
||||
|
Loading…
Reference in New Issue
Block a user