Skip to content

Commit

Permalink
Bug 1617334 - Remove nsAutoPtr usage from toolkit. r=gsvelto
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D63746

--HG--
extra : moz-landing-system : lando
  • Loading branch information
EricRahm committed Feb 22, 2020
1 parent f6f3900 commit b224a74
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "nsAutoCompleteController.h"
#include "nsAutoCompleteSimpleResult.h"

#include "nsAutoPtr.h"
#include "nsNetCID.h"
#include "nsIIOService.h"
#include "nsReadableUtils.h"
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/browser/nsWebBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "nsDocShellTreeOwner.h"

// Core Includes
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"

Expand Down
1 change: 0 additions & 1 deletion toolkit/components/downloads/DownloadPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "DownloadPlatform.h"
#include "nsAutoPtr.h"
#include "nsNetUtil.h"
#include "nsString.h"
#include "nsINestedURI.h"
Expand Down
5 changes: 2 additions & 3 deletions toolkit/components/filewatcher/NativeFileWatcherWin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include "mozilla/Services.h"
#include "mozilla/UniquePtr.h"
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
#include "nsComponentManagerUtils.h"
#include "nsDataHashtable.h"
Expand Down Expand Up @@ -554,7 +553,7 @@ nsresult NativeFileWatcherIOTask::AddPathRunnableMethod(
PathRunnablesParametersWrapper* aWrappedParameters) {
MOZ_ASSERT(!NS_IsMainThread());

nsAutoPtr<PathRunnablesParametersWrapper> wrappedParameters(
UniquePtr<PathRunnablesParametersWrapper> wrappedParameters(
aWrappedParameters);

// We return immediately if |mShuttingDown| is true (see below for
Expand Down Expand Up @@ -725,7 +724,7 @@ nsresult NativeFileWatcherIOTask::RemovePathRunnableMethod(
PathRunnablesParametersWrapper* aWrappedParameters) {
MOZ_ASSERT(!NS_IsMainThread());

nsAutoPtr<PathRunnablesParametersWrapper> wrappedParameters(
UniquePtr<PathRunnablesParametersWrapper> wrappedParameters(
aWrappedParameters);

// We return immediately if |mShuttingDown| is true (see below for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "nsIParentalControlsService.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIURI.h"

#if defined(XP_WIN)
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/places/PlaceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "mozIAsyncHistory.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"

class nsIURI;
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/places/VisitInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define mozilla_places_VisitInfo_h__

#include "mozIAsyncHistory.h"
#include "nsAutoPtr.h"
#include "mozilla/Attributes.h"

class nsIURI;
Expand Down
12 changes: 6 additions & 6 deletions toolkit/components/remote/nsRemoteService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
#endif
#include "nsRemoteService.h"

#include "nsAutoPtr.h"
#include "nsIObserverService.h"
#include "nsString.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/ModuleUtils.h"
#include "SpecialSystemDirectory.h"
#include "mozilla/CmdLineAndEnvUtils.h"
#include "mozilla/UniquePtr.h"

// Time to wait for the remoting service to start
#define START_TIMEOUT_SEC 5
Expand Down Expand Up @@ -99,23 +99,23 @@ RemoteResult nsRemoteService::StartClient(const char* aDesktopStartupID) {
return REMOTE_NOT_FOUND;
}

nsAutoPtr<nsRemoteClient> client;
UniquePtr<nsRemoteClient> client;

#ifdef MOZ_WIDGET_GTK
bool useX11Remote = GDK_IS_X11_DISPLAY(gdk_display_get_default());

# if defined(MOZ_ENABLE_DBUS)
if (!useX11Remote || getenv(DBUS_REMOTE_ENV)) {
client = new nsDBusRemoteClient();
client = MakeUnique<nsDBusRemoteClient>();
}
# endif
if (!client && useX11Remote) {
client = new nsXRemoteClient();
client = MakeUnique<nsXRemoteClient>();
}
#elif defined(XP_WIN)
client = new nsWinRemoteClient();
client = MakeUnique<nsWinRemoteClient>();
#elif defined(XP_DARWIN)
client = new nsMacRemoteClient();
client = MakeUnique<nsMacRemoteClient>();
#else
return REMOTE_NOT_FOUND;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/intl/LocaleService.h"

#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsDependentSubstring.h"
Expand Down
3 changes: 2 additions & 1 deletion toolkit/components/sessionstore/SessionStoreUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "mozilla/dom/XPathResult.h"
#include "mozilla/dom/XPathEvaluator.h"
#include "mozilla/dom/XPathExpression.h"
#include "mozilla/UniquePtr.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentList.h"
#include "nsContentUtils.h"
Expand Down Expand Up @@ -991,7 +992,7 @@ static Element* FindNodeByXPath(JSContext* aCx, Document& aDocument,
const nsAString& aExpression) {
FormDataParseContext parsingContext(aDocument.IsHTMLDocument());
IgnoredErrorResult rv;
nsAutoPtr<XPathExpression> expression(
UniquePtr<XPathExpression> expression(
aDocument.XPathEvaluator()->CreateExpression(aExpression, &parsingContext,
&aDocument, rv));
if (rv.Failed()) {
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/startup/nsAppStartup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "nsIAppWindow.h"
#include "nsNativeCharsetUtils.h"
#include "nsThreadUtils.h"
#include "nsAutoPtr.h"
#include "nsString.h"
#include "mozilla/AppShutdown.h"
#include "mozilla/Preferences.h"
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/startup/nsAppStartup.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#if defined(XP_WIN)
// XPerf-backed probes
# include "mozilla/perfprobe.h"
# include "nsAutoPtr.h"
#endif // defined(XP_WIN)

// {7DD4D320-C84B-4624-8D45-7BB9B2356977}
Expand Down
8 changes: 4 additions & 4 deletions toolkit/crashreporter/nsExceptionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class ReportInjectedCrash : public Runnable {
// If annotations are attempted before the crash reporter is enabled,
// they queue up here.
class DelayedNote;
nsTArray<nsAutoPtr<DelayedNote> >* gDelayedAnnotations;
nsTArray<UniquePtr<DelayedNote> >* gDelayedAnnotations;

#if defined(XP_WIN)
// the following are used to prevent other DLLs reverting the last chance
Expand Down Expand Up @@ -2376,14 +2376,14 @@ class DelayedNote {

static void EnqueueDelayedNote(DelayedNote* aNote) {
if (!gDelayedAnnotations) {
gDelayedAnnotations = new nsTArray<nsAutoPtr<DelayedNote> >();
gDelayedAnnotations = new nsTArray<UniquePtr<DelayedNote> >();
}
gDelayedAnnotations->AppendElement(aNote);
gDelayedAnnotations->AppendElement(WrapUnique(aNote));
}

void NotifyCrashReporterClientCreated() {
if (gDelayedAnnotations) {
for (nsAutoPtr<DelayedNote>& note : *gDelayedAnnotations) {
for (const auto& note : *gDelayedAnnotations) {
note->Run();
}
delete gDelayedAnnotations;
Expand Down
1 change: 0 additions & 1 deletion toolkit/profile/nsProfileLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#if defined(XP_WIN)
# include "ProfileUnlockerWin.h"
# include "nsAutoPtr.h"
#endif

#if defined(XP_MACOSX)
Expand Down
1 change: 0 additions & 1 deletion toolkit/system/gnome/nsGIOService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "nsIURI.h"
#include "nsTArray.h"
#include "nsStringEnumerator.h"
#include "nsAutoPtr.h"
#include "nsIMIMEInfo.h"
#include "nsComponentManagerUtils.h"
#include "nsArray.h"
Expand Down
1 change: 0 additions & 1 deletion toolkit/system/gnome/nsSystemAlertsService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "nsXULAppAPI.h"
#include "nsSystemAlertsService.h"
#include "nsAlertsIconListener.h"
#include "nsAutoPtr.h"

NS_IMPL_ADDREF(nsSystemAlertsService)
NS_IMPL_RELEASE(nsSystemAlertsService)
Expand Down
1 change: 0 additions & 1 deletion toolkit/xre/CreateAppData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "nsXULAppAPI.h"
#include "nsINIParser.h"
#include "nsIFile.h"
#include "nsAutoPtr.h"
#include "mozilla/XREAppData.h"

// This include must appear early in the unified cpp file for toolkit/xre to
Expand Down
21 changes: 11 additions & 10 deletions toolkit/xre/nsEmbedFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#include "mozilla/AbstractThread.h"
#include "mozilla/FilePreferences.h"
#include "mozilla/RDDProcessImpl.h"
#include "mozilla/UniquePtr.h"

#include "mozilla/ipc/BrowserProcessSubThread.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
Expand Down Expand Up @@ -684,51 +685,51 @@ nsresult XRE_InitChildProcess(int aArgc, char* aArgv[],
// Associate this thread with a UI MessageLoop
MessageLoop uiMessageLoop(uiLoopType);
{
nsAutoPtr<ProcessChild> process;
UniquePtr<ProcessChild> process;
switch (XRE_GetProcessType()) {
case GeckoProcessType_Default:
MOZ_CRASH("This makes no sense");
break;

case GeckoProcessType_Plugin:
process = new PluginProcessChild(parentPID);
process = MakeUnique<PluginProcessChild>(parentPID);
break;

case GeckoProcessType_Content:
process = new ContentProcess(parentPID);
process = MakeUnique<ContentProcess>(parentPID);
break;

case GeckoProcessType_IPDLUnitTest:
#ifdef MOZ_IPDL_TESTS
process = new IPDLUnitTestProcessChild(parentPID);
process = MakeUnique<IPDLUnitTestProcessChild>(parentPID);
#else
MOZ_CRASH("rebuild with --enable-ipdl-tests");
#endif
break;

case GeckoProcessType_GMPlugin:
process = new gmp::GMPProcessChild(parentPID);
process = MakeUnique<gmp::GMPProcessChild>(parentPID);
break;

case GeckoProcessType_GPU:
process = new gfx::GPUProcessImpl(parentPID);
process = MakeUnique<gfx::GPUProcessImpl>(parentPID);
break;

case GeckoProcessType_VR:
process = new gfx::VRProcessChild(parentPID);
process = MakeUnique<gfx::VRProcessChild>(parentPID);
break;

case GeckoProcessType_RDD:
process = new RDDProcessImpl(parentPID);
process = MakeUnique<RDDProcessImpl>(parentPID);
break;

case GeckoProcessType_Socket:
process = new net::SocketProcessImpl(parentPID);
process = MakeUnique<net::SocketProcessImpl>(parentPID);
break;

#if defined(MOZ_SANDBOX) && defined(XP_WIN)
case GeckoProcessType_RemoteSandboxBroker:
process = new RemoteSandboxBrokerProcessChild(parentPID);
process = MakeUnique<RemoteSandboxBrokerProcessChild>(parentPID);
break;
#endif

Expand Down

0 comments on commit b224a74

Please sign in to comment.