Bug 1265953, part 2 - Convert much of the rest of the widget code from nsAutoPtr to UniquePtr. r=mstange
authorJonathan Watt <jwatt@jwatt.org>
Tue, 19 Apr 2016 21:51:25 +0100
changeset 294174 31b3a03707447d000981a6c1aa2dc81697458fc8
parent 294173 710324243b622d7b8555769a9676931c04a7ea8c
child 294175 898c9f87a4c48c0cbc5d9afe6ced9eb3c71f9388
push id18864
push userkwierso@gmail.com
push dateThu, 21 Apr 2016 22:03:23 +0000
treeherderfx-team@467bd00c72db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1265953
milestone48.0a1
Bug 1265953, part 2 - Convert much of the rest of the widget code from nsAutoPtr to UniquePtr. r=mstange
widget/GfxInfoBase.cpp
widget/TextEventDispatcher.h
widget/TextRange.h
widget/TouchEvents.h
widget/gonk/nsWindow.cpp
widget/gonk/nsWindow.h
widget/gtk/IMContextWrapper.h
widget/gtk/nsDragService.h
widget/gtk/nsImageToPixbuf.cpp
widget/gtk/nsScreenManagerGtk.cpp
widget/gtk/nsSound.cpp
widget/gtk/nsWidgetFactory.cpp
widget/gtk/nsWindow.cpp
widget/nsPrimitiveHelpers.cpp
widget/nsPrintOptionsImpl.cpp
widget/nsShmImage.h
widget/nsTransferable.cpp
widget/qt/nsWindow.cpp
widget/qt/nsWindow.h
widget/windows/AudioSession.cpp
widget/windows/AudioSession.h
widget/windows/JumpListBuilder.cpp
widget/windows/JumpListItem.h
widget/windows/KeyboardLayout.h
widget/windows/TSFTextStore.h
widget/windows/TaskbarPreview.h
widget/windows/TaskbarPreviewButton.h
widget/windows/WidgetTraceEvent.cpp
widget/windows/WinTaskbar.cpp
widget/windows/WinUtils.h
widget/windows/nsDataObjCollection.h
widget/windows/nsDeviceContextSpecWin.cpp
widget/windows/nsDragService.cpp
widget/windows/nsFilePicker.h
widget/windows/nsWindow.h
widget/windows/nsWindowBase.cpp
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -8,17 +8,16 @@
 #include "mozilla/ArrayUtils.h"
 
 #include "GfxInfoBase.h"
 
 #include "GfxInfoWebGL.h"
 #include "GfxDriverInfo.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
-#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
 #include "nsVersionComparator.h"
 #include "mozilla/Services.h"
 #include "mozilla/Observer.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIDOMElement.h"
--- a/widget/TextEventDispatcher.h
+++ b/widget/TextEventDispatcher.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_textcompositionsynthesizer_h_
 #define mozilla_textcompositionsynthesizer_h_
 
-#include "nsAutoPtr.h"
+#include "mozilla/RefPtr.h"
 #include "nsString.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/TextEventDispatcherListener.h"
 #include "mozilla/TextRange.h"
 
 class nsIWidget;
 
--- a/widget/TextRange.h
+++ b/widget/TextRange.h
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_TextRage_h_
 #define mozilla_TextRage_h_
 
 #include <stdint.h>
 
-#include "nsAutoPtr.h"
 #include "nsColor.h"
 #include "nsITextInputProcessor.h"
 #include "nsStyleConsts.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 
 /******************************************************************************
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -5,17 +5,17 @@
 
 #ifndef mozilla_TouchEvents_h__
 #define mozilla_TouchEvents_h__
 
 #include <stdint.h>
 
 #include "mozilla/dom/Touch.h"
 #include "mozilla/MouseEvents.h"
-#include "nsAutoPtr.h"
+#include "mozilla/RefPtr.h"
 #include "nsIDOMSimpleGestureEvent.h"
 #include "nsTArray.h"
 
 namespace mozilla {
 
 /******************************************************************************
  * mozilla::WidgetGestureNotifyEvent
  *
--- a/widget/gonk/nsWindow.cpp
+++ b/widget/gonk/nsWindow.cpp
@@ -8,36 +8,37 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
+#include "nsWindow.h"
+
 #include "mozilla/DebugOnly.h"
 
 #include <fcntl.h>
 
 #include "android/log.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/RefPtr.h"
 #include "mozilla/Services.h"
 #include "mozilla/FileUtils.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "gfxContext.h"
 #include "gfxPlatform.h"
 #include "GLContextProvider.h"
 #include "GLContext.h"
 #include "GLContextEGL.h"
-#include "nsAutoPtr.h"
 #include "nsAppShell.h"
 #include "nsScreenManagerGonk.h"
 #include "nsTArray.h"
-#include "nsWindow.h"
 #include "nsIWidgetListener.h"
 #include "ClientLayerManager.h"
 #include "BasicLayers.h"
 #include "libdisplay/GonkDisplay.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/layers/APZCTreeManager.h"
@@ -262,17 +263,17 @@ nsWindow::SynthesizeNativeTouchPoint(uin
 {
     AutoObserverNotifier notifier(aObserver, "touchpoint");
 
     if (aPointerState == TOUCH_HOVER) {
         return NS_ERROR_UNEXPECTED;
     }
 
     if (!mSynthesizedTouchInput) {
-        mSynthesizedTouchInput = new MultiTouchInput();
+        mSynthesizedTouchInput = MakeUnique<MultiTouchInput>();
     }
 
     ScreenIntPoint pointerScreenPoint = ViewAs<ScreenPixel>(aPoint,
         PixelCastJustification::LayoutDeviceIsScreenForBounds);
 
     // We can't dispatch mSynthesizedTouchInput directly because (a) dispatching
     // it might inadvertently modify it and (b) in the case of touchend or
     // touchcancel events mSynthesizedTouchInput will hold the touches that are
--- a/widget/gonk/nsWindow.h
+++ b/widget/gonk/nsWindow.h
@@ -12,16 +12,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 #ifndef nsWindow_h
 #define nsWindow_h
 
 #include "InputData.h"
+#include "mozilla/UniquePtr.h"
 #include "nsBaseWidget.h"
 #include "nsRegion.h"
 #include "nsIIdleServiceInternal.h"
 #include "Units.h"
 
 class ANativeWindowBuffer;
 
 namespace widget {
@@ -145,16 +146,16 @@ protected:
 
     // Call this function when the users activity is the direct cause of an
     // event (like a keypress or mouse click).
     void UserActivity();
 
 private:
     // This is used by SynthesizeNativeTouchPoint to maintain state between
     // multiple synthesized points
-    nsAutoPtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
+    mozilla::UniquePtr<mozilla::MultiTouchInput> mSynthesizedTouchInput;
 
     RefPtr<nsScreenGonk> mScreen;
 
     RefPtr<mozilla::HwcComposer2D> mComposer2D;
 };
 
 #endif /* nsWindow_h */
--- a/widget/gtk/IMContextWrapper.h
+++ b/widget/gtk/IMContextWrapper.h
@@ -7,17 +7,16 @@
 
 #ifndef IMContextWrapper_h_
 #define IMContextWrapper_h_
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
 #include "nsString.h"
-#include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsIWidget.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/TextEventDispatcherListener.h"
 #include "WritingModes.h"
 
--- a/widget/gtk/nsDragService.h
+++ b/widget/gtk/nsDragService.h
@@ -2,17 +2,17 @@
 /* vim: set ts=4 et sw=4 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsDragService_h__
 #define nsDragService_h__
 
-#include "nsAutoPtr.h"
+#include "mozilla/RefPtr.h"
 #include "nsBaseDragService.h"
 #include "nsIObserver.h"
 #include "nsAutoRef.h"
 #include <gtk/gtk.h>
 
 class nsWindow;
 
 namespace mozilla {
--- a/widget/gtk/nsImageToPixbuf.cpp
+++ b/widget/gtk/nsImageToPixbuf.cpp
@@ -5,17 +5,16 @@
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 #include "nsImageToPixbuf.h"
 
 #include "imgIContainer.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
-#include "nsAutoPtr.h"
 
 using mozilla::gfx::DataSourceSurface;
 using mozilla::gfx::SurfaceFormat;
 
 NS_IMPL_ISUPPORTS(nsImageToPixbuf, nsIImageToPixbuf)
 
 inline unsigned char
 unpremultiply (unsigned char color,
--- a/widget/gtk/nsScreenManagerGtk.cpp
+++ b/widget/gtk/nsScreenManagerGtk.cpp
@@ -1,18 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsScreenManagerGtk.h"
+
+#include "mozilla/RefPtr.h"
 #include "nsScreenGtk.h"
 #include "nsIComponentManager.h"
 #include "nsRect.h"
-#include "nsAutoPtr.h"
 #include "nsGtkUtils.h"
 
 #define SCREEN_MANAGER_LIBRARY_LOAD_FAILED ((PRLibrary*)1)
 
 #ifdef MOZ_X11
 #include <gdk/gdkx.h>
 // prototypes from Xinerama.h
 typedef Bool (*_XnrmIsActive_fn)(Display *dpy);
--- a/widget/gtk/nsSound.cpp
+++ b/widget/gtk/nsSound.cpp
@@ -13,17 +13,16 @@
 
 #include "nsSound.h"
 
 #include "nsIURL.h"
 #include "nsIFileURL.h"
 #include "nsNetUtil.h"
 #include "nsIChannel.h"
 #include "nsCOMPtr.h"
-#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "mozilla/FileUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/unused.h"
 #include "nsIStringBundle.h"
 #include "nsIXULAppInfo.h"
--- a/widget/gtk/nsWidgetFactory.cpp
+++ b/widget/gtk/nsWidgetFactory.cpp
@@ -48,17 +48,16 @@
 #include "nsIdleServiceGTK.h"
 #include "GfxInfoX11.h"
 #endif
 
 #include "nsNativeThemeGTK.h"
 
 #include "nsIComponentRegistrar.h"
 #include "nsComponentManagerUtils.h"
-#include "nsAutoPtr.h"
 #include "mozilla/gfx/2D.h"
 #include <gtk/gtk.h>
 
 using namespace mozilla;
 using namespace mozilla::widget;
 
 /* from nsFilePicker.js */
 #define XULFILEPICKER_CID \
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1,19 +1,22 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim:expandtab:shiftwidth=4:tabstop=4:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#include "nsWindow.h"
+
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/MiscEvents.h"
 #include "mozilla/MouseEvents.h"
+#include "mozilla/RefPtr.h"
 #include "mozilla/TextEventDispatcher.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/TouchEvents.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include <algorithm>
 
 #include "GeckoProfiler.h"
@@ -95,17 +98,16 @@ using namespace mozilla::widget;
 
 /* SetCursor(imgIContainer*) */
 #include <gdk/gdk.h>
 #include <wchar.h>
 #include "imgIContainer.h"
 #include "nsGfxCIID.h"
 #include "nsImageToPixbuf.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsAutoPtr.h"
 #include "ClientLayerManager.h"
 
 #include "gfxPlatformGtk.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "gfxUtils.h"
 #include "Layers.h"
 #include "GLContextProvider.h"
@@ -116,17 +118,16 @@ using namespace mozilla::widget;
 #include "gfxXlibSurface.h"
 #endif
   
 #include "nsShmImage.h"
 
 #include "nsIDOMWheelEvent.h"
 
 #include "NativeKeyBindings.h"
-#include "nsWindow.h"
 
 #include <dlfcn.h>
 
 #include "mozilla/layers/APZCTreeManager.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
--- a/widget/nsPrimitiveHelpers.cpp
+++ b/widget/nsPrimitiveHelpers.cpp
@@ -18,17 +18,16 @@
 //  - text/plain is always a char*
 //  - anything else is a char16_t*
 //
 
 
 #include "nsPrimitiveHelpers.h"
 
 #include "mozilla/UniquePtr.h"
-#include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsITransferable.h"
 #include "nsIComponentManager.h"
 #include "nsLinebreakConverter.h"
 #include "nsReadableUtils.h"
 
--- a/widget/nsPrintOptionsImpl.cpp
+++ b/widget/nsPrintOptionsImpl.cpp
@@ -2,16 +2,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsPrintOptionsImpl.h"
 
 #include "mozilla/embedding/PPrinting.h"
 #include "mozilla/layout/RemotePrintJobChild.h"
+#include "mozilla/RefPtr.h"
 #include "nsPrintingProxy.h"
 #include "nsReadableUtils.h"
 #include "nsPrintSettingsImpl.h"
 #include "nsIPrintSession.h"
 
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIDialogParamBlock.h"
@@ -19,17 +20,16 @@
 #include "nsISupportsPrimitives.h"
 #include "nsIWindowWatcher.h"
 #include "nsISupportsArray.h"
 #include "prprf.h"
 
 #include "nsIStringEnumerator.h"
 #include "nsISupportsPrimitives.h"
 #include "stdlib.h"
-#include "nsAutoPtr.h"
 #include "mozilla/Preferences.h"
 #include "nsPrintfCString.h"
 #include "nsIWebBrowserPrint.h"
 
 using namespace mozilla;
 using namespace mozilla::embedding;
 
 typedef mozilla::layout::RemotePrintJobChild RemotePrintJobChild;
--- a/widget/nsShmImage.h
+++ b/widget/nsShmImage.h
@@ -10,17 +10,16 @@
 #if defined(MOZ_X11)
 #  define MOZ_HAVE_SHMIMAGE
 #endif
 
 #ifdef MOZ_HAVE_SHMIMAGE
 
 #include "mozilla/gfx/2D.h"
 #include "nsIWidget.h"
-#include "nsAutoPtr.h"
 #include "Units.h"
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XShm.h>
 
 class nsShmImage {
   // bug 1168843, compositor thread may create shared memory instances that are destroyed by main thread on shutdown, so this must use thread-safe RC to avoid hitting assertion
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsShmImage)
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -30,17 +30,16 @@ Notes to self:
 #include "nsCRT.h" 
 #include "nsNetUtil.h"
 #include "nsIDOMNode.h"
 #include "nsIOutputStream.h"
 #include "nsIInputStream.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsIFile.h"
 #include "nsILoadContext.h"
-#include "nsAutoPtr.h"
 
 NS_IMPL_ISUPPORTS(nsTransferable, nsITransferable)
 
 size_t GetDataForFlavor (const nsTArray<DataStruct>& aArray,
                            const char* aDataFlavor)
 {
   for (size_t i = 0 ; i < aArray.Length () ; ++i) {
     if (aArray[i].GetFlavor().Equals (aDataFlavor))
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -52,17 +52,16 @@
 #include "BasicLayers.h"
 
 #include "nsIStringBundle.h"
 #include "nsGfxCIID.h"
 
 #include "imgIContainer.h"
 #include "nsGfxCIID.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsAutoPtr.h"
 
 #include "gfxQtPlatform.h"
 
 #include "nsIDOMWheelEvent.h"
 
 #include "GLContext.h"
 
 #ifdef MOZ_X11
--- a/widget/qt/nsWindow.h
+++ b/widget/qt/nsWindow.h
@@ -5,17 +5,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __nsWindow_h__
 #define __nsWindow_h__
 
 #include <QPointF>
 
-#include "nsAutoPtr.h"
 #include "nsBaseWidget.h"
 #include "mozilla/EventForwards.h"
 
 #include "nsGkAtoms.h"
 #include "nsIIdleServiceInternal.h"
 #include "nsIRunnable.h"
 #include "nsThreadUtils.h"
 
--- a/widget/windows/AudioSession.cpp
+++ b/widget/windows/AudioSession.cpp
@@ -3,23 +3,23 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <windows.h>
 #include <audiopolicy.h>
 #include <mmdeviceapi.h>
 
+#include "mozilla/RefPtr.h"
 #include "nsIStringBundle.h"
 #include "nsIUUIDGenerator.h"
 #include "nsIXULAppInfo.h"
 
 //#include "AudioSession.h"
 #include "nsCOMPtr.h"
-#include "nsAutoPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/Attributes.h"
 
 #include <objbase.h>
 
--- a/widget/windows/AudioSession.h
+++ b/widget/windows/AudioSession.h
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsAutoPtr.h"
 #include "nsString.h"
 
 namespace mozilla {
 namespace widget {
 
 // Start the audio session in the current process
 nsresult StartAudioSession();
 
--- a/widget/windows/JumpListBuilder.cpp
+++ b/widget/windows/JumpListBuilder.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "JumpListBuilder.h"
 
 #include "nsError.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
-#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsArrayUtils.h"
 #include "nsIMutableArray.h"
 #include "nsWidgetsCID.h"
 #include "WinTaskbar.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsISimpleEnumerator.h"
 #include "mozilla/Preferences.h"
--- a/widget/windows/JumpListItem.h
+++ b/widget/windows/JumpListItem.h
@@ -5,22 +5,22 @@
 
 #ifndef __JumpListItem_h__
 #define __JumpListItem_h__
 
 #include <windows.h>
 #include <shobjidl.h>
 #undef LogSeverity // SetupAPI.h #defines this as DWORD
 
+#include "mozilla/RefPtr.h"
 #include "nsIJumpListItem.h"  // defines nsIJumpListItem
 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
 #include "nsTArray.h"
 #include "nsIMutableArray.h"
 #include "nsCOMPtr.h"
-#include "nsAutoPtr.h"
 #include "nsIURI.h"
 #include "nsICryptoHash.h"
 #include "nsString.h"
 #include "nsCycleCollectionParticipant.h"
 
 class nsIThread;
 
 namespace mozilla {
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -1,18 +1,18 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef KeyboardLayout_h__
 #define KeyboardLayout_h__
 
+#include "mozilla/RefPtr.h"
 #include "nscore.h"
-#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsWindowBase.h"
 #include "nsWindowDefs.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/TextEventDispatcher.h"
 #include <windows.h>
 
--- a/widget/windows/TSFTextStore.h
+++ b/widget/windows/TSFTextStore.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TSFTextStore_h_
 #define TSFTextStore_h_
 
-#include "nsAutoPtr.h"
+#include "mozilla/RefPtr.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsIWidget.h"
 #include "nsWindowBase.h"
 #include "WinUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextEventDispatcher.h"
--- a/widget/windows/TaskbarPreview.h
+++ b/widget/windows/TaskbarPreview.h
@@ -7,19 +7,19 @@
 
 #ifndef __mozilla_widget_TaskbarPreview_h__
 #define __mozilla_widget_TaskbarPreview_h__
 
 #include <windows.h>
 #include <shobjidl.h>
 #undef LogSeverity // SetupAPI.h #defines this as DWORD
 
+#include "mozilla/RefPtr.h"
 #include <nsITaskbarPreview.h>
 #include <nsITaskbarPreviewController.h>
-#include <nsAutoPtr.h>
 #include <nsString.h>
 #include <nsWeakPtr.h>
 #include <nsIDocShell.h>
 #include "WindowHook.h"
 
 namespace mozilla {
 namespace widget {
 
--- a/widget/windows/TaskbarPreviewButton.h
+++ b/widget/windows/TaskbarPreviewButton.h
@@ -7,18 +7,18 @@
 
 #ifndef __mozilla_widget_TaskbarPreviewButton_h__
 #define __mozilla_widget_TaskbarPreviewButton_h__
 
 #include <windows.h>
 #include <shobjidl.h>
 #undef LogSeverity // SetupAPI.h #defines this as DWORD
 
+#include "mozilla/RefPtr.h"
 #include <nsITaskbarPreviewButton.h>
-#include <nsAutoPtr.h>
 #include <nsString.h>
 #include <nsWeakReference.h>
 
 namespace mozilla {
 namespace widget {
 
 class TaskbarWindowPreview;
 class TaskbarPreviewButton : public nsITaskbarPreviewButton, public nsSupportsWeakReference
--- a/widget/windows/WidgetTraceEvent.cpp
+++ b/widget/windows/WidgetTraceEvent.cpp
@@ -5,27 +5,27 @@
 /*
  * Windows widget support for event loop instrumentation.
  * See toolkit/xre/EventTracer.cpp for more details.
  */
 
 #include <stdio.h>
 #include <windows.h>
 
+#include "mozilla/RefPtr.h"
 #include "mozilla/WidgetTraceEvent.h"
 #include "nsAppShellCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCOMPtr.h"
 #include "nsIAppShellService.h"
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsISupportsImpl.h"
 #include "nsIWidget.h"
 #include "nsIXULWindow.h"
-#include "nsAutoPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsWindowDefs.h"
 
 namespace {
 
 // Used for signaling the background thread from the main thread.
 HANDLE sEventHandle = nullptr;
--- a/widget/windows/WinTaskbar.cpp
+++ b/widget/windows/WinTaskbar.cpp
@@ -4,23 +4,23 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WinTaskbar.h"
 #include "TaskbarPreview.h"
 #include <nsITaskbarPreviewController.h>
 
+#include "mozilla/RefPtr.h"
 #include <nsError.h>
 #include <nsCOMPtr.h>
 #include <nsIWidget.h>
 #include <nsIBaseWindow.h>
 #include <nsIObserverService.h>
 #include <nsServiceManagerUtils.h>
-#include <nsAutoPtr.h>
 #include "nsIXULAppInfo.h"
 #include "nsIJumpListBuilder.h"
 #include "nsUXThemeData.h"
 #include "nsWindow.h"
 #include "WinUtils.h"
 #include "TaskbarTabPreview.h"
 #include "TaskbarWindowPreview.h"
 #include "JumpListBuilder.h"
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -14,17 +14,16 @@
 
 // Undo the windows.h damage
 #undef GetMessage
 #undef CreateEvent
 #undef GetClassName
 #undef GetBinaryType
 #undef RemoveDirectory
 
-#include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsRegion.h"
 #include "nsRect.h"
 
 #include "nsIRunnable.h"
 #include "nsICryptoHash.h"
 #ifdef MOZ_PLACES
 #include "nsIFaviconService.h"
--- a/widget/windows/nsDataObjCollection.h
+++ b/widget/windows/nsDataObjCollection.h
@@ -3,19 +3,19 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _NSDATAOBJCOLLECTION_H_
 #define _NSDATAOBJCOLLECTION_H_
 
 #include <oleidl.h>
 
+#include "mozilla/RefPtr.h"
 #include "nsString.h"
 #include "nsTArray.h"
-#include "nsAutoPtr.h"
 #include "nsDataObj.h"
 #include "mozilla/Attributes.h"
 
 #define MULTI_MIME "Mozilla/IDataObjectCollectionFormat"
 
 EXTERN_C const IID IID_IDataObjCollection;
 
 // An interface to make sure we have the right kind of object for D&D
--- a/widget/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/windows/nsDeviceContextSpecWin.cpp
@@ -1,23 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/ArrayUtils.h"
+#include "mozilla/RefPtr.h"
 
 #include "nsDeviceContextSpecWin.h"
 #include "prmem.h"
 
 #include <winspool.h>
 
 #include <tchar.h>
 
-#include "nsAutoPtr.h"
 #include "nsIWidget.h"
 
 #include "nsTArray.h"
 #include "nsIPrintSettingsWin.h"
 
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsIServiceManager.h"
--- a/widget/windows/nsDragService.cpp
+++ b/widget/windows/nsDragService.cpp
@@ -6,30 +6,29 @@
 #include <ole2.h>
 #include <oleidl.h>
 #include <shlobj.h>
 #include <shlwapi.h>
 
 // shellapi.h is needed to build with WIN32_LEAN_AND_MEAN
 #include <shellapi.h>
 
+#include "mozilla/RefPtr.h"
 #include "nsDragService.h"
 #include "nsITransferable.h"
 #include "nsDataObj.h"
 
 #include "nsWidgetsCID.h"
 #include "nsNativeDragTarget.h"
 #include "nsNativeDragSource.h"
 #include "nsClipboard.h"
 #include "nsISupportsArray.h"
 #include "nsIDocument.h"
 #include "nsDataObjCollection.h"
 
-#include "nsAutoPtr.h"
-
 #include "nsString.h"
 #include "nsEscape.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIURL.h"
 #include "nsCWebBrowserPersist.h"
 #include "nsToolkit.h"
 #include "nsCRT.h"
 #include "nsDirectoryServiceDefs.h"
--- a/widget/windows/nsFilePicker.h
+++ b/widget/windows/nsFilePicker.h
@@ -19,17 +19,16 @@
 #undef _WIN32_IE
 #define _WIN32_IE _WIN32_IE_IE70
 #endif
 
 #include "nsIFile.h"
 #include "nsITimer.h"
 #include "nsISimpleEnumerator.h"
 #include "nsCOMArray.h"
-#include "nsAutoPtr.h"
 #include "nsBaseFilePicker.h"
 #include "nsString.h"
 #include "nsdefs.h"
 #include <commdlg.h>
 #include <shobjidl.h>
 #undef LogSeverity // SetupAPI.h #defines this as DWORD
 
 class nsILoadContext;
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -5,17 +5,17 @@
 
 #ifndef Window_h__
 #define Window_h__
 
 /*
  * nsWindow - Native window management and event handling.
  */
 
-#include "nsAutoPtr.h"
+#include "mozilla/RefPtr.h"
 #include "nsBaseWidget.h"
 #include "nsWindowBase.h"
 #include "nsdefs.h"
 #include "nsIdleService.h"
 #include "nsToolkit.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "gfxWindowsPlatform.h"
--- a/widget/windows/nsWindowBase.cpp
+++ b/widget/windows/nsWindowBase.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsWindowBase.h"
 
 #include "mozilla/MiscEvents.h"
 #include "KeyboardLayout.h"
 #include "WinUtils.h"
 #include "npapi.h"
+#include "nsAutoPtr.h"
 
 using namespace mozilla;
 using namespace mozilla::widget;
 
 static const wchar_t kUser32LibName[] =  L"user32.dll";
 bool nsWindowBase::sTouchInjectInitialized = false;
 InjectTouchInputPtr nsWindowBase::sInjectTouchFuncPtr;