Bug 1201190 - Part 3: Mark every consumer of GUARD_OBJECT as MOZ_RAII, r=ehsan

This commit is contained in:
Michael Layzell 2015-09-03 12:15:23 -04:00
parent db44155a72
commit f20336e5e1
74 changed files with 128 additions and 128 deletions

View File

@ -29,7 +29,7 @@ namespace mozilla {
// cc->Collect();
// ...
// }
class MOZ_STACK_CLASS AutoGlobalTimelineMarker
class MOZ_RAII AutoGlobalTimelineMarker
{
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -2266,7 +2266,7 @@ void DoTraceSequence(JSTracer* trc, InfallibleTArray<T>& seq)
// Rooter class for sequences; this is what we mostly use in the codegen
template<typename T>
class MOZ_STACK_CLASS SequenceRooter : private JS::CustomAutoRooter
class MOZ_RAII SequenceRooter : private JS::CustomAutoRooter
{
public:
SequenceRooter(JSContext *aCx, FallibleTArray<T>* aSequence
@ -2325,7 +2325,7 @@ public:
// Rooter class for MozMap; this is what we mostly use in the codegen.
template<typename T>
class MOZ_STACK_CLASS MozMapRooter : private JS::CustomAutoRooter
class MOZ_RAII MozMapRooter : private JS::CustomAutoRooter
{
public:
MozMapRooter(JSContext *aCx, MozMap<T>* aMozMap
@ -2371,8 +2371,8 @@ private:
};
template<typename T>
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) :

View File

@ -15,7 +15,7 @@ namespace mozilla {
namespace dom {
template<typename T>
class MOZ_STACK_CLASS RootedDictionary : public T,
class MOZ_RAII RootedDictionary : public T,
private JS::CustomAutoRooter
{
public:
@ -32,7 +32,7 @@ public:
};
template<typename T>
class MOZ_STACK_CLASS NullableRootedDictionary : public Nullable<T>,
class MOZ_RAII NullableRootedDictionary : public Nullable<T>,
private JS::CustomAutoRooter
{
public:

View File

@ -327,7 +327,7 @@ class TypedArrayCreator
// A class for rooting an existing TypedArray struct
template<typename ArrayType>
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<typename Inner> struct Nullable;
template<typename ArrayType>
class MOZ_STACK_CLASS TypedArrayRooter<Nullable<ArrayType> > :
class MOZ_RAII TypedArrayRooter<Nullable<ArrayType> > :
private JS::CustomAutoRooter
{
public:
@ -373,8 +373,8 @@ private:
// Class for easily setting up a rooted typed array object on the stack
template<typename ArrayType>
class MOZ_STACK_CLASS RootedTypedArray : public ArrayType,
private TypedArrayRooter<ArrayType>
class MOZ_RAII RootedTypedArray : public ArrayType,
private TypedArrayRooter<ArrayType>
{
public:
explicit RootedTypedArray(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :

View File

@ -794,7 +794,7 @@ protected:
* us.
*/
template<class T>
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;

View File

@ -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)

View File

@ -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)

View File

@ -79,7 +79,7 @@ DOMSVGLengthList::WrapObject(JSContext *cx, JS::Handle<JSObject*> 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)

View File

@ -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)

View File

@ -80,7 +80,7 @@ DOMSVGNumberList::WrapObject(JSContext *cx, JS::Handle<JSObject*> 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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -81,7 +81,7 @@ DOMSVGTransformList::WrapObject(JSContext *cx, JS::Handle<JSObject*> 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)

View File

@ -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<SVGImageContext>& aSVGContext,

View File

@ -71,7 +71,7 @@ SVGTransform::WrapObject(JSContext* aCx, JS::Handle<JSObject*> 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)

View File

@ -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

View File

@ -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<nsIEditor> 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);

View File

@ -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)

View File

@ -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);

View File

@ -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();

View File

@ -654,7 +654,7 @@ namespace JS {
* specialization, define a RootedBase<T> specialization containing them.
*/
template <typename T>
class MOZ_STACK_CLASS Rooted : public js::RootedBase<T>
class MOZ_RAII Rooted : public js::RootedBase<T>
{
static_assert(!mozilla::IsConvertible<T, Traceable*>::value,
"Rooted takes pointer or Traceable types but not Traceable* type");
@ -777,7 +777,7 @@ class HandleBase<JSObject*>
/* Interface substitute for Rooted<T> which does not root the variable's memory. */
template <typename T>
class FakeRooted : public RootedBase<T>
class MOZ_RAII FakeRooted : public RootedBase<T>
{
public:
template <typename CX>

View File

@ -482,7 +482,7 @@ class LifoAlloc
};
};
class LifoAllocScope
class MOZ_NON_TEMPORARY_CLASS LifoAllocScope
{
LifoAlloc* lifoAlloc;
LifoAlloc::Mark mark;

View File

@ -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)

View File

@ -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)

View File

@ -518,7 +518,7 @@ FinishAllOffThreadCompilations(JSCompartment* comp)
}
}
class AutoLazyLinkExitFrame
class MOZ_RAII AutoLazyLinkExitFrame
{
JitActivation* jitActivation_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER

View File

@ -75,7 +75,7 @@ class IonSpewer
}
};
class AutoLockIonSpewerOutput
class MOZ_RAII AutoLockIonSpewerOutput
{
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER

View File

@ -67,7 +67,7 @@ class JS_PUBLIC_API(AutoCheckRequestDepth)
/* AutoValueArray roots an internal fixed-size array of Values. */
template <size_t N>
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 T>
class AutoVectorRooterBase : protected AutoGCRooter
class MOZ_RAII AutoVectorRooterBase : protected AutoGCRooter
{
typedef js::Vector<T, 8> VectorImpl;
VectorImpl vector;
@ -196,7 +196,7 @@ class AutoVectorRooterBase : protected AutoGCRooter
};
template <typename T>
class MOZ_STACK_CLASS AutoVectorRooter : public AutoVectorRooterBase<T>
class MOZ_RAII AutoVectorRooter : public AutoVectorRooterBase<T>
{
public:
explicit AutoVectorRooter(JSContext* cx
@ -225,7 +225,7 @@ using IdVector = js::TraceableVector<jsid>;
using ScriptVector = js::TraceableVector<JSScript*>;
template<class Key, class Value>
class AutoHashMapRooter : protected AutoGCRooter
class MOZ_RAII AutoHashMapRooter : protected AutoGCRooter
{
private:
typedef js::HashMap<Key, Value> HashMapImpl;
@ -349,7 +349,7 @@ class AutoHashMapRooter : protected AutoGCRooter
};
template<class T>
class AutoHashSetRooter : protected AutoGCRooter
class MOZ_RAII AutoHashSetRooter : protected AutoGCRooter
{
private:
typedef js::HashSet<T> 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 <typename CX>
@ -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<JSObject*> 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

View File

@ -33,7 +33,7 @@ typedef HashSet<JSObject*> ObjectSet;
typedef HashSet<Shape*> 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<Shape*>;
using StringVector = js::TraceableVector<JSString*>;
/* 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;

View File

@ -185,7 +185,7 @@ using NewObjectMetadataState = mozilla::Variant<ImmediateMetadata,
DelayMetadata,
PendingMetadata>;
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<GlobalObject*>::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<WrapperValue>
class MOZ_RAII AutoWrapperVector : public JS::AutoVectorRooterBase<WrapperValue>
{
public:
explicit AutoWrapperVector(JSContext* cx
@ -875,7 +875,7 @@ class AutoWrapperVector : public JS::AutoVectorRooterBase<WrapperValue>
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)

View File

@ -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;

View File

@ -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;

View File

@ -168,7 +168,7 @@ ImplicitCast(U& u)
}
template<typename T>
class AutoScopedAssign
class MOZ_RAII AutoScopedAssign
{
public:
AutoScopedAssign(T* addr, const T& value

View File

@ -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;

View File

@ -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<JSCompartment*> compartments_;
HashSet<Zone*> 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_;

View File

@ -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

View File

@ -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.

View File

@ -186,7 +186,7 @@ class RegExpStatics
}
};
class AutoRegExpStaticsBuffer : private JS::CustomAutoRooter
class MOZ_RAII AutoRegExpStaticsBuffer : private JS::CustomAutoRooter
{
public:
explicit AutoRegExpStaticsBuffer(JSContext* cx

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -825,7 +825,7 @@ CloneNestedScopeObject(JSContext* cx, HandleObject enclosingScope, Handle<Nested
// whether the current scope is within the extent of this initial frame.
// Here, "frame" means a single activation of: a function, eval, or global
// code.
class ScopeIter
class MOZ_RAII ScopeIter
{
StaticScopeIter<CanGC> ssi_;
RootedObject scope_;

View File

@ -982,7 +982,7 @@ StackBaseShape::StackBaseShape(Shape* shape)
compartment(shape->compartment())
{}
class AutoRooterGetterSetter
class MOZ_RAII AutoRooterGetterSetter
{
class Inner : private JS::CustomAutoRooter
{

View File

@ -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;

View File

@ -24,7 +24,7 @@ using mozilla::NativeEndian;
TraceLoggerGraphState* traceLoggerGraphState = nullptr;
class AutoTraceLoggerGraphStateLock
class MOZ_RAII AutoTraceLoggerGraphStateLock
{
TraceLoggerGraphState* graph;

View File

@ -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

View File

@ -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)

View File

@ -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<FlexLine>& aLines

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -86,7 +86,7 @@
namespace mozilla {
template <typename ExitFunction>
class ScopeExit {
class MOZ_STACK_CLASS ScopeExit {
ExitFunction mExitFunction;
bool mExecuteOnDestruction;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER

View File

@ -77,7 +77,7 @@ namespace mozilla {
* }
*/
template<typename Traits>
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<typename Type> \
struct name : public mozilla::Scoped<Traits<Type> > \
struct MOZ_NON_TEMPORARY_CLASS name : public mozilla::Scoped<Traits<Type> > \
{ \
typedef mozilla::Scoped<Traits<Type> > Super; \
typedef typename Super::Resource Resource; \

View File

@ -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) {

View File

@ -91,7 +91,7 @@ struct ScopedArrayBufferContentsTraits {
}
};
struct ScopedArrayBufferContents: public Scoped<ScopedArrayBufferContentsTraits> {
struct MOZ_NON_TEMPORARY_CLASS ScopedArrayBufferContents: public Scoped<ScopedArrayBufferContentsTraits> {
explicit ScopedArrayBufferContents(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM):
Scoped<ScopedArrayBufferContentsTraits>(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT)
{ }

View File

@ -118,7 +118,7 @@ struct AccumulateDelta_impl<Microsecond>
template<ID id, TimerResolution res = Millisecond>
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<ID id>
class AutoCounter {
class MOZ_RAII AutoCounter {
public:
explicit AutoCounter(uint32_t counterStart = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: counter(counterStart)

View File

@ -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;

View File

@ -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<ProfilerBacktrace> aBacktrace

View File

@ -27,7 +27,7 @@ namespace mozilla {
* }
*/
template<class T>
class MOZ_STACK_CLASS AutoRestore
class MOZ_RAII AutoRestore
{
private:
T& mLocation;

View File

@ -145,7 +145,7 @@ private:
* MUCH PREFERRED to bare calls to Mutex.Lock and Unlock.
*/
template<typename T>
class MOZ_STACK_CLASS BaseAutoLock
class MOZ_RAII BaseAutoLock
{
public:
/**
@ -190,7 +190,7 @@ typedef BaseAutoLock<OffTheBooksMutex> OffTheBooksMutexAutoLock;
* MUCH PREFERRED to bare calls to Mutex.Unlock and Lock.
*/
template<typename T>
class MOZ_STACK_CLASS BaseAutoUnlock
class MOZ_RAII BaseAutoUnlock
{
public:
explicit BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)