Closed Bug 1610067 Opened 6 years ago Closed 5 years ago

[meta] Remove nsAutoPtr

Categories

(Core :: XPCOM, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: erahm, Assigned: erahm)

References

Details

(Keywords: meta)

Attachments

(1 file)

nsAutoPtr is deprecated in favor of UniquePtr, this bug will track the conversion to UniquePtr and the eventual removal of nsAutoPtr.

Conversion is not always straightforward, but generally follows this pattern:

  • Replace #include "nsAutoPtr.h" with #include "mozilla/UniquePtr.h", possibly add the missing include
  • Replace nsAutoPtr with UniquePtr or possibly a fully-qualified mozilla::UniquePtr
  • Fix up any place that expects implicit conversion from the container to the T* raw pointer type by use UniquePtr<T>::get(), possibly just switching the variable type to const auto&, or optionally consider updating consumers to use a ref instead so you can just use *ptr
  • Fix up any place that assigns a raw pointer to a UniquePtr. For cases calling new replace that with MakeUnique, if you're passed a raw pointer you can use WrapUnique or UniquePtr<T>::reset
  • Replace nsAutoPtr::forget with UniquePtr<T>::release. It's possible you'll need prefix the release with Unused <<
  • For things with a private destructor replace friend class nsAutoPtr with friend class mozilla::DefaultDelete

There are currently 735 references in tree.

Depends on: 1610070
Depends on: 1496147
Depends on: 1610386
Depends on: 1610387
Depends on: 1610388
Depends on: 1610605
Depends on: 1610740
Depends on: 1617327
Depends on: 1617334
Depends on: 1617653
Depends on: 1617771
Depends on: 1618488
Depends on: 1618643
Depends on: 1618735
Depends on: 1618753
Depends on: 1619230
Depends on: 1623181
Depends on: 1626434
Depends on: 1626435
Depends on: 1626436
Depends on: 1626437
Depends on: 1626438
Depends on: 1626439
Depends on: 1626440
Depends on: 1626441
Depends on: 1626442
Depends on: 1626443
Depends on: 1626444
Depends on: 1626445
Depends on: 1626446
Depends on: 1626447
Depends on: 1626448
Depends on: 1626449
Depends on: 1626450
Depends on: 1626451
Depends on: 1626452
Depends on: 1626453
Depends on: 1626454
Depends on: 1626455
Depends on: 1626456
Depends on: 1632613
Assignee: nobody → erahm
Status: NEW → ASSIGNED
Attachment #9144104 - Attachment description: Bug 1610067 - Remove nsAutoPtr. r=#xpcom-reviewers!' `nsAutoPtr` has been deprecated for 6 years. All remaining references are gone and it can now be removed. → Bug 1610067 - Remove nsAutoPtr. r=#xpcom-reviewers!'
Pushed by erahm@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eeaa8ec71789 Remove nsAutoPtr. r=xpcom-reviewers,nika'

Backed out changeset eeaa8ec71789 (bug 1610067) for bustages complaining about nsAutoPtr.h

Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&fromchange=a679259cce36acdf9ce0caf487af448cc6c0f320&searchStr=build&tochange=0306492fe5a5500efe7bfce78bd6f1cfebdbbad3&selectedTaskRun=JVc8ZFciSn2E-QIR_qtLYA-0

Backout link: https://hg.mozilla.org/integration/autoland/rev/0306492fe5a5500efe7bfce78bd6f1cfebdbbad3

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=300009157&repo=autoland&lineNumber=21479

task 2020-04-29T15:51:28.766Z] 15:51:28     INFO -  make[4]: Entering directory '/builds/worker/workspace/obj-build/gfx/vr'
[task 2020-04-29T15:51:28.770Z] 15:51:28     INFO -  /builds/worker/fetches/sccache/sccache /builds/worker/fetches/clang/bin/clang++ -std=gnu++17 -o VRManager.o -c  -I/builds/worker/workspace/obj-build/dist/stl_wrappers -I/builds/worker/workspace/obj-build/dist/system_wrappers -include /builds/worker/checkouts/gecko/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/builds/worker/checkouts/gecko/gfx/vr -I/builds/worker/workspace/obj-build/gfx/vr -I/builds/worker/checkouts/gecko/dom/base -I/builds/worker/checkouts/gecko/gfx/layers/d3d11 -I/builds/worker/checkouts/gecko/gfx/thebes -I/builds/worker/workspace/obj-build/ipc/ipdl/_ipdlheaders -I/builds/worker/checkouts/gecko/ipc/chromium/src -I/builds/worker/checkouts/gecko/ipc/glue -I/builds/worker/workspace/obj-build/dist/include -I/builds/worker/workspace/obj-build/dist/include/nspr -I/builds/worker/workspace/obj-build/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /builds/worker/workspace/obj-build/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Werror=non-literal-null-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -D_GLIBCXX_USE_CXX11_ABI=0 -fno-sized-deallocation -fno-aligned-new -fcrash-diagnostics-dir=/builds/worker/artifacts -fno-exceptions -fno-strict-aliasing -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -g -Xclang -load -Xclang /builds/worker/workspace/obj-build/build/clang-plugin/libclang-plugin.so -Xclang -add-plugin -Xclang moz-check -Os -fno-omit-frame-pointer -funwind-tables -Werror -I/builds/worker/workspace/obj-build/dist/include/cairo -I/builds/worker/checkouts/gecko/widget/gtk/compat-gtk3 -pthread -I/usr/include/gtk-3.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gtk-3.0/unix-print -fexperimental-new-pass-manager  -MD -MP -MF .deps/VRManager.o.pp   /builds/worker/checkouts/gecko/gfx/vr/VRManager.cpp
[task 2020-04-29T15:51:28.770Z] 15:51:28     INFO -  In file included from /builds/worker/checkouts/gecko/gfx/vr/VRManager.cpp:14:
[task 2020-04-29T15:51:28.770Z] 15:51:28     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/dom/VRDisplay.h:16:
[task 2020-04-29T15:51:28.770Z] 15:51:28     INFO -  In file included from /builds/worker/workspace/obj-build/dist/include/mozilla/dom/DOMPoint.h:11:
[task 2020-04-29T15:51:28.770Z] 15:51:28     INFO -  /builds/worker/workspace/obj-build/dist/include/mozilla/dom/DOMMatrix.h:11:10: fatal error: 'nsAutoPtr.h' file not found
[task 2020-04-29T15:51:28.770Z] 15:51:28     INFO -  #include "nsAutoPtr.h"
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -           ^~~~~~~~~~~~~
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -  1 error generated.
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -  /builds/worker/checkouts/gecko/config/rules.mk:750: recipe for target 'VRManager.o' failed
[task 2020-04-29T15:51:28.771Z] 15:51:28    ERROR -  make[4]: *** [VRManager.o] Error 1
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -  make[4]: Leaving directory '/builds/worker/workspace/obj-build/gfx/vr'
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -  /builds/worker/checkouts/gecko/config/recurse.mk:74: recipe for target 'gfx/vr/target-objects' failed
[task 2020-04-29T15:51:28.771Z] 15:51:28    ERROR -  make[3]: *** [gfx/vr/target-objects] Error 2
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -  make[3]: *** Waiting for unfinished jobs....
[task 2020-04-29T15:51:28.771Z] 15:51:28     INFO -  make[4]: Entering directory '/builds/worker/workspace/obj-build/gfx/layers'
Flags: needinfo?(erahm)
Pushed by erahm@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1186bfb95124 Remove nsAutoPtr. r=xpcom-reviewers,nika'
Flags: needinfo?(erahm)
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: