From f20336e5e12303156899c083ab7b6a8918755029 Mon Sep 17 00:00:00 2001 From: Michael Layzell Date: Thu, 3 Sep 2015 12:15:23 -0400 Subject: [PATCH] Bug 1201190 - Part 3: Mark every consumer of GUARD_OBJECT as MOZ_RAII, r=ehsan --- .../base/timeline/AutoGlobalTimelineMarker.h | 2 +- docshell/base/timeline/AutoTimelineMarker.h | 2 +- dom/base/ScriptSettings.h | 8 +++---- dom/base/nsContentUtils.h | 2 +- dom/base/nsFrameLoader.cpp | 4 ++-- dom/bindings/BindingUtils.h | 8 +++---- dom/bindings/RootedDictionary.h | 4 ++-- dom/bindings/TypedArray.h | 8 +++---- dom/media/MediaResource.h | 2 +- dom/plugins/ipc/PluginModuleParent.cpp | 2 +- dom/svg/DOMSVGLength.cpp | 2 +- dom/svg/DOMSVGLengthList.cpp | 2 +- dom/svg/DOMSVGNumber.cpp | 2 +- dom/svg/DOMSVGNumberList.cpp | 2 +- dom/svg/DOMSVGPathSeg.cpp | 2 +- dom/svg/DOMSVGPathSegList.cpp | 2 +- dom/svg/DOMSVGPoint.cpp | 2 +- dom/svg/DOMSVGPointList.cpp | 2 +- dom/svg/DOMSVGStringList.cpp | 2 +- dom/svg/DOMSVGTransformList.cpp | 2 +- dom/svg/SVGSVGElement.h | 2 +- dom/svg/SVGTransform.cpp | 2 +- dom/workers/XMLHttpRequest.cpp | 2 +- editor/libeditor/nsEditorUtils.h | 16 +++++++------- ipc/glue/MessageChannel.cpp | 2 +- ipc/glue/Neutering.h | 4 ++-- js/ipc/CPOWTimer.h | 2 +- js/public/RootingAPI.h | 4 ++-- js/src/ds/LifoAlloc.h | 2 +- js/src/gc/GCInternals.h | 6 ++--- js/src/gc/Statistics.h | 6 ++--- js/src/jit/Ion.cpp | 2 +- js/src/jit/JitSpewer.cpp | 2 +- js/src/jsapi.h | 22 +++++++++---------- js/src/jscntxt.h | 8 +++---- js/src/jscompartment.h | 8 +++---- js/src/jsfriendapi.h | 2 +- js/src/jsgc.h | 2 +- js/src/jsutil.h | 2 +- js/src/shell/js.cpp | 2 +- js/src/vm/Debugger.cpp | 6 ++--- js/src/vm/HelperThreads.h | 4 ++-- js/src/vm/Interpreter.cpp | 2 +- js/src/vm/RegExpStatics.h | 2 +- js/src/vm/Runtime.h | 8 +++---- js/src/vm/SPSProfiler.h | 6 ++--- js/src/vm/SavedStacks.h | 2 +- js/src/vm/ScopeObject.h | 2 +- js/src/vm/Shape.h | 2 +- js/src/vm/TraceLogging.h | 2 +- js/src/vm/TraceLoggingGraph.cpp | 2 +- js/xpconnect/src/xpcprivate.h | 4 ++-- layout/generic/Selection.h | 2 +- layout/generic/nsFlexContainerFrame.cpp | 2 +- layout/generic/nsSelection.cpp | 2 +- layout/style/nsCSSParser.cpp | 4 ++-- layout/style/nsRuleProcessorData.h | 4 ++-- layout/svg/nsSVGClipPathFrame.h | 2 +- layout/svg/nsSVGFilterFrame.cpp | 2 +- layout/svg/nsSVGGradientFrame.cpp | 2 +- layout/svg/nsSVGMarkerFrame.h | 2 +- layout/svg/nsSVGMaskFrame.h | 2 +- layout/svg/nsSVGPatternFrame.cpp | 2 +- layout/svg/nsSVGUtils.h | 2 +- mfbt/ReentrancyGuard.h | 2 +- mfbt/ScopeExit.h | 2 +- mfbt/Scoped.h | 4 ++-- mozglue/build/WindowsDllBlocklist.h | 2 +- .../osfile/NativeOSFileInternals.cpp | 2 +- toolkit/components/telemetry/Telemetry.h | 4 ++-- toolkit/devtools/heapsnapshot/AutoMemMap.h | 2 +- tools/profiler/public/GeckoProfilerImpl.h | 2 +- xpcom/glue/AutoRestore.h | 2 +- xpcom/glue/Mutex.h | 4 ++-- 74 files changed, 128 insertions(+), 128 deletions(-) diff --git a/docshell/base/timeline/AutoGlobalTimelineMarker.h b/docshell/base/timeline/AutoGlobalTimelineMarker.h index de6ea15c0f5..22983ebefe7 100644 --- a/docshell/base/timeline/AutoGlobalTimelineMarker.h +++ b/docshell/base/timeline/AutoGlobalTimelineMarker.h @@ -29,7 +29,7 @@ namespace mozilla { // cc->Collect(); // ... // } -class MOZ_STACK_CLASS AutoGlobalTimelineMarker +class MOZ_RAII AutoGlobalTimelineMarker { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; diff --git a/docshell/base/timeline/AutoTimelineMarker.h b/docshell/base/timeline/AutoTimelineMarker.h index b024660971f..7f010736080 100644 --- a/docshell/base/timeline/AutoTimelineMarker.h +++ b/docshell/base/timeline/AutoTimelineMarker.h @@ -28,7 +28,7 @@ namespace mozilla { // nsresult rv = ParseTheCSSFile(mFile); // ... // } -class MOZ_STACK_CLASS AutoTimelineMarker +class MOZ_RAII AutoTimelineMarker { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; diff --git a/dom/base/ScriptSettings.h b/dom/base/ScriptSettings.h index 573d7869b9d..7b04425223b 100644 --- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -412,7 +412,7 @@ private: * passed as a parameter. AutoJSContext will take care of finding the most * appropriate JS context and release it when leaving the stack. */ -class MOZ_STACK_CLASS AutoJSContext { +class MOZ_RAII AutoJSContext { public: explicit AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); operator JSContext*() const; @@ -434,7 +434,7 @@ protected: * Use ThreadsafeAutoJSContext when you want an AutoJSContext but might be * running on a worker thread. */ -class MOZ_STACK_CLASS ThreadsafeAutoJSContext { +class MOZ_RAII ThreadsafeAutoJSContext { public: explicit ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); operator JSContext*() const; @@ -452,7 +452,7 @@ private: * * Note - This is deprecated. Please use AutoJSAPI instead. */ -class MOZ_STACK_CLASS AutoSafeJSContext : public AutoJSContext { +class MOZ_RAII AutoSafeJSContext : public AutoJSContext { public: explicit AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); private: @@ -462,7 +462,7 @@ private: /** * Like AutoSafeJSContext but can be used safely on worker threads. */ -class MOZ_STACK_CLASS ThreadsafeAutoSafeJSContext { +class MOZ_RAII ThreadsafeAutoSafeJSContext { public: explicit ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); operator JSContext*() const; diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 9ec4b62f772..bfe67f45645 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -2651,7 +2651,7 @@ private: #endif }; -class MOZ_STACK_CLASS nsAutoScriptBlocker { +class MOZ_RAII nsAutoScriptBlocker { public: explicit nsAutoScriptBlocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index 5e41edc2a08..de1d249a4ec 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -634,7 +634,7 @@ AllDescendantsOfType(nsIDocShellTreeItem* aParentItem, int32_t aType) * A class that automatically sets mInShow to false when it goes * out of scope. */ -class MOZ_STACK_CLASS AutoResetInShow { +class MOZ_RAII AutoResetInShow { private: nsFrameLoader* mFrameLoader; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER @@ -989,7 +989,7 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther, return NS_OK; } -class MOZ_STACK_CLASS AutoResetInFrameSwap final +class MOZ_RAII AutoResetInFrameSwap final { public: AutoResetInFrameSwap(nsFrameLoader* aThisFrameLoader, diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index f822d9a6230..57adbb097f4 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -2266,7 +2266,7 @@ void DoTraceSequence(JSTracer* trc, InfallibleTArray& seq) // Rooter class for sequences; this is what we mostly use in the codegen template -class MOZ_STACK_CLASS SequenceRooter : private JS::CustomAutoRooter +class MOZ_RAII SequenceRooter : private JS::CustomAutoRooter { public: SequenceRooter(JSContext *aCx, FallibleTArray* aSequence @@ -2325,7 +2325,7 @@ public: // Rooter class for MozMap; this is what we mostly use in the codegen. template -class MOZ_STACK_CLASS MozMapRooter : private JS::CustomAutoRooter +class MOZ_RAII MozMapRooter : private JS::CustomAutoRooter { public: MozMapRooter(JSContext *aCx, MozMap* aMozMap @@ -2371,8 +2371,8 @@ private: }; template -class MOZ_STACK_CLASS RootedUnion : public T, - private JS::CustomAutoRooter +class MOZ_RAII RootedUnion : public T, + private JS::CustomAutoRooter { public: explicit RootedUnion(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : diff --git a/dom/bindings/RootedDictionary.h b/dom/bindings/RootedDictionary.h index a8f2a79762f..73a6c730a10 100644 --- a/dom/bindings/RootedDictionary.h +++ b/dom/bindings/RootedDictionary.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { template -class MOZ_STACK_CLASS RootedDictionary : public T, +class MOZ_RAII RootedDictionary : public T, private JS::CustomAutoRooter { public: @@ -32,7 +32,7 @@ public: }; template -class MOZ_STACK_CLASS NullableRootedDictionary : public Nullable, +class MOZ_RAII NullableRootedDictionary : public Nullable, private JS::CustomAutoRooter { public: diff --git a/dom/bindings/TypedArray.h b/dom/bindings/TypedArray.h index d4f829f7590..c8c8279e4a3 100644 --- a/dom/bindings/TypedArray.h +++ b/dom/bindings/TypedArray.h @@ -327,7 +327,7 @@ class TypedArrayCreator // A class for rooting an existing TypedArray struct template -class MOZ_STACK_CLASS TypedArrayRooter : private JS::CustomAutoRooter +class MOZ_RAII TypedArrayRooter : private JS::CustomAutoRooter { public: TypedArrayRooter(JSContext* cx, @@ -349,7 +349,7 @@ private: // And a specialization for dealing with nullable typed arrays template struct Nullable; template -class MOZ_STACK_CLASS TypedArrayRooter > : +class MOZ_RAII TypedArrayRooter > : private JS::CustomAutoRooter { public: @@ -373,8 +373,8 @@ private: // Class for easily setting up a rooted typed array object on the stack template -class MOZ_STACK_CLASS RootedTypedArray : public ArrayType, - private TypedArrayRooter +class MOZ_RAII RootedTypedArray : public ArrayType, + private TypedArrayRooter { public: explicit RootedTypedArray(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : diff --git a/dom/media/MediaResource.h b/dom/media/MediaResource.h index 041144f8d61..160404e3337 100644 --- a/dom/media/MediaResource.h +++ b/dom/media/MediaResource.h @@ -794,7 +794,7 @@ protected: * us. */ template -class MOZ_STACK_CLASS AutoPinned { +class MOZ_RAII AutoPinned { public: explicit AutoPinned(T* aResource MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : mResource(aResource) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index e47bc11fa3d..178b9f0c58f 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -306,7 +306,7 @@ public: return sIsLoadModuleOnStack; } - class MOZ_STACK_CLASS NotifyLoadingModule + class MOZ_RAII NotifyLoadingModule { public: explicit NotifyLoadingModule(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) diff --git a/dom/svg/DOMSVGLength.cpp b/dom/svg/DOMSVGLength.cpp index 3e1f8aca618..f5940a50645 100644 --- a/dom/svg/DOMSVGLength.cpp +++ b/dom/svg/DOMSVGLength.cpp @@ -66,7 +66,7 @@ NS_INTERFACE_MAP_END // Helper class: AutoChangeLengthNotifier // Stack-based helper class to pair calls to WillChangeLengthList and // DidChangeLengthList. -class MOZ_STACK_CLASS AutoChangeLengthNotifier +class MOZ_RAII AutoChangeLengthNotifier { public: explicit AutoChangeLengthNotifier(DOMSVGLength* aLength MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGLengthList.cpp b/dom/svg/DOMSVGLengthList.cpp index 1788d7a3980..7d341d130ef 100644 --- a/dom/svg/DOMSVGLengthList.cpp +++ b/dom/svg/DOMSVGLengthList.cpp @@ -79,7 +79,7 @@ DOMSVGLengthList::WrapObject(JSContext *cx, JS::Handle aGivenProto) // Helper class: AutoChangeLengthListNotifier // Stack-based helper class to pair calls to WillChangeLengthList and // DidChangeLengthList. -class MOZ_STACK_CLASS AutoChangeLengthListNotifier +class MOZ_RAII AutoChangeLengthListNotifier { public: explicit AutoChangeLengthListNotifier(DOMSVGLengthList* aLengthList MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGNumber.cpp b/dom/svg/DOMSVGNumber.cpp index d75fa96f6b1..d9a014a0ca1 100644 --- a/dom/svg/DOMSVGNumber.cpp +++ b/dom/svg/DOMSVGNumber.cpp @@ -53,7 +53,7 @@ NS_INTERFACE_MAP_END // Helper class: AutoChangeNumberNotifier // Stack-based helper class to pair calls to WillChangeNumberList and // DidChangeNumberList. -class MOZ_STACK_CLASS AutoChangeNumberNotifier +class MOZ_RAII AutoChangeNumberNotifier { public: explicit AutoChangeNumberNotifier(DOMSVGNumber* aNumber MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGNumberList.cpp b/dom/svg/DOMSVGNumberList.cpp index 9df233c85b9..6aad17c2064 100644 --- a/dom/svg/DOMSVGNumberList.cpp +++ b/dom/svg/DOMSVGNumberList.cpp @@ -80,7 +80,7 @@ DOMSVGNumberList::WrapObject(JSContext *cx, JS::Handle aGivenProto) // Helper class: AutoChangeNumberListNotifier // Stack-based helper class to pair calls to WillChangeNumberList and // DidChangeNumberList. -class MOZ_STACK_CLASS AutoChangeNumberListNotifier +class MOZ_RAII AutoChangeNumberListNotifier { public: explicit AutoChangeNumberListNotifier(DOMSVGNumberList* aNumberList MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGPathSeg.cpp b/dom/svg/DOMSVGPathSeg.cpp index 1b2f19e564c..521420e8f46 100644 --- a/dom/svg/DOMSVGPathSeg.cpp +++ b/dom/svg/DOMSVGPathSeg.cpp @@ -45,7 +45,7 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGPathSeg, Release) // Helper class: AutoChangePathSegNotifier // Stack-based helper class to pair calls to WillChangePathSegList // and DidChangePathSegList. -class MOZ_STACK_CLASS AutoChangePathSegNotifier +class MOZ_RAII AutoChangePathSegNotifier { public: explicit AutoChangePathSegNotifier(DOMSVGPathSeg* aPathSeg MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGPathSegList.cpp b/dom/svg/DOMSVGPathSegList.cpp index 0a0c28f730b..78fa31c6054 100644 --- a/dom/svg/DOMSVGPathSegList.cpp +++ b/dom/svg/DOMSVGPathSegList.cpp @@ -55,7 +55,7 @@ NS_INTERFACE_MAP_END // Helper class: AutoChangePathSegListNotifier // Stack-based helper class to pair calls to WillChangePathSegList and // DidChangePathSegList. -class MOZ_STACK_CLASS AutoChangePathSegListNotifier +class MOZ_RAII AutoChangePathSegListNotifier { public: explicit AutoChangePathSegListNotifier(DOMSVGPathSegList* aPathSegList MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGPoint.cpp b/dom/svg/DOMSVGPoint.cpp index 20da6ae04b5..05d5754906c 100644 --- a/dom/svg/DOMSVGPoint.cpp +++ b/dom/svg/DOMSVGPoint.cpp @@ -23,7 +23,7 @@ namespace mozilla { // Helper class: AutoChangePointNotifier // Stack-based helper class to pair calls to WillChangePointList and // DidChangePointList. -class MOZ_STACK_CLASS AutoChangePointNotifier +class MOZ_RAII AutoChangePointNotifier { public: explicit AutoChangePointNotifier(DOMSVGPoint* aPoint MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGPointList.cpp b/dom/svg/DOMSVGPointList.cpp index 9c52471e63c..31315c028ec 100644 --- a/dom/svg/DOMSVGPointList.cpp +++ b/dom/svg/DOMSVGPointList.cpp @@ -73,7 +73,7 @@ NS_INTERFACE_MAP_END // Helper class: AutoChangePointListNotifier // Stack-based helper class to pair calls to WillChangePointList and // DidChangePointList. -class MOZ_STACK_CLASS AutoChangePointListNotifier +class MOZ_RAII AutoChangePointListNotifier { public: explicit AutoChangePointListNotifier(DOMSVGPointList* aPointList MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGStringList.cpp b/dom/svg/DOMSVGStringList.cpp index 81004993d9b..35e54213b0c 100644 --- a/dom/svg/DOMSVGStringList.cpp +++ b/dom/svg/DOMSVGStringList.cpp @@ -43,7 +43,7 @@ NS_INTERFACE_MAP_END // Helper class: AutoChangeStringListNotifier // Stack-based helper class to pair calls to WillChangeStringListList and // DidChangeStringListList. -class MOZ_STACK_CLASS AutoChangeStringListNotifier +class MOZ_RAII AutoChangeStringListNotifier { public: explicit AutoChangeStringListNotifier(DOMSVGStringList* aStringList MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/DOMSVGTransformList.cpp b/dom/svg/DOMSVGTransformList.cpp index 87930c994db..b5554262d56 100644 --- a/dom/svg/DOMSVGTransformList.cpp +++ b/dom/svg/DOMSVGTransformList.cpp @@ -81,7 +81,7 @@ DOMSVGTransformList::WrapObject(JSContext *cx, JS::Handle aGivenProto // Helper class: AutoChangeTransformListNotifier // Stack-based helper class to pair calls to WillChangeTransformList and // DidChangeTransformList. -class MOZ_STACK_CLASS AutoChangeTransformListNotifier +class MOZ_RAII AutoChangeTransformListNotifier { public: explicit AutoChangeTransformListNotifier(DOMSVGTransformList* aTransformList MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/svg/SVGSVGElement.h b/dom/svg/SVGSVGElement.h index f331e91e4c4..fb75752b0bb 100644 --- a/dom/svg/SVGSVGElement.h +++ b/dom/svg/SVGSVGElement.h @@ -407,7 +407,7 @@ private: // Helper class to automatically manage temporary changes to an SVG document's // state for rendering purposes. -class MOZ_STACK_CLASS AutoSVGRenderingState +class MOZ_RAII AutoSVGRenderingState { public: AutoSVGRenderingState(const Maybe& aSVGContext, diff --git a/dom/svg/SVGTransform.cpp b/dom/svg/SVGTransform.cpp index daa09644b14..e6574a86cac 100644 --- a/dom/svg/SVGTransform.cpp +++ b/dom/svg/SVGTransform.cpp @@ -71,7 +71,7 @@ SVGTransform::WrapObject(JSContext* aCx, JS::Handle aGivenProto) // Helper class: AutoChangeTransformNotifier // Stack-based helper class to pair calls to WillChangeTransformList // and DidChangeTransformList. -class MOZ_STACK_CLASS AutoChangeTransformNotifier +class MOZ_RAII AutoChangeTransformNotifier { public: explicit AutoChangeTransformNotifier(SVGTransform* aTransform MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 291eeeff28f..6bd41f337c3 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -543,7 +543,7 @@ class EventRunnable final : public MainThreadProxyRunnable nsresult mResponseResult; public: - class StateDataAutoRooter : private JS::CustomAutoRooter + class MOZ_RAII StateDataAutoRooter : private JS::CustomAutoRooter { XMLHttpRequest::StateData* mStateData; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER diff --git a/editor/libeditor/nsEditorUtils.h b/editor/libeditor/nsEditorUtils.h index 0d8248174ef..ab2552f9ea9 100644 --- a/editor/libeditor/nsEditorUtils.h +++ b/editor/libeditor/nsEditorUtils.h @@ -31,7 +31,7 @@ class Selection; * stack based helper class for batching a collection of txns inside a * placeholder txn. */ -class MOZ_STACK_CLASS nsAutoPlaceHolderBatch +class MOZ_RAII nsAutoPlaceHolderBatch { private: nsCOMPtr mEd; @@ -58,7 +58,7 @@ class MOZ_STACK_CLASS nsAutoPlaceHolderBatch * Note: I changed this to use placeholder batching so that we get * proper selection save/restore across undo/redo. */ -class MOZ_STACK_CLASS nsAutoEditBatch : public nsAutoPlaceHolderBatch +class MOZ_RAII nsAutoEditBatch : public nsAutoPlaceHolderBatch { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER public: @@ -74,7 +74,7 @@ class MOZ_STACK_CLASS nsAutoEditBatch : public nsAutoPlaceHolderBatch * stack based helper class for saving/restoring selection. Note that this * assumes that the nodes involved are still around afterwards! */ -class MOZ_STACK_CLASS nsAutoSelectionReset +class MOZ_RAII nsAutoSelectionReset { private: /** ref-counted reference to the selection that we are supposed to restore */ @@ -96,7 +96,7 @@ class MOZ_STACK_CLASS nsAutoSelectionReset /*************************************************************************** * stack based helper class for StartOperation()/EndOperation() sandwich */ -class MOZ_STACK_CLASS nsAutoRules +class MOZ_RAII nsAutoRules { public: @@ -131,7 +131,7 @@ class MOZ_STACK_CLASS nsAutoRules * stack based helper class for turning off active selection adjustment * by low level transactions */ -class MOZ_STACK_CLASS nsAutoTxnsConserveSelection +class MOZ_RAII nsAutoTxnsConserveSelection { public: @@ -163,7 +163,7 @@ class MOZ_STACK_CLASS nsAutoTxnsConserveSelection /*************************************************************************** * stack based helper class for batching reflow and paint requests. */ -class MOZ_STACK_CLASS nsAutoUpdateViewBatch +class MOZ_RAII nsAutoUpdateViewBatch { public: @@ -197,7 +197,7 @@ class nsBoolDomIterFunctor virtual bool operator()(nsINode* aNode) const = 0; }; -class MOZ_STACK_CLASS nsDOMIterator +class MOZ_RAII nsDOMIterator { public: explicit nsDOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); @@ -214,7 +214,7 @@ class MOZ_STACK_CLASS nsDOMIterator MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class MOZ_STACK_CLASS nsDOMSubtreeIterator : public nsDOMIterator +class MOZ_RAII nsDOMSubtreeIterator : public nsDOMIterator { public: explicit nsDOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 1b50a5cefa2..9341ba5cdef 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -277,7 +277,7 @@ private: namespace { -class MOZ_STACK_CLASS MaybeScriptBlocker { +class MOZ_RAII MaybeScriptBlocker { public: explicit MaybeScriptBlocker(MessageChannel *aChannel, bool aBlock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/ipc/glue/Neutering.h b/ipc/glue/Neutering.h index ea1a2bf5e9a..70657c53c19 100644 --- a/ipc/glue/Neutering.h +++ b/ipc/glue/Neutering.h @@ -23,7 +23,7 @@ namespace ipc { * current thread will be neutered. It is safe to nest multiple instances of * this class. */ -class MOZ_STACK_CLASS NeuteredWindowRegion +class MOZ_RAII NeuteredWindowRegion { public: explicit NeuteredWindowRegion(bool aDoNeuter MOZ_GUARD_OBJECT_NOTIFIER_PARAM); @@ -46,7 +46,7 @@ private: * disabling neutering for the remainder of its enclosing block. * @see NeuteredWindowRegion */ -class MOZ_STACK_CLASS DeneuteredWindowRegion +class MOZ_RAII DeneuteredWindowRegion { public: DeneuteredWindowRegion(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); diff --git a/js/ipc/CPOWTimer.h b/js/ipc/CPOWTimer.h index 898806c64ab..91dc66fd7fc 100644 --- a/js/ipc/CPOWTimer.h +++ b/js/ipc/CPOWTimer.h @@ -20,7 +20,7 @@ * This stopwatch is active iff JSRuntime::stopwatch.isActive is set. * Upon destruction, update JSRuntime::stopwatch.data.totalCPOWTime. */ -class MOZ_STACK_CLASS CPOWTimer final { +class MOZ_RAII CPOWTimer final { public: explicit inline CPOWTimer(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM); ~CPOWTimer(); diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 8995115d873..705082f8755 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -654,7 +654,7 @@ namespace JS { * specialization, define a RootedBase specialization containing them. */ template -class MOZ_STACK_CLASS Rooted : public js::RootedBase +class MOZ_RAII Rooted : public js::RootedBase { static_assert(!mozilla::IsConvertible::value, "Rooted takes pointer or Traceable types but not Traceable* type"); @@ -777,7 +777,7 @@ class HandleBase /* Interface substitute for Rooted which does not root the variable's memory. */ template -class FakeRooted : public RootedBase +class MOZ_RAII FakeRooted : public RootedBase { public: template diff --git a/js/src/ds/LifoAlloc.h b/js/src/ds/LifoAlloc.h index 80e0ee503f8..14a97c93a40 100644 --- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -482,7 +482,7 @@ class LifoAlloc }; }; -class LifoAllocScope +class MOZ_NON_TEMPORARY_CLASS LifoAllocScope { LifoAlloc* lifoAlloc; LifoAlloc::Mark mark; diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index 0c07eace019..f1913851380 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -92,7 +92,7 @@ IsIncrementalGCSafe(JSRuntime* rt); #ifdef JS_GC_ZEAL -class AutoStopVerifyingBarriers +class MOZ_RAII AutoStopVerifyingBarriers { GCRuntime* gc; bool restartPreVerifier; @@ -152,7 +152,7 @@ struct MovingTracer : JS::CallbackTracer #endif }; -class AutoMaybeStartBackgroundAllocation +class MOZ_RAII AutoMaybeStartBackgroundAllocation { private: JSRuntime* runtime; @@ -176,7 +176,7 @@ class AutoMaybeStartBackgroundAllocation }; // In debug builds, set/unset the GC sweeping flag for the current thread. -struct AutoSetThreadIsSweeping +struct MOZ_RAII AutoSetThreadIsSweeping { #ifdef DEBUG explicit AutoSetThreadIsSweeping(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 5e6c1b143e7..5e0f7f6ed15 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -331,7 +331,7 @@ struct Statistics double computeMMU(int64_t resolution) const; }; -struct AutoGCSlice +struct MOZ_RAII AutoGCSlice { AutoGCSlice(Statistics& stats, const ZoneGCStats& zoneStats, JSGCInvocationKind gckind, SliceBudget budget, JS::gcreason::Reason reason @@ -347,7 +347,7 @@ struct AutoGCSlice MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -struct AutoPhase +struct MOZ_RAII AutoPhase { AutoPhase(Statistics& stats, Phase phase MOZ_GUARD_OBJECT_NOTIFIER_PARAM) @@ -391,7 +391,7 @@ struct AutoPhase MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -struct AutoSCC +struct MOZ_RAII AutoSCC { AutoSCC(Statistics& stats, unsigned scc MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index 2408bd293aa..69a0e2976e1 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -518,7 +518,7 @@ FinishAllOffThreadCompilations(JSCompartment* comp) } } -class AutoLazyLinkExitFrame +class MOZ_RAII AutoLazyLinkExitFrame { JitActivation* jitActivation_; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER diff --git a/js/src/jit/JitSpewer.cpp b/js/src/jit/JitSpewer.cpp index afce391b0a8..3a9b53ebed7 100644 --- a/js/src/jit/JitSpewer.cpp +++ b/js/src/jit/JitSpewer.cpp @@ -75,7 +75,7 @@ class IonSpewer } }; -class AutoLockIonSpewerOutput +class MOZ_RAII AutoLockIonSpewerOutput { private: MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 7faf2859fd0..c4a1c980342 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -67,7 +67,7 @@ class JS_PUBLIC_API(AutoCheckRequestDepth) /* AutoValueArray roots an internal fixed-size array of Values. */ template -class AutoValueArray : public AutoGCRooter +class MOZ_RAII AutoValueArray : public AutoGCRooter { const size_t length_; Value elements_[N]; @@ -99,7 +99,7 @@ class AutoValueArray : public AutoGCRooter }; template -class AutoVectorRooterBase : protected AutoGCRooter +class MOZ_RAII AutoVectorRooterBase : protected AutoGCRooter { typedef js::Vector VectorImpl; VectorImpl vector; @@ -196,7 +196,7 @@ class AutoVectorRooterBase : protected AutoGCRooter }; template -class MOZ_STACK_CLASS AutoVectorRooter : public AutoVectorRooterBase +class MOZ_RAII AutoVectorRooter : public AutoVectorRooterBase { public: explicit AutoVectorRooter(JSContext* cx @@ -225,7 +225,7 @@ using IdVector = js::TraceableVector; using ScriptVector = js::TraceableVector; template -class AutoHashMapRooter : protected AutoGCRooter +class MOZ_RAII AutoHashMapRooter : protected AutoGCRooter { private: typedef js::HashMap HashMapImpl; @@ -349,7 +349,7 @@ class AutoHashMapRooter : protected AutoGCRooter }; template -class AutoHashSetRooter : protected AutoGCRooter +class MOZ_RAII AutoHashSetRooter : protected AutoGCRooter { private: typedef js::HashSet HashSetImpl; @@ -460,7 +460,7 @@ class AutoHashSetRooter : protected AutoGCRooter /* * Custom rooting behavior for internal and external clients. */ -class JS_PUBLIC_API(CustomAutoRooter) : private AutoGCRooter +class MOZ_RAII JS_PUBLIC_API(CustomAutoRooter) : private AutoGCRooter { public: template @@ -1070,7 +1070,7 @@ AssertHeapIsIdle(JSContext* cx); } /* namespace js */ -class JSAutoRequest +class MOZ_RAII JSAutoRequest { public: explicit JSAutoRequest(JSContext* cx @@ -1409,7 +1409,7 @@ JS_RefreshCrossCompartmentWrappers(JSContext* cx, JS::Handle obj); * the corresponding JS_LeaveCompartment call. */ -class JS_PUBLIC_API(JSAutoCompartment) +class MOZ_RAII JS_PUBLIC_API(JSAutoCompartment) { JSContext* cx_; JSCompartment* oldCompartment_; @@ -1423,7 +1423,7 @@ class JS_PUBLIC_API(JSAutoCompartment) MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class JS_PUBLIC_API(JSAutoNullableCompartment) +class MOZ_RAII JS_PUBLIC_API(JSAutoNullableCompartment) { JSContext* cx_; JSCompartment* oldCompartment_; @@ -4227,7 +4227,7 @@ JS_GetStringEncodingLength(JSContext* cx, JSString* str); JS_PUBLIC_API(size_t) JS_EncodeStringToBuffer(JSContext* cx, JSString* str, char* buffer, size_t length); -class JSAutoByteString +class MOZ_RAII JSAutoByteString { public: JSAutoByteString(JSContext* cx, JSString* str @@ -5039,7 +5039,7 @@ HideScriptedCaller(JSContext* cx); extern JS_PUBLIC_API(void) UnhideScriptedCaller(JSContext* cx); -class AutoHideScriptedCaller +class MOZ_RAII AutoHideScriptedCaller { public: explicit AutoHideScriptedCaller(JSContext* cx diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 8b2ee8e58df..d315c68049b 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -33,7 +33,7 @@ typedef HashSet ObjectSet; typedef HashSet ShapeSet; /* Detects cycles when traversing an object graph. */ -class AutoCycleDetector +class MOZ_RAII AutoCycleDetector { JSContext* cx; RootedObject obj; @@ -466,7 +466,7 @@ struct JSContext : public js::ExclusiveContext, namespace js { -struct AutoResolving { +struct MOZ_RAII AutoResolving { public: enum Kind { LOOKUP, @@ -670,7 +670,7 @@ using ShapeVector = js::TraceableVector; using StringVector = js::TraceableVector; /* AutoArrayRooter roots an external array of Values. */ -class AutoArrayRooter : private JS::AutoGCRooter +class MOZ_RAII AutoArrayRooter : private JS::AutoGCRooter { public: AutoArrayRooter(JSContext* cx, size_t len, Value* vec @@ -749,7 +749,7 @@ class AutoAssertNoException /* Exposed intrinsics for the JITs. */ bool intrinsic_IsSuspendedStarGenerator(JSContext* cx, unsigned argc, Value* vp); -class AutoLockForExclusiveAccess +class MOZ_RAII AutoLockForExclusiveAccess { JSRuntime* runtime; diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index 9c87280477c..c1feed7b170 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -185,7 +185,7 @@ using NewObjectMetadataState = mozilla::Variant; -class MOZ_STACK_CLASS AutoSetNewObjectMetadata : private JS::CustomAutoRooter +class MOZ_RAII AutoSetNewObjectMetadata : private JS::CustomAutoRooter { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; @@ -764,7 +764,7 @@ ExclusiveContext::global() const return Handle::fromMarkedLocation(compartment_->global_.unsafeGet()); } -class AssertCompartmentUnchanged +class MOZ_RAII AssertCompartmentUnchanged { public: explicit AssertCompartmentUnchanged(JSContext* cx @@ -862,7 +862,7 @@ struct WrapperValue Value value; }; -class AutoWrapperVector : public JS::AutoVectorRooterBase +class MOZ_RAII AutoWrapperVector : public JS::AutoVectorRooterBase { public: explicit AutoWrapperVector(JSContext* cx @@ -875,7 +875,7 @@ class AutoWrapperVector : public JS::AutoVectorRooterBase MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class AutoWrapperRooter : private JS::AutoGCRooter { +class MOZ_RAII AutoWrapperRooter : private JS::AutoGCRooter { public: AutoWrapperRooter(JSContext* cx, WrapperValue v MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index bd75bf74a93..beb62e339d4 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -2694,7 +2694,7 @@ typedef void JS_FRIEND_API(void) SetCTypesActivityCallback(JSRuntime* rt, CTypesActivityCallback cb); -class JS_FRIEND_API(AutoCTypesActivityCallback) { +class MOZ_RAII JS_FRIEND_API(AutoCTypesActivityCallback) { private: JSContext* cx; CTypesActivityCallback callback; diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 7acaac005d9..908e9e801a8 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -1374,7 +1374,7 @@ NewMemoryStatisticsObject(JSContext* cx); #ifdef DEBUG /* Use this to avoid assertions when manipulating the wrapper map. */ -class AutoDisableProxyCheck +class MOZ_RAII AutoDisableProxyCheck { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; gc::GCRuntime& gc; diff --git a/js/src/jsutil.h b/js/src/jsutil.h index 431f186b6bc..3e163c86cb0 100644 --- a/js/src/jsutil.h +++ b/js/src/jsutil.h @@ -168,7 +168,7 @@ ImplicitCast(U& u) } template -class AutoScopedAssign +class MOZ_RAII AutoScopedAssign { public: AutoScopedAssign(T* addr, const T& value diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index a05928680ec..ebe82df3d9f 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -3400,7 +3400,7 @@ runOffThreadScript(JSContext* cx, unsigned argc, Value* vp) return JS_ExecuteScript(cx, script, args.rval()); } -struct FreeOnReturn +struct MOZ_RAII FreeOnReturn { JSContext* cx; const char* ptr; diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index da0d7007df2..716decde200 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -1824,7 +1824,7 @@ Debugger::slowPathPromiseHook(JSContext* cx, Hook hook, HandleObject promise) /*** Debugger code invalidation for observing execution ******************************************/ -class MOZ_STACK_CLASS ExecutionObservableCompartments : public Debugger::ExecutionObservableSet +class MOZ_RAII ExecutionObservableCompartments : public Debugger::ExecutionObservableSet { HashSet compartments_; HashSet zones_; @@ -1858,7 +1858,7 @@ class MOZ_STACK_CLASS ExecutionObservableCompartments : public Debugger::Executi // represents the stack frames that need to be bailed out or marked as // debuggees, and the scripts that need to be recompiled, taking inlining into // account. -class MOZ_STACK_CLASS ExecutionObservableFrame : public Debugger::ExecutionObservableSet +class MOZ_RAII ExecutionObservableFrame : public Debugger::ExecutionObservableSet { AbstractFramePtr frame_; @@ -1919,7 +1919,7 @@ class MOZ_STACK_CLASS ExecutionObservableFrame : public Debugger::ExecutionObser MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class MOZ_STACK_CLASS ExecutionObservableScript : public Debugger::ExecutionObservableSet +class MOZ_RAII ExecutionObservableScript : public Debugger::ExecutionObservableSet { RootedScript script_; diff --git a/js/src/vm/HelperThreads.h b/js/src/vm/HelperThreads.h index 9fdfb275fd7..30fcfc49371 100644 --- a/js/src/vm/HelperThreads.h +++ b/js/src/vm/HelperThreads.h @@ -412,7 +412,7 @@ struct AutoEnqueuePendingParseTasksAfterGC { bool StartOffThreadCompression(ExclusiveContext* cx, SourceCompressionTask* task); -class AutoLockHelperThreadState +class MOZ_RAII AutoLockHelperThreadState { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER @@ -428,7 +428,7 @@ class AutoLockHelperThreadState } }; -class AutoUnlockHelperThreadState +class MOZ_RAII AutoUnlockHelperThreadState { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 34416ea63bf..724218e084f 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -375,7 +375,7 @@ namespace js { // All mutable state is stored in `Runtime::stopwatch` (per-process // performance stats and logistics) and in `PerformanceGroup` (per // group performance stats). -class AutoStopwatch final +class MOZ_RAII AutoStopwatch final { // The context with which this object was initialized. // Non-null. diff --git a/js/src/vm/RegExpStatics.h b/js/src/vm/RegExpStatics.h index 1b268bd9fd4..430e4b3527e 100644 --- a/js/src/vm/RegExpStatics.h +++ b/js/src/vm/RegExpStatics.h @@ -186,7 +186,7 @@ class RegExpStatics } }; -class AutoRegExpStaticsBuffer : private JS::CustomAutoRooter +class MOZ_RAII AutoRegExpStaticsBuffer : private JS::CustomAutoRooter { public: explicit AutoRegExpStaticsBuffer(JSContext* cx diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 7aef80c5df1..68d1e366e30 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -1864,7 +1864,7 @@ FreeOp::freeLater(void* p) * Note that the lock may be temporarily released by use of AutoUnlockGC when * passed a non-const reference to this class. */ -class MOZ_STACK_CLASS AutoLockGC +class MOZ_RAII AutoLockGC { public: explicit AutoLockGC(JSRuntime* rt @@ -1903,7 +1903,7 @@ class MOZ_STACK_CLASS AutoLockGC AutoLockGC& operator=(const AutoLockGC&) = delete; }; -class MOZ_STACK_CLASS AutoUnlockGC +class MOZ_RAII AutoUnlockGC { public: explicit AutoUnlockGC(AutoLockGC& lock @@ -1926,7 +1926,7 @@ class MOZ_STACK_CLASS AutoUnlockGC AutoUnlockGC& operator=(const AutoUnlockGC&) = delete; }; -class MOZ_STACK_CLASS AutoKeepAtoms +class MOZ_RAII AutoKeepAtoms { PerThreadData* pt; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER @@ -2095,7 +2095,7 @@ extern const JSSecurityCallbacks NullSecurityCallbacks; // Debugging RAII class which marks the current thread as performing an Ion // compilation, for use by CurrentThreadCan{Read,Write}CompilationData -class AutoEnterIonCompilation +class MOZ_RAII AutoEnterIonCompilation { public: explicit AutoEnterIonCompilation(bool safeForMinorGC diff --git a/js/src/vm/SPSProfiler.h b/js/src/vm/SPSProfiler.h index a7106084d08..a5e6bc78c6d 100644 --- a/js/src/vm/SPSProfiler.h +++ b/js/src/vm/SPSProfiler.h @@ -227,7 +227,7 @@ class AutoSPSLock * This class is used to suppress profiler sampling during * critical sections where stack state is not valid. */ -class AutoSuppressProfilerSampling +class MOZ_RAII AutoSuppressProfilerSampling { public: explicit AutoSuppressProfilerSampling(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM); @@ -260,7 +260,7 @@ SPSProfiler::stringsReset() * that we're about to enter JS function calls. This is the only time in which a * valid stack pointer is pushed to the sampling stack. */ -class SPSEntryMarker +class MOZ_RAII SPSEntryMarker { public: explicit SPSEntryMarker(JSRuntime* rt, @@ -279,7 +279,7 @@ class SPSEntryMarker * being entered via OSR. It marks the current top pseudostack entry as * OSR-ed */ -class SPSBaselineOSRMarker +class MOZ_RAII SPSBaselineOSRMarker { public: explicit SPSBaselineOSRMarker(JSRuntime* rt, bool hasSPSFrame diff --git a/js/src/vm/SavedStacks.h b/js/src/vm/SavedStacks.h index 359665eb391..977937c0497 100644 --- a/js/src/vm/SavedStacks.h +++ b/js/src/vm/SavedStacks.h @@ -181,7 +181,7 @@ class SavedStacks { // Similar to mozilla::ReentrancyGuard, but instead of asserting against // reentrancy, just change the behavior of SavedStacks::saveCurrentStack to // return a nullptr SavedFrame. - struct MOZ_STACK_CLASS AutoReentrancyGuard { + struct MOZ_RAII AutoReentrancyGuard { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; SavedStacks& stacks; diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index e215af0eec8..cdefbbb4065 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -825,7 +825,7 @@ CloneNestedScopeObject(JSContext* cx, HandleObject enclosingScope, Handle ssi_; RootedObject scope_; diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index 99203669a27..b17874ddfe2 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -982,7 +982,7 @@ StackBaseShape::StackBaseShape(Shape* shape) compartment(shape->compartment()) {} -class AutoRooterGetterSetter +class MOZ_RAII AutoRooterGetterSetter { class Inner : private JS::CustomAutoRooter { diff --git a/js/src/vm/TraceLogging.h b/js/src/vm/TraceLogging.h index 1ac21a16a83..9ba78edcfb5 100644 --- a/js/src/vm/TraceLogging.h +++ b/js/src/vm/TraceLogging.h @@ -439,7 +439,7 @@ inline void TraceLogStopEventPrivate(TraceLoggerThread* logger, uint32_t id) { } // Automatic logging at the start and end of function call. -class AutoTraceLog +class MOZ_RAII AutoTraceLog { #ifdef JS_TRACE_LOGGING TraceLoggerThread* logger; diff --git a/js/src/vm/TraceLoggingGraph.cpp b/js/src/vm/TraceLoggingGraph.cpp index d1b7f2e5db9..d5a7b8b7350 100644 --- a/js/src/vm/TraceLoggingGraph.cpp +++ b/js/src/vm/TraceLoggingGraph.cpp @@ -24,7 +24,7 @@ using mozilla::NativeEndian; TraceLoggerGraphState* traceLoggerGraphState = nullptr; -class AutoTraceLoggerGraphStateLock +class MOZ_RAII AutoTraceLoggerGraphStateLock { TraceLoggerGraphState* graph; diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index ac69ebbb843..15e118df71e 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -3040,7 +3040,7 @@ private: /****************************************************************************** * Handles pre/post script processing. */ -class MOZ_STACK_CLASS AutoScriptEvaluate +class MOZ_RAII AutoScriptEvaluate { public: /** @@ -3077,7 +3077,7 @@ private: }; /***************************************************************************/ -class MOZ_STACK_CLASS AutoResolveName +class MOZ_RAII AutoResolveName { public: AutoResolveName(XPCCallContext& ccx, JS::HandleId name diff --git a/layout/generic/Selection.h b/layout/generic/Selection.h index 62663c01fa7..b0cfacd3c3e 100644 --- a/layout/generic/Selection.h +++ b/layout/generic/Selection.h @@ -217,7 +217,7 @@ public: nsresult NotifySelectionListeners(); friend struct AutoApplyUserSelectStyle; - struct MOZ_STACK_CLASS AutoApplyUserSelectStyle + struct MOZ_RAII AutoApplyUserSelectStyle { explicit AutoApplyUserSelectStyle(Selection* aSelection MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 959266d45a9..0f442bc07fa 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -3623,7 +3623,7 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext, // RAII class to clean up a list of FlexLines. // Specifically, this removes each line from the list, deletes all the // FlexItems in its list, and deletes the FlexLine. -class MOZ_STACK_CLASS AutoFlexLineListClearer +class MOZ_RAII AutoFlexLineListClearer { public: explicit AutoFlexLineListClearer(LinkedList& aLines diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 0d2fa0afd67..efe9bac6c56 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -332,7 +332,7 @@ IsValidSelectionPoint(nsFrameSelection *aFrameSel, nsINode *aNode) } namespace mozilla { -struct MOZ_STACK_CLASS AutoPrepareFocusRange +struct MOZ_RAII AutoPrepareFocusRange { AutoPrepareFocusRange(Selection* aSelection, bool aContinueSelection, diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 4fe15f6de17..1b776b58a17 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -428,7 +428,7 @@ protected: * state (in a CSSParserInputState object), and it restores the parser to * that state when destructed, unless "DoNotRestore()" has been called. */ - class MOZ_STACK_CLASS nsAutoCSSParserInputStateRestorer { + class MOZ_RAII nsAutoCSSParserInputStateRestorer { public: explicit nsAutoCSSParserInputStateRestorer(CSSParserImpl* aParser MOZ_GUARD_OBJECT_NOTIFIER_PARAM) @@ -476,7 +476,7 @@ protected: * XXXdholbert we could also change this & report errors, if needed. Might * want to customize the error reporting somehow though. */ - class MOZ_STACK_CLASS nsAutoScannerChanger { + class MOZ_RAII nsAutoScannerChanger { public: nsAutoScannerChanger(CSSParserImpl* aParser, const nsAString& aStringToScan diff --git a/layout/style/nsRuleProcessorData.h b/layout/style/nsRuleProcessorData.h index b7f9cc3ea19..b8516776cc6 100644 --- a/layout/style/nsRuleProcessorData.h +++ b/layout/style/nsRuleProcessorData.h @@ -225,7 +225,7 @@ struct MOZ_STACK_CLASS TreeMatchContext { } /* Helper class for maintaining the ancestor state */ - class MOZ_STACK_CLASS AutoAncestorPusher { + class MOZ_RAII AutoAncestorPusher { public: explicit AutoAncestorPusher(TreeMatchContext& aTreeMatchContext MOZ_GUARD_OBJECT_NOTIFIER_PARAM) @@ -295,7 +295,7 @@ struct MOZ_STACK_CLASS TreeMatchContext { * in cases where we may or may not want to be skipping flex/grid-item * style fixup for a particular chunk of code). */ - class MOZ_STACK_CLASS AutoParentDisplayBasedStyleFixupSkipper { + class MOZ_RAII AutoParentDisplayBasedStyleFixupSkipper { public: explicit AutoParentDisplayBasedStyleFixupSkipper(TreeMatchContext& aTreeMatchContext, bool aSkipParentDisplayBasedStyleFixup = true diff --git a/layout/svg/nsSVGClipPathFrame.h b/layout/svg/nsSVGClipPathFrame.h index 8dad2aff791..2674a140ff3 100644 --- a/layout/svg/nsSVGClipPathFrame.h +++ b/layout/svg/nsSVGClipPathFrame.h @@ -104,7 +104,7 @@ public: // automatically sets and clears the mInUse flag on the clip path frame // (to prevent nasty reference loops). It's easy to mess this up // and break things, so this helper makes the code far more robust. - class MOZ_STACK_CLASS AutoClipPathReferencer + class MOZ_RAII AutoClipPathReferencer { public: explicit AutoClipPathReferencer(nsSVGClipPathFrame *aFrame diff --git a/layout/svg/nsSVGFilterFrame.cpp b/layout/svg/nsSVGFilterFrame.cpp index f21d0e137fa..741e91c374e 100644 --- a/layout/svg/nsSVGFilterFrame.cpp +++ b/layout/svg/nsSVGFilterFrame.cpp @@ -27,7 +27,7 @@ NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) NS_IMPL_FRAMEARENA_HELPERS(nsSVGFilterFrame) -class MOZ_STACK_CLASS nsSVGFilterFrame::AutoFilterReferencer +class MOZ_RAII nsSVGFilterFrame::AutoFilterReferencer { public: explicit AutoFilterReferencer(nsSVGFilterFrame *aFrame MOZ_GUARD_OBJECT_NOTIFIER_PARAM) diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index 528acaeaecb..360c594efa1 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -24,7 +24,7 @@ using namespace mozilla::dom; //---------------------------------------------------------------------- // Helper classes -class MOZ_STACK_CLASS nsSVGGradientFrame::AutoGradientReferencer +class MOZ_RAII nsSVGGradientFrame::AutoGradientReferencer { public: explicit AutoGradientReferencer(nsSVGGradientFrame *aFrame diff --git a/layout/svg/nsSVGMarkerFrame.h b/layout/svg/nsSVGMarkerFrame.h index 0e31c37140e..d23fb9f7cbb 100644 --- a/layout/svg/nsSVGMarkerFrame.h +++ b/layout/svg/nsSVGMarkerFrame.h @@ -110,7 +110,7 @@ private: // prevent nasty reference loops) as well as the reference to the marked // frame and its coordinate context. It's easy to mess this up // and break things, so this helper makes the code far more robust. - class MOZ_STACK_CLASS AutoMarkerReferencer + class MOZ_RAII AutoMarkerReferencer { public: AutoMarkerReferencer(nsSVGMarkerFrame *aFrame, diff --git a/layout/svg/nsSVGMaskFrame.h b/layout/svg/nsSVGMaskFrame.h index a93c96898db..f3e4cfbef1d 100644 --- a/layout/svg/nsSVGMaskFrame.h +++ b/layout/svg/nsSVGMaskFrame.h @@ -100,7 +100,7 @@ private: // automatically sets and clears the mInUse flag on the mask frame // (to prevent nasty reference loops). It's easy to mess this up // and break things, so this helper makes the code far more robust. - class MOZ_STACK_CLASS AutoMaskReferencer + class MOZ_RAII AutoMaskReferencer { public: explicit AutoMaskReferencer(nsSVGMaskFrame *aFrame diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index 39b5ecd5ca1..47e1b205e29 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -32,7 +32,7 @@ using namespace mozilla::gfx; //---------------------------------------------------------------------- // Helper classes -class MOZ_STACK_CLASS nsSVGPatternFrame::AutoPatternReferencer +class MOZ_RAII nsSVGPatternFrame::AutoPatternReferencer { public: explicit AutoPatternReferencer(nsSVGPatternFrame *aFrame diff --git a/layout/svg/nsSVGUtils.h b/layout/svg/nsSVGUtils.h index 177b3efd54c..a450c795cc5 100644 --- a/layout/svg/nsSVGUtils.h +++ b/layout/svg/nsSVGUtils.h @@ -137,7 +137,7 @@ private: // GRRR WINDOWS HATE HATE HATE #undef CLIP_MASK -class MOZ_STACK_CLASS SVGAutoRenderState +class MOZ_RAII SVGAutoRenderState { typedef mozilla::gfx::DrawTarget DrawTarget; diff --git a/mfbt/ReentrancyGuard.h b/mfbt/ReentrancyGuard.h index d5142073c1d..9963974e730 100644 --- a/mfbt/ReentrancyGuard.h +++ b/mfbt/ReentrancyGuard.h @@ -16,7 +16,7 @@ namespace mozilla { /* Useful for implementing containers that assert non-reentrancy */ -class ReentrancyGuard +class MOZ_RAII ReentrancyGuard { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER #ifdef DEBUG diff --git a/mfbt/ScopeExit.h b/mfbt/ScopeExit.h index ff38bf47740..7aff82d8a1d 100644 --- a/mfbt/ScopeExit.h +++ b/mfbt/ScopeExit.h @@ -86,7 +86,7 @@ namespace mozilla { template -class ScopeExit { +class MOZ_STACK_CLASS ScopeExit { ExitFunction mExitFunction; bool mExecuteOnDestruction; MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER diff --git a/mfbt/Scoped.h b/mfbt/Scoped.h index 7855cde9500..de8a166f06d 100644 --- a/mfbt/Scoped.h +++ b/mfbt/Scoped.h @@ -77,7 +77,7 @@ namespace mozilla { * } */ template -class Scoped +class MOZ_NON_TEMPORARY_CLASS Scoped { public: typedef typename Traits::type Resource; @@ -187,7 +187,7 @@ private: */ #define SCOPED_TEMPLATE(name, Traits) \ template \ -struct name : public mozilla::Scoped > \ +struct MOZ_NON_TEMPORARY_CLASS name : public mozilla::Scoped > \ { \ typedef mozilla::Scoped > Super; \ typedef typename Super::Resource Resource; \ diff --git a/mozglue/build/WindowsDllBlocklist.h b/mozglue/build/WindowsDllBlocklist.h index e33ec908fe7..b66704764ff 100644 --- a/mozglue/build/WindowsDllBlocklist.h +++ b/mozglue/build/WindowsDllBlocklist.h @@ -18,7 +18,7 @@ NS_IMPORT void DllBlocklist_Initialize(); NS_IMPORT void DllBlocklist_SetInXPCOMLoadOnMainThread(bool inXPCOMLoadOnMainThread); NS_IMPORT void DllBlocklist_WriteNotes(HANDLE file); -class AutoSetXPCOMLoadOnMainThread +class MOZ_RAII AutoSetXPCOMLoadOnMainThread { public: AutoSetXPCOMLoadOnMainThread(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) { diff --git a/toolkit/components/osfile/NativeOSFileInternals.cpp b/toolkit/components/osfile/NativeOSFileInternals.cpp index 0b912a0b756..21932ee086e 100644 --- a/toolkit/components/osfile/NativeOSFileInternals.cpp +++ b/toolkit/components/osfile/NativeOSFileInternals.cpp @@ -91,7 +91,7 @@ struct ScopedArrayBufferContentsTraits { } }; -struct ScopedArrayBufferContents: public Scoped { +struct MOZ_NON_TEMPORARY_CLASS ScopedArrayBufferContents: public Scoped { explicit ScopedArrayBufferContents(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM): Scoped(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT) { } diff --git a/toolkit/components/telemetry/Telemetry.h b/toolkit/components/telemetry/Telemetry.h index 7965718d851..f6a863efb3e 100644 --- a/toolkit/components/telemetry/Telemetry.h +++ b/toolkit/components/telemetry/Telemetry.h @@ -118,7 +118,7 @@ struct AccumulateDelta_impl template -class AutoTimer { +class MOZ_RAII AutoTimer { public: explicit AutoTimer(TimeStamp aStart = TimeStamp::Now() MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : start(aStart) @@ -148,7 +148,7 @@ private: }; template -class AutoCounter { +class MOZ_RAII AutoCounter { public: explicit AutoCounter(uint32_t counterStart = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : counter(counterStart) diff --git a/toolkit/devtools/heapsnapshot/AutoMemMap.h b/toolkit/devtools/heapsnapshot/AutoMemMap.h index e6943a41224..a086a4590b0 100644 --- a/toolkit/devtools/heapsnapshot/AutoMemMap.h +++ b/toolkit/devtools/heapsnapshot/AutoMemMap.h @@ -28,7 +28,7 @@ namespace devtools { // doStuffWithMappedMemory(mm.address()); // } // // The memory is automatically unmapped when the AutoMemMap leaves scope. -class MOZ_STACK_CLASS AutoMemMap +class MOZ_RAII AutoMemMap { MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER; diff --git a/tools/profiler/public/GeckoProfilerImpl.h b/tools/profiler/public/GeckoProfilerImpl.h index 0d81b7d425e..00131766ebc 100644 --- a/tools/profiler/public/GeckoProfilerImpl.h +++ b/tools/profiler/public/GeckoProfilerImpl.h @@ -377,7 +377,7 @@ static inline void profiler_tracing(const char* aCategory, const char* aInfo, namespace mozilla { -class MOZ_STACK_CLASS GeckoProfilerTracingRAII { +class MOZ_RAII GeckoProfilerTracingRAII { public: GeckoProfilerTracingRAII(const char* aCategory, const char* aInfo, mozilla::UniquePtr aBacktrace diff --git a/xpcom/glue/AutoRestore.h b/xpcom/glue/AutoRestore.h index 2a872298469..9ea790035c0 100644 --- a/xpcom/glue/AutoRestore.h +++ b/xpcom/glue/AutoRestore.h @@ -27,7 +27,7 @@ namespace mozilla { * } */ template -class MOZ_STACK_CLASS AutoRestore +class MOZ_RAII AutoRestore { private: T& mLocation; diff --git a/xpcom/glue/Mutex.h b/xpcom/glue/Mutex.h index a5ed05f36a3..734dbf3cf8b 100644 --- a/xpcom/glue/Mutex.h +++ b/xpcom/glue/Mutex.h @@ -145,7 +145,7 @@ private: * MUCH PREFERRED to bare calls to Mutex.Lock and Unlock. */ template -class MOZ_STACK_CLASS BaseAutoLock +class MOZ_RAII BaseAutoLock { public: /** @@ -190,7 +190,7 @@ typedef BaseAutoLock OffTheBooksMutexAutoLock; * MUCH PREFERRED to bare calls to Mutex.Unlock and Lock. */ template -class MOZ_STACK_CLASS BaseAutoUnlock +class MOZ_RAII BaseAutoUnlock { public: explicit BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)