Backed out changeset ac9c811bc427 (bug 1223932) for causing spidermonkey rust failures.

CLOSED TREE
This commit is contained in:
Mihai Alexandru Michis 2020-07-30 18:23:21 +03:00
Родитель c8578acd2d
Коммит a911a108d0
104 изменённых файлов: 828 добавлений и 270 удалений

Просмотреть файл

@ -10,6 +10,7 @@
#include <prio.h>
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
namespace mozilla {
namespace devtools {
@ -33,6 +34,7 @@ namespace devtools {
// }
// // The memory is automatically unmapped when the AutoMemMap leaves scope.
class MOZ_RAII AutoMemMap {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
PRFileInfo64 fileInfo;
PRFileDesc* fd;
@ -43,8 +45,10 @@ class MOZ_RAII AutoMemMap {
void operator=(const AutoMemMap& aOther) = delete;
public:
explicit AutoMemMap()
: fileInfo(), fd(nullptr), fileMap(nullptr), addr(nullptr){};
explicit AutoMemMap(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: fileInfo(), fd(nullptr), fileMap(nullptr), addr(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
};
~AutoMemMap();
// Initialize this AutoMemMap.

Просмотреть файл

@ -13,8 +13,9 @@ namespace mozilla {
AutoGlobalTimelineMarker::AutoGlobalTimelineMarker(
const char* aName, MarkerStackRequest aStackRequest /* = STACK */
)
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mName(aName), mStackRequest(aStackRequest) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(NS_IsMainThread());
RefPtr<TimelineConsumers> timelines = TimelineConsumers::Get();

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef mozilla_AutoGlobalTimelineMarker_h_
#define mozilla_AutoGlobalTimelineMarker_h_
#include "mozilla/GuardObjects.h"
#include "TimelineMarkerEnums.h"
namespace mozilla {
@ -27,6 +28,7 @@ namespace mozilla {
// ...
// }
class MOZ_RAII AutoGlobalTimelineMarker {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
// The name of the marker we are adding.
const char* mName;
@ -36,7 +38,8 @@ class MOZ_RAII AutoGlobalTimelineMarker {
public:
explicit AutoGlobalTimelineMarker(
const char* aName,
MarkerStackRequest aStackRequest = MarkerStackRequest::STACK);
MarkerStackRequest aStackRequest =
MarkerStackRequest::STACK MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoGlobalTimelineMarker();
AutoGlobalTimelineMarker(const AutoGlobalTimelineMarker& aOther) = delete;

Просмотреть файл

@ -13,9 +13,11 @@
namespace mozilla {
AutoRestyleTimelineMarker::AutoRestyleTimelineMarker(nsIDocShell* aDocShell,
bool aIsAnimationOnly)
AutoRestyleTimelineMarker::AutoRestyleTimelineMarker(
nsIDocShell* aDocShell,
bool aIsAnimationOnly MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mDocShell(nullptr), mIsAnimationOnly(aIsAnimationOnly) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(NS_IsMainThread());
if (!aDocShell) {

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef mozilla_AutoRestyleTimelineMarker_h_
#define mozilla_AutoRestyleTimelineMarker_h_
#include "mozilla/GuardObjects.h"
#include "mozilla/RefPtr.h"
class nsIDocShell;
@ -14,12 +15,15 @@ class nsIDocShell;
namespace mozilla {
class MOZ_RAII AutoRestyleTimelineMarker {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
RefPtr<nsIDocShell> mDocShell;
bool mIsAnimationOnly;
public:
AutoRestyleTimelineMarker(nsIDocShell* aDocShell, bool aIsAnimationOnly);
AutoRestyleTimelineMarker(nsIDocShell* aDocShell,
bool aIsAnimationOnly
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoRestyleTimelineMarker();
AutoRestyleTimelineMarker(const AutoRestyleTimelineMarker& aOther) = delete;

Просмотреть файл

@ -12,9 +12,11 @@
namespace mozilla {
AutoTimelineMarker::AutoTimelineMarker(nsIDocShell* aDocShell,
const char* aName)
AutoTimelineMarker::AutoTimelineMarker(
nsIDocShell* aDocShell,
const char* aName MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mName(aName), mDocShell(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(NS_IsMainThread());
if (!aDocShell) {

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef mozilla_AutoTimelineMarker_h_
#define mozilla_AutoTimelineMarker_h_
#include "mozilla/GuardObjects.h"
#include "mozilla/RefPtr.h"
class nsIDocShell;
@ -27,6 +28,7 @@ namespace mozilla {
// ...
// }
class MOZ_RAII AutoTimelineMarker {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
// The name of the marker we are adding.
const char* mName;
@ -35,7 +37,8 @@ class MOZ_RAII AutoTimelineMarker {
RefPtr<nsIDocShell> mDocShell;
public:
AutoTimelineMarker(nsIDocShell* aDocShell, const char* aName);
AutoTimelineMarker(nsIDocShell* aDocShell,
const char* aName MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoTimelineMarker();
AutoTimelineMarker(const AutoTimelineMarker& aOther) = delete;

Просмотреть файл

@ -59,7 +59,9 @@ namespace {
// appropriate document from the supplied animation.
class MOZ_RAII AutoMutationBatchForAnimation {
public:
explicit AutoMutationBatchForAnimation(const Animation& aAnimation) {
explicit AutoMutationBatchForAnimation(
const Animation& aAnimation MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
NonOwningAnimationTarget target = aAnimation.GetTargetForAnimation();
if (!target) {
return;
@ -70,6 +72,7 @@ class MOZ_RAII AutoMutationBatchForAnimation {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
Maybe<nsAutoAnimationMutationBatch> mAutoBatch;
};
} // namespace

Просмотреть файл

@ -671,11 +671,14 @@ class Selection final : public nsSupportsWeakReference,
friend struct AutoUserInitiated;
struct MOZ_RAII AutoUserInitiated {
explicit AutoUserInitiated(Selection* aSelection)
explicit AutoUserInitiated(
Selection* aSelection MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mSavedValue(aSelection->mUserInitiated) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
aSelection->mUserInitiated = true;
}
AutoRestore<bool> mSavedValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
private:
@ -917,11 +920,14 @@ class MOZ_STACK_CLASS SelectionBatcher final {
class MOZ_RAII AutoHideSelectionChanges final {
private:
RefPtr<Selection> mSelection;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoHideSelectionChanges(const nsFrameSelection* aFrame);
explicit AutoHideSelectionChanges(Selection* aSelection)
explicit AutoHideSelectionChanges(
Selection* aSelection MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mSelection(aSelection) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mSelection = aSelection;
if (mSelection) {
mSelection->AddSelectionChangeBlocker();

Просмотреть файл

@ -25,6 +25,7 @@
#include "mozilla/CallState.h"
#include "mozilla/CORSMode.h"
#include "mozilla/EventForwards.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/TaskCategory.h"
#include "mozilla/TimeStamp.h"
@ -3460,10 +3461,14 @@ nsContentUtils::InternalContentPolicyTypeToExternalOrWorker(
class MOZ_RAII nsAutoScriptBlocker {
public:
explicit nsAutoScriptBlocker() { nsContentUtils::AddScriptBlocker(); }
explicit nsAutoScriptBlocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
nsContentUtils::AddScriptBlocker();
}
~nsAutoScriptBlocker() { nsContentUtils::RemoveScriptBlocker(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_STACK_CLASS nsAutoScriptBlockerSuppressNodeRemoved

Просмотреть файл

@ -69,6 +69,7 @@
#include "mozilla/BasePrincipal.h"
#include "mozilla/ExpandedPrincipal.h"
#include "mozilla/FlushType.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/HTMLEditor.h"
#include "mozilla/NullPrincipal.h"
#include "mozilla/Preferences.h"
@ -1373,17 +1374,19 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
class MOZ_RAII AutoResetInFrameSwap final {
public:
AutoResetInFrameSwap(nsFrameLoader* aThisFrameLoader,
nsFrameLoader* aOtherFrameLoader,
nsDocShell* aThisDocShell, nsDocShell* aOtherDocShell,
EventTarget* aThisEventTarget,
EventTarget* aOtherEventTarget)
AutoResetInFrameSwap(
nsFrameLoader* aThisFrameLoader, nsFrameLoader* aOtherFrameLoader,
nsDocShell* aThisDocShell, nsDocShell* aOtherDocShell,
EventTarget* aThisEventTarget,
EventTarget* aOtherEventTarget MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mThisFrameLoader(aThisFrameLoader),
mOtherFrameLoader(aOtherFrameLoader),
mThisDocShell(aThisDocShell),
mOtherDocShell(aOtherDocShell),
mThisEventTarget(aThisEventTarget),
mOtherEventTarget(aOtherEventTarget) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mThisFrameLoader->mInSwap = true;
mOtherFrameLoader->mInSwap = true;
mThisDocShell->SetInFrameSwap(true);
@ -1430,6 +1433,7 @@ class MOZ_RAII AutoResetInFrameSwap final {
RefPtr<nsDocShell> mOtherDocShell;
nsCOMPtr<EventTarget> mThisEventTarget;
nsCOMPtr<EventTarget> mOtherEventTarget;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,

Просмотреть файл

@ -42,6 +42,7 @@
#include "mozilla/CallState.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/OwningNonNull.h"
#include "mozilla/TimeStamp.h"

Просмотреть файл

@ -7466,8 +7466,10 @@ AbstractThread* nsGlobalWindowOuter::AbstractMainThreadFor(
}
nsGlobalWindowOuter::TemporarilyDisableDialogs::TemporarilyDisableDialogs(
nsGlobalWindowOuter* aWindow)
nsGlobalWindowOuter* aWindow MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mSavedDialogsEnabled(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(aWindow);
nsGlobalWindowOuter* topWindowOuter =
aWindow->GetInProcessScriptableTopInternal();

Просмотреть файл

@ -41,6 +41,7 @@
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "nsWrapperCacheInlines.h"
#include "mozilla/dom/Document.h"
@ -393,10 +394,12 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
class MOZ_RAII TemporarilyDisableDialogs {
public:
explicit TemporarilyDisableDialogs(nsGlobalWindowOuter* aWindow);
explicit TemporarilyDisableDialogs(
nsGlobalWindowOuter* aWindow MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~TemporarilyDisableDialogs();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
// Always an inner window; this is the window whose dialog state we messed
// with. We just want to keep it alive, because we plan to poke at its

Просмотреть файл

@ -19,6 +19,7 @@
#include "nsWrapperCache.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/RangeBoundary.h"
@ -398,10 +399,14 @@ class nsRange final : public mozilla::dom::AbstractRange,
private:
nsRange& mRange;
bool mOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoCalledByJSRestore(nsRange& aRange)
: mRange(aRange), mOldValue(aRange.mCalledByJS) {}
explicit AutoCalledByJSRestore(
nsRange& aRange MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mRange(aRange), mOldValue(aRange.mCalledByJS) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoCalledByJSRestore() { mRange.mCalledByJS = mOldValue; }
bool SavedValue() const { return mOldValue; }
};

Просмотреть файл

@ -2070,20 +2070,23 @@ template <typename T>
class MOZ_RAII SequenceRooter final : private JS::CustomAutoRooter {
public:
template <typename CX>
SequenceRooter(const CX& cx, FallibleTArray<T>* aSequence)
: JS::CustomAutoRooter(cx),
SequenceRooter(const CX& cx,
FallibleTArray<T>* aSequence MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mFallibleArray(aSequence),
mSequenceType(eFallibleArray) {}
template <typename CX>
SequenceRooter(const CX& cx, nsTArray<T>* aSequence)
: JS::CustomAutoRooter(cx),
SequenceRooter(const CX& cx,
nsTArray<T>* aSequence MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mInfallibleArray(aSequence),
mSequenceType(eInfallibleArray) {}
template <typename CX>
SequenceRooter(const CX& cx, Nullable<nsTArray<T>>* aSequence)
: JS::CustomAutoRooter(cx),
SequenceRooter(const CX& cx, Nullable<nsTArray<T>>* aSequence
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mNullableArray(aSequence),
mSequenceType(eNullableArray) {}
@ -2117,12 +2120,16 @@ template <typename K, typename V>
class MOZ_RAII RecordRooter final : private JS::CustomAutoRooter {
public:
template <typename CX>
RecordRooter(const CX& cx, Record<K, V>* aRecord)
: JS::CustomAutoRooter(cx), mRecord(aRecord), mRecordType(eRecord) {}
RecordRooter(const CX& cx,
Record<K, V>* aRecord MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mRecord(aRecord),
mRecordType(eRecord) {}
template <typename CX>
RecordRooter(const CX& cx, Nullable<Record<K, V>>* aRecord)
: JS::CustomAutoRooter(cx),
RecordRooter(const CX& cx,
Nullable<Record<K, V>>* aRecord MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mNullableRecord(aRecord),
mRecordType(eNullableRecord) {}
@ -2152,7 +2159,9 @@ template <typename T>
class MOZ_RAII RootedUnion : public T, private JS::CustomAutoRooter {
public:
template <typename CX>
explicit RootedUnion(const CX& cx) : T(), JS::CustomAutoRooter(cx) {}
explicit RootedUnion(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
virtual void trace(JSTracer* trc) override { this->TraceUnion(trc); }
};
@ -2162,8 +2171,9 @@ class MOZ_STACK_CLASS NullableRootedUnion : public Nullable<T>,
private JS::CustomAutoRooter {
public:
template <typename CX>
explicit NullableRootedUnion(const CX& cx)
: Nullable<T>(), JS::CustomAutoRooter(cx) {}
explicit NullableRootedUnion(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
virtual void trace(JSTracer* trc) override {
if (!this->IsNull()) {

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef mozilla_dom_RootedDictionary_h__
#define mozilla_dom_RootedDictionary_h__
#include "mozilla/GuardObjects.h"
#include "mozilla/dom/Nullable.h"
#include "jsapi.h"
@ -17,7 +18,9 @@ template <typename T>
class MOZ_RAII RootedDictionary final : public T, private JS::CustomAutoRooter {
public:
template <typename CX>
explicit RootedDictionary(const CX& cx) : T(), JS::CustomAutoRooter(cx) {}
explicit RootedDictionary(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: T(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
virtual void trace(JSTracer* trc) override { this->TraceDictionary(trc); }
};
@ -27,8 +30,10 @@ class MOZ_RAII NullableRootedDictionary final : public Nullable<T>,
private JS::CustomAutoRooter {
public:
template <typename CX>
explicit NullableRootedDictionary(const CX& cx)
: Nullable<T>(), JS::CustomAutoRooter(cx) {}
explicit NullableRootedDictionary(
const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: Nullable<T>(),
JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
virtual void trace(JSTracer* trc) override {
if (!this->IsNull()) {

Просмотреть файл

@ -63,8 +63,10 @@ template <typename InterfaceType>
class MOZ_RAII SpiderMonkeyInterfaceRooter : private JS::CustomAutoRooter {
public:
template <typename CX>
SpiderMonkeyInterfaceRooter(const CX& cx, InterfaceType* aInterface)
: JS::CustomAutoRooter(cx), mInterface(aInterface) {}
SpiderMonkeyInterfaceRooter(
const CX& cx, InterfaceType* aInterface MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mInterface(aInterface) {}
virtual void trace(JSTracer* trc) override { mInterface->TraceSelf(trc); }
@ -80,8 +82,10 @@ class MOZ_RAII SpiderMonkeyInterfaceRooter<Nullable<InterfaceType>>
: private JS::CustomAutoRooter {
public:
template <typename CX>
SpiderMonkeyInterfaceRooter(const CX& cx, Nullable<InterfaceType>* aInterface)
: JS::CustomAutoRooter(cx), mInterface(aInterface) {}
SpiderMonkeyInterfaceRooter(const CX& cx, Nullable<InterfaceType>* aInterface
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::CustomAutoRooter(cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT),
mInterface(aInterface) {}
virtual void trace(JSTracer* trc) override {
if (!mInterface->IsNull()) {
@ -101,13 +105,18 @@ class MOZ_RAII RootedSpiderMonkeyInterface final
private SpiderMonkeyInterfaceRooter<InterfaceType> {
public:
template <typename CX>
explicit RootedSpiderMonkeyInterface(const CX& cx)
: InterfaceType(), SpiderMonkeyInterfaceRooter<InterfaceType>(cx, this) {}
explicit RootedSpiderMonkeyInterface(
const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: InterfaceType(),
SpiderMonkeyInterfaceRooter<InterfaceType>(
cx, this MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
template <typename CX>
RootedSpiderMonkeyInterface(const CX& cx, JSObject* obj)
RootedSpiderMonkeyInterface(const CX& cx,
JSObject* obj MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: InterfaceType(obj),
SpiderMonkeyInterfaceRooter<InterfaceType>(cx, this) {}
SpiderMonkeyInterfaceRooter<InterfaceType>(
cx, this MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {}
};
} // namespace dom

Просмотреть файл

@ -152,13 +152,17 @@ static int64_t gCanvasAzureMemoryUsed = 0;
// Adds Save() / Restore() calls to the scope.
class MOZ_RAII AutoSaveRestore {
public:
explicit AutoSaveRestore(CanvasRenderingContext2D* aCtx) : mCtx(aCtx) {
explicit AutoSaveRestore(
CanvasRenderingContext2D* aCtx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCtx(aCtx) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mCtx->Save();
}
~AutoSaveRestore() { mCtx->Restore(); }
private:
RefPtr<CanvasRenderingContext2D> mCtx;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// This is KIND_OTHER because it's not always clear where in memory the pixels

Просмотреть файл

@ -200,10 +200,12 @@ class RestoreSelectionState : public Runnable {
class MOZ_RAII AutoRestoreEditorState final {
public:
explicit AutoRestoreEditorState(TextEditor* aTextEditor)
explicit AutoRestoreEditorState(
TextEditor* aTextEditor MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mTextEditor(aTextEditor),
mSavedFlags(mTextEditor->Flags()),
mSavedMaxLength(mTextEditor->MaxTextLength()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTextEditor);
// EditorBase::SetFlags() is a virtual method. Even though it does nothing
@ -228,6 +230,7 @@ class MOZ_RAII AutoRestoreEditorState final {
TextEditor* mTextEditor;
uint32_t mSavedFlags;
int32_t mSavedMaxLength;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*****************************************************************************
@ -236,8 +239,10 @@ class MOZ_RAII AutoRestoreEditorState final {
class MOZ_RAII AutoDisableUndo final {
public:
explicit AutoDisableUndo(TextEditor* aTextEditor)
explicit AutoDisableUndo(
TextEditor* aTextEditor MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mTextEditor(aTextEditor), mNumberOfMaximumTransactions(0) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTextEditor);
mNumberOfMaximumTransactions =
@ -271,6 +276,7 @@ class MOZ_RAII AutoDisableUndo final {
private:
TextEditor* mTextEditor;
int32_t mNumberOfMaximumTransactions;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
static bool SuppressEventHandlers(nsPresContext* aPresContext) {

Просмотреть файл

@ -10,6 +10,7 @@
# include "Intervals.h"
# include "MediaData.h"
# include "mozilla/Attributes.h"
# include "mozilla/GuardObjects.h"
# include "mozilla/UniquePtr.h"
# include "nsISeekableStream.h"
# include "nsThreadUtils.h"
@ -129,7 +130,9 @@ class MediaResource : public DecoderDoctorLifeLogger<MediaResource> {
template <class T>
class MOZ_RAII AutoPinned {
public:
explicit AutoPinned(T* aResource) : mResource(aResource) {
explicit AutoPinned(T* aResource MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mResource(aResource) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mResource);
mResource->Pin();
}
@ -141,6 +144,7 @@ class MOZ_RAII AutoPinned {
private:
T* mResource;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
DDLoggedTypeDeclName(MediaResourceIndex);

Просмотреть файл

@ -268,7 +268,8 @@ class PluginModuleMapping : public PRCList {
class MOZ_RAII NotifyLoadingModule {
public:
explicit NotifyLoadingModule() {
explicit NotifyLoadingModule(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
PluginModuleMapping::sIsLoadModuleOnStack = true;
}
@ -277,6 +278,7 @@ class PluginModuleMapping : public PRCList {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
private:

Просмотреть файл

@ -703,11 +703,13 @@ AutoNoJSAPI::~AutoNoJSAPI() {
} // namespace dom
AutoJSContext::AutoJSContext() : mCx(nullptr) {
AutoJSContext::AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: mCx(nullptr) {
JS::AutoSuppressGCAnalysis nogc;
MOZ_ASSERT(!mCx, "mCx should not be initialized!");
MOZ_ASSERT(NS_IsMainThread());
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (dom::IsJSAPIActive()) {
mCx = dom::danger::GetJSContext();
@ -719,9 +721,12 @@ AutoJSContext::AutoJSContext() : mCx(nullptr) {
AutoJSContext::operator JSContext*() const { return mCx; }
AutoSafeJSContext::AutoSafeJSContext() : AutoJSAPI() {
AutoSafeJSContext::AutoSafeJSContext(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: AutoJSAPI() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
DebugOnly<bool> ok = Init(xpc::UnprivilegedJunkScope());
MOZ_ASSERT(ok,
@ -730,7 +735,10 @@ AutoSafeJSContext::AutoSafeJSContext() : AutoJSAPI() {
"returned null, and inited correctly otherwise!");
}
AutoSlowOperation::AutoSlowOperation() : mIsMainThread(NS_IsMainThread()) {
AutoSlowOperation::AutoSlowOperation(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: mIsMainThread(NS_IsMainThread()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mIsMainThread) {
mScriptActivity.emplace(true);
}

Просмотреть файл

@ -436,12 +436,13 @@ class AutoNoJSAPI : protected ScriptSettingsStackEntry,
*/
class MOZ_RAII AutoJSContext {
public:
explicit AutoJSContext();
explicit AutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
operator JSContext*() const;
protected:
JSContext* mCx;
dom::AutoJSAPI mJSAPI;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -453,10 +454,11 @@ class MOZ_RAII AutoJSContext {
*/
class MOZ_RAII AutoSafeJSContext : public dom::AutoJSAPI {
public:
explicit AutoSafeJSContext();
explicit AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
operator JSContext*() const { return cx(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -471,10 +473,11 @@ class MOZ_RAII AutoSafeJSContext : public dom::AutoJSAPI {
*/
class MOZ_RAII AutoSlowOperation {
public:
explicit AutoSlowOperation();
explicit AutoSlowOperation(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
void CheckForInterrupt();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mIsMainThread;
Maybe<xpc::AutoScriptActivity> mScriptActivity;
};

Просмотреть файл

@ -66,9 +66,11 @@ NS_INTERFACE_MAP_END
// DidChangeLengthList.
class MOZ_RAII AutoChangeLengthNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeLengthNotifier(DOMSVGLength* aLength)
explicit AutoChangeLengthNotifier(
DOMSVGLength* aLength MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aLength->Element()->GetComposedDoc(), true),
mLength(aLength) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mLength, "Expecting non-null length");
MOZ_ASSERT(mLength->HasOwner(),
"Expecting list to have an owner for notification");
@ -89,6 +91,7 @@ class MOZ_RAII AutoChangeLengthNotifier : public mozAutoDocUpdate {
private:
DOMSVGLength* const mLength;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
DOMSVGLength::DOMSVGLength(DOMSVGLengthList* aList, uint8_t aAttrEnum,

Просмотреть файл

@ -88,9 +88,11 @@ JSObject* DOMSVGLengthList::WrapObject(JSContext* cx,
// DidChangeLengthList.
class MOZ_RAII AutoChangeLengthListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeLengthListNotifier(DOMSVGLengthList* aLengthList)
explicit AutoChangeLengthListNotifier(
DOMSVGLengthList* aLengthList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aLengthList->Element()->GetComposedDoc(), true),
mLengthList(aLengthList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mLengthList, "Expecting non-null lengthList");
mEmptyOrOldValue = mLengthList->Element()->WillChangeLengthList(
mLengthList->AttrEnum(), *this);
@ -107,6 +109,7 @@ class MOZ_RAII AutoChangeLengthListNotifier : public mozAutoDocUpdate {
private:
DOMSVGLengthList* const mLengthList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void DOMSVGLengthList::InternalListLengthWillChange(uint32_t aNewLength) {

Просмотреть файл

@ -57,9 +57,11 @@ NS_INTERFACE_MAP_END
// DidChangeNumberList.
class MOZ_RAII AutoChangeNumberNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeNumberNotifier(DOMSVGNumber* aNumber)
explicit AutoChangeNumberNotifier(
DOMSVGNumber* aNumber MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aNumber->Element()->GetComposedDoc(), true),
mNumber(aNumber) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mNumber, "Expecting non-null number");
MOZ_ASSERT(mNumber->HasOwner(),
"Expecting list to have an owner for notification");
@ -80,6 +82,7 @@ class MOZ_RAII AutoChangeNumberNotifier : public mozAutoDocUpdate {
private:
DOMSVGNumber* const mNumber;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
DOMSVGNumber::DOMSVGNumber(DOMSVGNumberList* aList, uint8_t aAttrEnum,

Просмотреть файл

@ -81,9 +81,11 @@ JSObject* DOMSVGNumberList::WrapObject(JSContext* cx,
// DidChangeNumberList.
class MOZ_RAII AutoChangeNumberListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeNumberListNotifier(DOMSVGNumberList* aNumberList)
explicit AutoChangeNumberListNotifier(
DOMSVGNumberList* aNumberList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aNumberList->Element()->GetComposedDoc(), true),
mNumberList(aNumberList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mNumberList, "Expecting non-null numberList");
mEmptyOrOldValue = mNumberList->Element()->WillChangeNumberList(
mNumberList->AttrEnum(), *this);
@ -100,6 +102,7 @@ class MOZ_RAII AutoChangeNumberListNotifier : public mozAutoDocUpdate {
private:
DOMSVGNumberList* const mNumberList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void DOMSVGNumberList::InternalListLengthWillChange(uint32_t aNewLength) {

Просмотреть файл

@ -50,9 +50,11 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGPathSeg, Release)
// and DidChangePathSegList.
class MOZ_RAII AutoChangePathSegNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePathSegNotifier(DOMSVGPathSeg* aPathSeg)
explicit AutoChangePathSegNotifier(
DOMSVGPathSeg* aPathSeg MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aPathSeg->Element()->GetComposedDoc(), true),
mPathSeg(aPathSeg) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mPathSeg, "Expecting non-null pathSeg");
MOZ_ASSERT(mPathSeg->HasOwner(),
"Expecting list to have an owner for notification");
@ -71,6 +73,7 @@ class MOZ_RAII AutoChangePathSegNotifier : public mozAutoDocUpdate {
private:
DOMSVGPathSeg* const mPathSeg;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
DOMSVGPathSeg::DOMSVGPathSeg(DOMSVGPathSegList* aList, uint32_t aListIndex,

Просмотреть файл

@ -57,9 +57,11 @@ NS_INTERFACE_MAP_END
// DidChangePathSegList.
class MOZ_RAII AutoChangePathSegListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePathSegListNotifier(DOMSVGPathSegList* aPathSegList)
explicit AutoChangePathSegListNotifier(
DOMSVGPathSegList* aPathSegList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aPathSegList->Element()->GetComposedDoc(), true),
mPathSegList(aPathSegList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mPathSegList, "Expecting non-null pathSegList");
mEmptyOrOldValue = mPathSegList->Element()->WillChangePathSegList(*this);
}
@ -74,6 +76,7 @@ class MOZ_RAII AutoChangePathSegListNotifier : public mozAutoDocUpdate {
private:
DOMSVGPathSegList* const mPathSegList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

Просмотреть файл

@ -28,9 +28,11 @@ namespace dom {
// DidChangePointList.
class MOZ_RAII AutoChangePointNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePointNotifier(DOMSVGPoint* aPoint)
explicit AutoChangePointNotifier(
DOMSVGPoint* aPoint MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aPoint->Element()->GetComposedDoc(), true),
mPoint(aPoint) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mPoint, "Expecting non-null point");
MOZ_ASSERT(mPoint->HasOwner(),
"Expecting list to have an owner for notification");
@ -49,6 +51,7 @@ class MOZ_RAII AutoChangePointNotifier : public mozAutoDocUpdate {
private:
DOMSVGPoint* const mPoint;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
float DOMSVGPoint::X() {

Просмотреть файл

@ -74,9 +74,11 @@ NS_INTERFACE_MAP_END
// DidChangePointList.
class MOZ_RAII AutoChangePointListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePointListNotifier(DOMSVGPointList* aPointList)
explicit AutoChangePointListNotifier(
DOMSVGPointList* aPointList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aPointList->Element()->GetComposedDoc(), true),
mPointList(aPointList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mPointList, "Expecting non-null pointList");
mEmptyOrOldValue = mPointList->Element()->WillChangePointList(*this);
}
@ -91,6 +93,7 @@ class MOZ_RAII AutoChangePointListNotifier : public mozAutoDocUpdate {
private:
DOMSVGPointList* const mPointList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

Просмотреть файл

@ -56,9 +56,11 @@ NS_INTERFACE_MAP_END
// DidChangeStringListList.
class MOZ_RAII AutoChangeStringListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeStringListNotifier(DOMSVGStringList* aStringList)
explicit AutoChangeStringListNotifier(
DOMSVGStringList* aStringList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aStringList->mElement->GetComposedDoc(), true),
mStringList(aStringList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mStringList, "Expecting non-null stringList");
mEmptyOrOldValue = mStringList->mElement->WillChangeStringList(
mStringList->mIsConditionalProcessingAttribute, mStringList->mAttrEnum,
@ -74,6 +76,7 @@ class MOZ_RAII AutoChangeStringListNotifier : public mozAutoDocUpdate {
private:
DOMSVGStringList* const mStringList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

Просмотреть файл

@ -74,8 +74,10 @@ JSObject* DOMSVGTransform::WrapObject(JSContext* aCx,
// and DidChangeTransformList.
class MOZ_RAII AutoChangeTransformNotifier {
public:
explicit AutoChangeTransformNotifier(DOMSVGTransform* aTransform)
explicit AutoChangeTransformNotifier(
DOMSVGTransform* aTransform MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mTransform(aTransform) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTransform, "Expecting non-null transform");
if (mTransform->HasOwner()) {
mUpdateBatch.emplace(mTransform->Element()->GetComposedDoc(), true);
@ -100,6 +102,7 @@ class MOZ_RAII AutoChangeTransformNotifier {
Maybe<mozAutoDocUpdate> mUpdateBatch;
DOMSVGTransform* const mTransform;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
//----------------------------------------------------------------------

Просмотреть файл

@ -81,9 +81,11 @@ JSObject* DOMSVGTransformList::WrapObject(JSContext* cx,
// DidChangeTransformList.
class MOZ_RAII AutoChangeTransformListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeTransformListNotifier(DOMSVGTransformList* aTransformList)
explicit AutoChangeTransformListNotifier(
DOMSVGTransformList* aTransformList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mozAutoDocUpdate(aTransformList->Element()->GetComposedDoc(), true),
mTransformList(aTransformList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTransformList, "Expecting non-null transformList");
mEmptyOrOldValue =
mTransformList->Element()->WillChangeTransformList(*this);
@ -99,6 +101,7 @@ class MOZ_RAII AutoChangeTransformListNotifier : public mozAutoDocUpdate {
private:
DOMSVGTransformList* const mTransformList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void DOMSVGTransformList::InternalListLengthWillChange(uint32_t aNewLength) {

Просмотреть файл

@ -49,10 +49,11 @@ static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAngle>
// DidChangeOrient with mozAutoDocUpdate.
class MOZ_RAII AutoChangeOrientNotifier {
public:
explicit AutoChangeOrientNotifier(SVGAnimatedOrient* aOrient,
SVGElement* aSVGElement,
bool aDoSetAttr = true)
explicit AutoChangeOrientNotifier(
SVGAnimatedOrient* aOrient, SVGElement* aSVGElement,
bool aDoSetAttr = true MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mOrient(aOrient), mSVGElement(aSVGElement), mDoSetAttr(aDoSetAttr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mOrient, "Expecting non-null orient");
if (mSVGElement && mDoSetAttr) {
mUpdateBatch.emplace(mSVGElement->GetComposedDoc(), true);
@ -77,6 +78,7 @@ class MOZ_RAII AutoChangeOrientNotifier {
SVGElement* const mSVGElement;
nsAttrValue mEmptyOrOldValue;
bool mDoSetAttr;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
static bool IsValidAngleUnitType(uint16_t unit) {

Просмотреть файл

@ -37,8 +37,10 @@ static SVGViewElement* GetViewElement(Document* aDocument,
// Handles setting/clearing the root's mSVGView pointer.
class MOZ_RAII AutoSVGViewHandler {
public:
explicit AutoSVGViewHandler(SVGSVGElement* aRoot)
explicit AutoSVGViewHandler(
SVGSVGElement* aRoot MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mRoot(aRoot), mValid(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mWasOverridden = mRoot->UseCurrentView();
mRoot->mSVGView = nullptr;
mRoot->mCurrentViewID = nullptr;
@ -111,6 +113,7 @@ class MOZ_RAII AutoSVGViewHandler {
UniquePtr<SVGView> mSVGView;
bool mValid;
bool mWasOverridden;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
bool SVGFragmentIdentifier::ProcessSVGViewSpec(const nsAString& aViewSpec,

Просмотреть файл

@ -262,9 +262,11 @@ class SVGSVGElement final : public SVGSVGElementBase {
class MOZ_RAII AutoSVGTimeSetRestore {
public:
AutoSVGTimeSetRestore(dom::SVGSVGElement* aRootElem, float aFrameTime)
AutoSVGTimeSetRestore(dom::SVGSVGElement* aRootElem,
float aFrameTime MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mRootElem(aRootElem),
mOriginalTime(mRootElem->GetCurrentTimeAsFloat()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mRootElem->SetCurrentTime(
aFrameTime); // Does nothing if there's no change.
}
@ -274,13 +276,16 @@ class MOZ_RAII AutoSVGTimeSetRestore {
private:
const RefPtr<dom::SVGSVGElement> mRootElem;
const float mOriginalTime;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII AutoPreserveAspectRatioOverride {
public:
AutoPreserveAspectRatioOverride(const Maybe<SVGImageContext>& aSVGContext,
dom::SVGSVGElement* aRootElem)
dom::SVGSVGElement* aRootElem
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mRootElem(aRootElem), mDidOverride(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mRootElem, "No SVG/Symbol node to manage?");
if (aSVGContext.isSome() &&
@ -303,6 +308,7 @@ class MOZ_RAII AutoPreserveAspectRatioOverride {
private:
const RefPtr<dom::SVGSVGElement> mRootElem;
bool mDidOverride;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace mozilla

Просмотреть файл

@ -5175,8 +5175,9 @@ nsresult EditorBase::InsertLineBreakAsSubAction() {
*****************************************************************************/
EditorBase::AutoSelectionRestorer::AutoSelectionRestorer(
EditorBase& aEditorBase)
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mEditorBase(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (aEditorBase.ArePreservingSelection()) {
// We already have initialized mParentData::mSavedSelection, so this must
// be nested call.

Просмотреть файл

@ -2292,8 +2292,10 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoTransactionBatch final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoTransactionBatch(EditorBase& aEditorBase)
MOZ_CAN_RUN_SCRIPT explicit AutoTransactionBatch(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_KnownLive(mEditorBase).BeginTransactionInternal();
}
@ -2303,6 +2305,7 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2313,14 +2316,18 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoPlaceholderBatch final {
public:
explicit AutoPlaceholderBatch(EditorBase& aEditorBase)
explicit AutoPlaceholderBatch(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase->BeginPlaceholderTransaction(*nsGkAtoms::_empty);
}
AutoPlaceholderBatch(EditorBase& aEditorBase,
nsStaticAtom& aTransactionName)
nsStaticAtom& aTransactionName
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase->BeginPlaceholderTransaction(aTransactionName);
}
@ -2328,6 +2335,7 @@ class EditorBase : public nsIEditor,
protected:
OwningNonNull<EditorBase> mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2340,7 +2348,8 @@ class EditorBase : public nsIEditor,
* Constructor responsible for remembering all state needed to restore
* aSelection.
*/
explicit AutoSelectionRestorer(EditorBase& aEditorBase);
explicit AutoSelectionRestorer(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
/**
* Destructor restores mSelection to its former state
@ -2354,6 +2363,7 @@ class EditorBase : public nsIEditor,
protected:
EditorBase* mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2364,8 +2374,10 @@ class EditorBase : public nsIEditor,
public:
MOZ_CAN_RUN_SCRIPT AutoEditSubActionNotifier(
EditorBase& aEditorBase, EditSubAction aEditSubAction,
nsIEditor::EDirection aDirection, ErrorResult& aRv)
nsIEditor::EDirection aDirection,
ErrorResult& aRv MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase), mIsTopLevel(true) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
// The top level edit sub action has already be set if this is nested call
// XXX Looks like that this is not aware of unexpected nested edit action
// handling via selectionchange event listener or mutation event
@ -2390,6 +2402,7 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
bool mIsTopLevel;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2398,10 +2411,12 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoTransactionsConserveSelection final {
public:
explicit AutoTransactionsConserveSelection(EditorBase& aEditorBase)
explicit AutoTransactionsConserveSelection(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase),
mAllowedTransactionsToChangeSelection(
aEditorBase.AllowsTransactionsToChangeSelection()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase.MakeThisAllowTransactionsToChangeSelection(false);
}
@ -2413,6 +2428,7 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
bool mAllowedTransactionsToChangeSelection;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/***************************************************************************
@ -2420,8 +2436,10 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoUpdateViewBatch final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoUpdateViewBatch(EditorBase& aEditorBase)
MOZ_CAN_RUN_SCRIPT explicit AutoUpdateViewBatch(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase.BeginUpdateViewBatch();
}
@ -2431,6 +2449,7 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
protected:

Просмотреть файл

@ -80,7 +80,9 @@ EditActionResult& EditActionResult::operator|=(
* some helper classes for iterating the dom tree
*****************************************************************************/
DOMIterator::DOMIterator(nsINode& aNode) : mIter(&mPostOrderIter) {
DOMIterator::DOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mIter(&mPostOrderIter) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
DebugOnly<nsresult> rv = mIter->Init(&aNode);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
@ -92,7 +94,10 @@ nsresult DOMIterator::Init(const RawRangeBoundary& aStartRef,
return mIter->Init(aStartRef, aEndRef);
}
DOMIterator::DOMIterator() : mIter(&mPostOrderIter) {}
DOMIterator::DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: mIter(&mPostOrderIter) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
template <class NodeClass>
void DOMIterator::AppendAllNodesToArray(
@ -116,7 +121,9 @@ void DOMIterator::AppendNodesToArray(
}
}
DOMSubtreeIterator::DOMSubtreeIterator() : DOMIterator() {
DOMSubtreeIterator::DOMSubtreeIterator(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT) {
mIter = &mSubtreeIter;
}

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/EditAction.h"
#include "mozilla/EditorBase.h"
#include "mozilla/EditorDOMPoint.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/RangeBoundary.h"
#include "mozilla/dom/HTMLBRElement.h"
#include "mozilla/dom/Selection.h"
@ -699,8 +700,9 @@ class MOZ_STACK_CLASS SplitRangeOffResult final {
class MOZ_RAII AutoTransactionBatchExternal final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoTransactionBatchExternal(
EditorBase& aEditorBase)
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_KnownLive(mEditorBase).BeginTransaction();
}
@ -710,6 +712,7 @@ class MOZ_RAII AutoTransactionBatchExternal final {
private:
EditorBase& mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_STACK_CLASS AutoRangeArray final {
@ -733,8 +736,8 @@ class MOZ_STACK_CLASS AutoRangeArray final {
class MOZ_RAII DOMIterator {
public:
explicit DOMIterator();
explicit DOMIterator(nsINode& aNode);
explicit DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
explicit DOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
virtual ~DOMIterator() = default;
nsresult Init(nsRange& aRange);
@ -763,18 +766,20 @@ class MOZ_RAII DOMIterator {
protected:
ContentIteratorBase* mIter;
PostContentIterator mPostOrderIter;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII DOMSubtreeIterator final : public DOMIterator {
public:
explicit DOMSubtreeIterator();
explicit DOMSubtreeIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
virtual ~DOMSubtreeIterator() = default;
nsresult Init(nsRange& aRange);
private:
ContentSubtreeIterator mSubtreeIter;
explicit DOMSubtreeIterator(nsINode& aNode) = delete;
explicit DOMSubtreeIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM) =
delete;
};
/**

Просмотреть файл

@ -101,11 +101,14 @@ static bool IsStyleCachePreservingSubAction(EditSubAction aEditSubAction) {
}
class MOZ_RAII AutoSetTemporaryAncestorLimiter final {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
public:
explicit AutoSetTemporaryAncestorLimiter(HTMLEditor& aHTMLEditor,
Selection& aSelection,
nsINode& aStartPointNode) {
explicit AutoSetTemporaryAncestorLimiter(
HTMLEditor& aHTMLEditor, Selection& aSelection,
nsINode& aStartPointNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(aSelection.GetType() == SelectionType::eNormal);
if (aSelection.GetAncestorLimiter()) {

Просмотреть файл

@ -1402,8 +1402,11 @@ nsresult mozInlineSpellChecker::DoSpellCheck(
class MOZ_RAII AutoChangeNumPendingSpellChecks final {
public:
explicit AutoChangeNumPendingSpellChecks(mozInlineSpellChecker* aSpellChecker,
int32_t aDelta)
: mSpellChecker(aSpellChecker), mDelta(aDelta) {}
int32_t aDelta
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mSpellChecker(aSpellChecker), mDelta(aDelta) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoChangeNumPendingSpellChecks() {
mSpellChecker->ChangeNumPendingSpellChecks(mDelta);
@ -1412,6 +1415,7 @@ class MOZ_RAII AutoChangeNumPendingSpellChecks final {
private:
RefPtr<mozInlineSpellChecker> mSpellChecker;
int32_t mDelta;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void mozInlineSpellChecker::CheckCurrentWordsNoSuggest(

Просмотреть файл

@ -784,10 +784,14 @@ class TextureClientReleaseTask : public Runnable {
// Automatically lock and unlock a texture. Since texture locking is fallible,
// Succeeded() must be checked on the guard object before proceeding.
class MOZ_RAII TextureClientAutoLock {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
public:
TextureClientAutoLock(TextureClient* aTexture, OpenMode aMode)
TextureClientAutoLock(TextureClient* aTexture,
OpenMode aMode MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mTexture(aTexture), mSucceeded(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mSucceeded = mTexture->Lock(aMode);
#ifdef DEBUG
mChecked = false;

Просмотреть файл

@ -733,22 +733,28 @@ class DisplayListBuilder final {
class MOZ_RAII SpaceAndClipChainHelper final {
public:
SpaceAndClipChainHelper(DisplayListBuilder& aBuilder,
wr::WrSpaceAndClipChain aSpaceAndClipChain)
wr::WrSpaceAndClipChain aSpaceAndClipChain
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mBuilder(aBuilder),
mOldSpaceAndClipChain(aBuilder.mCurrentSpaceAndClipChain) {
aBuilder.mCurrentSpaceAndClipChain = aSpaceAndClipChain;
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
SpaceAndClipChainHelper(DisplayListBuilder& aBuilder,
wr::WrSpatialId aSpatialId)
wr::WrSpatialId aSpatialId
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mBuilder(aBuilder),
mOldSpaceAndClipChain(aBuilder.mCurrentSpaceAndClipChain) {
aBuilder.mCurrentSpaceAndClipChain.space = aSpatialId;
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
SpaceAndClipChainHelper(DisplayListBuilder& aBuilder,
wr::WrClipChainId aClipChainId)
wr::WrClipChainId aClipChainId
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mBuilder(aBuilder),
mOldSpaceAndClipChain(aBuilder.mCurrentSpaceAndClipChain) {
aBuilder.mCurrentSpaceAndClipChain.clip_chain = aClipChainId.id;
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~SpaceAndClipChainHelper() {
@ -760,6 +766,7 @@ class MOZ_RAII SpaceAndClipChainHelper final {
DisplayListBuilder& mBuilder;
wr::WrSpaceAndClipChain mOldSpaceAndClipChain;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
Maybe<wr::ImageFormat> SurfaceFormatToImageFormat(gfx::SurfaceFormat aFormat);

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef mozilla_ipc_Neutering_h
#define mozilla_ipc_Neutering_h
#include "mozilla/GuardObjects.h"
/**
* This header declares RAII wrappers for Window neutering. See
@ -24,7 +25,7 @@ namespace ipc {
*/
class MOZ_RAII NeuteredWindowRegion {
public:
explicit NeuteredWindowRegion(bool aDoNeuter);
explicit NeuteredWindowRegion(bool aDoNeuter MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~NeuteredWindowRegion();
/**
@ -34,6 +35,7 @@ class MOZ_RAII NeuteredWindowRegion {
void PumpOnce();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mNeuteredByThis;
};
@ -45,21 +47,23 @@ class MOZ_RAII NeuteredWindowRegion {
*/
class MOZ_RAII DeneuteredWindowRegion {
public:
explicit DeneuteredWindowRegion();
explicit DeneuteredWindowRegion(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
~DeneuteredWindowRegion();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mReneuter;
};
class MOZ_RAII SuppressedNeuteringRegion {
public:
explicit SuppressedNeuteringRegion();
explicit SuppressedNeuteringRegion(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
~SuppressedNeuteringRegion();
static inline bool IsNeuteringSuppressed() { return sSuppressNeutering; }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mReenable;
static bool sSuppressNeutering;

Просмотреть файл

@ -796,9 +796,11 @@ static void StopNeutering() {
MessageChannel::SetIsPumpingMessages(false);
}
NeuteredWindowRegion::NeuteredWindowRegion(bool aDoNeuter)
NeuteredWindowRegion::NeuteredWindowRegion(
bool aDoNeuter MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mNeuteredByThis(!gWindowHook && aDoNeuter &&
XRE_UseNativeEventProcessing()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mNeuteredByThis) {
StartNeutering();
}
@ -826,8 +828,10 @@ void NeuteredWindowRegion::PumpOnce() {
::PeekMessageW(&msg, nullptr, 0, 0, PM_NOREMOVE);
}
DeneuteredWindowRegion::DeneuteredWindowRegion()
DeneuteredWindowRegion::DeneuteredWindowRegion(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: mReneuter(gWindowHook != NULL) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mReneuter) {
StopNeutering();
}
@ -839,8 +843,10 @@ DeneuteredWindowRegion::~DeneuteredWindowRegion() {
}
}
SuppressedNeuteringRegion::SuppressedNeuteringRegion()
SuppressedNeuteringRegion::SuppressedNeuteringRegion(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: mReenable(::gUIThreadId == ::GetCurrentThreadId() && ::gWindowHook) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mReenable) {
MOZ_ASSERT(!sSuppressNeutering);
sSuppressNeutering = true;

Просмотреть файл

@ -8,6 +8,7 @@
#define js_Promise_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "jspubtd.h"
#include "js/RootingAPI.h"
@ -222,7 +223,8 @@ extern JS_PUBLIC_API void SetJobQueue(JSContext* cx, JobQueue* queue);
*/
class MOZ_RAII JS_PUBLIC_API AutoDebuggerJobQueueInterruption {
public:
explicit AutoDebuggerJobQueueInterruption();
explicit AutoDebuggerJobQueueInterruption(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
~AutoDebuggerJobQueueInterruption();
bool init(JSContext* cx);
@ -250,6 +252,7 @@ class MOZ_RAII JS_PUBLIC_API AutoDebuggerJobQueueInterruption {
void runJobs();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
JSContext* cx;
js::UniquePtr<JobQueue::SavedJobQueue> saved;
};

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/EnumeratedArray.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"

Просмотреть файл

@ -11,6 +11,7 @@
#include "mozilla/Assertions.h" // MOZ_ASSERT
#include "mozilla/Attributes.h" // MOZ_IMPLICIT, MOZ_RAII
#include "mozilla/GuardObjects.h" // MOZ_GUARD_OBJECT_NOTIFIER_{INIT,PARAM}, MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
#include <stdint.h> // size_t

Просмотреть файл

@ -5802,8 +5802,11 @@ MOZ_MUST_USE bool js::TrySkipAwait(JSContext* cx, HandleValue val,
return true;
}
JS::AutoDebuggerJobQueueInterruption::AutoDebuggerJobQueueInterruption()
: cx(nullptr) {}
JS::AutoDebuggerJobQueueInterruption::AutoDebuggerJobQueueInterruption(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: cx(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
JS::AutoDebuggerJobQueueInterruption::~AutoDebuggerJobQueueInterruption() {
MOZ_ASSERT_IF(initialized(), cx->jobQueue->empty());

Просмотреть файл

@ -9,6 +9,7 @@
#include "mozilla/Attributes.h" // for MOZ_STACK_CLASS, MOZ_RAII
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/DoublyLinkedList.h" // for DoublyLinkedList<>::Iterator
#include "mozilla/GuardObjects.h" // for MOZ_GUARD_OBJECT_NOTIFIER_PARAM
#include "mozilla/HashTable.h" // for HashSet<>::Range, HashMapEntry
#include "mozilla/Maybe.h" // for Maybe, Nothing, Some
#include "mozilla/ScopeExit.h" // for MakeScopeExit, ScopeExit
@ -2942,7 +2943,11 @@ class MOZ_RAII ExecutionObservableRealms
HashSet<Zone*> zones_;
public:
explicit ExecutionObservableRealms(JSContext* cx) : realms_(cx), zones_(cx) {}
explicit ExecutionObservableRealms(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: realms_(cx), zones_(cx) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
bool add(Realm* realm) {
return realms_.put(realm) && zones_.put(realm->zone());
@ -2962,6 +2967,7 @@ class MOZ_RAII ExecutionObservableRealms
return iter.hasUsableAbstractFramePtr() && realms_.has(iter.realm());
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// Given a particular AbstractFramePtr F that has become observable, this
@ -2973,7 +2979,11 @@ class MOZ_RAII ExecutionObservableFrame
AbstractFramePtr frame_;
public:
explicit ExecutionObservableFrame(AbstractFramePtr frame) : frame_(frame) {}
explicit ExecutionObservableFrame(
AbstractFramePtr frame MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: frame_(frame) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
Zone* singleZone() const override {
// We never inline across realms, let alone across zones, so
@ -3026,6 +3036,7 @@ class MOZ_RAII ExecutionObservableFrame
iter.abstractFramePtr() == frame_;
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII ExecutionObservableScript
@ -3033,8 +3044,11 @@ class MOZ_RAII ExecutionObservableScript
RootedScript script_;
public:
ExecutionObservableScript(JSContext* cx, JSScript* script)
: script_(cx, script) {}
ExecutionObservableScript(JSContext* cx,
JSScript* script MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: script_(cx, script) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
Zone* singleZone() const override { return script_->zone(); }
JSScript* singleScriptForZoneInvalidation() const override { return script_; }
@ -3058,6 +3072,7 @@ class MOZ_RAII ExecutionObservableScript
iter.abstractFramePtr().script() == script_;
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

Просмотреть файл

@ -723,9 +723,12 @@ class LifoAlloc {
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
LifoAlloc* lifoAlloc_;
bool prevFallibleScope_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoFallibleScope(LifoAlloc* lifoAlloc) {
explicit AutoFallibleScope(
LifoAlloc* lifoAlloc MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
lifoAlloc_ = lifoAlloc;
prevFallibleScope_ = lifoAlloc->fallibleScope_;
lifoAlloc->fallibleScope_ = true;
@ -948,12 +951,15 @@ class MOZ_NON_TEMPORARY_CLASS LifoAllocScope {
LifoAlloc* lifoAlloc;
LifoAlloc::Mark mark;
LifoAlloc::AutoFallibleScope fallibleScope;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit LifoAllocScope(LifoAlloc* lifoAlloc)
explicit LifoAllocScope(LifoAlloc* lifoAlloc MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: lifoAlloc(lifoAlloc),
mark(lifoAlloc->mark()),
fallibleScope(lifoAlloc) {}
fallibleScope(lifoAlloc) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~LifoAllocScope() {
lifoAlloc->release(mark);

Просмотреть файл

@ -27,8 +27,15 @@ class AutoUnlockGC;
*/
class MOZ_RAII AutoLockGC {
public:
explicit AutoLockGC(gc::GCRuntime* gc) : gc(gc) { lock(); }
explicit AutoLockGC(JSRuntime* rt) : AutoLockGC(&rt->gc) {}
explicit AutoLockGC(gc::GCRuntime* gc MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: gc(gc) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
lock();
}
explicit AutoLockGC(JSRuntime* rt MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoLockGC(&rt->gc) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoLockGC() { lockGuard_.reset(); }
@ -49,6 +56,7 @@ class MOZ_RAII AutoLockGC {
private:
mozilla::Maybe<js::LockGuard<js::Mutex>> lockGuard_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
AutoLockGC(const AutoLockGC&) = delete;
AutoLockGC& operator=(const AutoLockGC&) = delete;
@ -94,12 +102,17 @@ class MOZ_RAII AutoLockGCBgAlloc : public AutoLockGC {
class MOZ_RAII AutoUnlockGC {
public:
explicit AutoUnlockGC(AutoLockGC& lock) : lock(lock) { lock.unlock(); }
explicit AutoUnlockGC(AutoLockGC& lock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: lock(lock) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
lock.unlock();
}
~AutoUnlockGC() { lock.lock(); }
private:
AutoLockGC& lock;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
AutoUnlockGC(const AutoUnlockGC&) = delete;
AutoUnlockGC& operator=(const AutoUnlockGC&) = delete;

Просмотреть файл

@ -107,7 +107,10 @@ inline size_t NumLocalsAndArgs(JSScript* script) {
// backend compilation.
class MOZ_RAII AutoEnterIonBackend {
public:
explicit AutoEnterIonBackend(bool safeForMinorGC) {
explicit AutoEnterIonBackend(
bool safeForMinorGC MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
#ifdef DEBUG
JitContext* jcx = GetJitContext();
jcx->enterIonBackend(safeForMinorGC);
@ -121,6 +124,7 @@ class MOZ_RAII AutoEnterIonBackend {
}
#endif
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
bool OffThreadCompilationAvailable(JSContext* cx);

Просмотреть файл

@ -8,6 +8,7 @@
#define jit_JitAllocPolicy_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/OperatorNewExtensions.h"
#include <algorithm>

Просмотреть файл

@ -555,23 +555,30 @@ JS_PUBLIC_API void JS::LeaveRealm(JSContext* cx, JS::Realm* oldRealm) {
cx->leaveRealm(oldRealm);
}
JSAutoRealm::JSAutoRealm(JSContext* cx, JSObject* target)
JSAutoRealm::JSAutoRealm(
JSContext* cx, JSObject* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx), oldRealm_(cx->realm()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_DIAGNOSTIC_ASSERT(!js::IsCrossCompartmentWrapper(target));
AssertHeapIsIdleOrIterating();
cx_->enterRealmOf(target);
}
JSAutoRealm::JSAutoRealm(JSContext* cx, JSScript* target)
JSAutoRealm::JSAutoRealm(
JSContext* cx, JSScript* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx), oldRealm_(cx->realm()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
AssertHeapIsIdleOrIterating();
cx_->enterRealmOf(target);
}
JSAutoRealm::~JSAutoRealm() { cx_->leaveRealm(oldRealm_); }
JSAutoNullableRealm::JSAutoNullableRealm(JSContext* cx, JSObject* targetOrNull)
JSAutoNullableRealm::JSAutoNullableRealm(
JSContext* cx,
JSObject* targetOrNull MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx), oldRealm_(cx->realm()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
AssertHeapIsIdleOrIterating();
if (targetOrNull) {
MOZ_DIAGNOSTIC_ASSERT(!js::IsCrossCompartmentWrapper(targetOrNull));

Просмотреть файл

@ -75,8 +75,10 @@ using StringVector = JS::GCVector<JSString*>;
class MOZ_RAII JS_PUBLIC_API CustomAutoRooter : private AutoGCRooter {
public:
template <typename CX>
explicit CustomAutoRooter(const CX& cx)
: AutoGCRooter(cx, AutoGCRooter::Kind::Custom) {}
explicit CustomAutoRooter(const CX& cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: AutoGCRooter(cx, AutoGCRooter::Kind::Custom) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
friend void AutoGCRooter::trace(JSTracer* trc);
@ -87,6 +89,7 @@ class MOZ_RAII JS_PUBLIC_API CustomAutoRooter : private AutoGCRooter {
virtual void trace(JSTracer* trc) = 0;
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} /* namespace JS */
@ -416,10 +419,11 @@ class MOZ_RAII JS_PUBLIC_API JSAutoRealm {
JS::Realm* oldRealm_;
public:
JSAutoRealm(JSContext* cx, JSObject* target);
JSAutoRealm(JSContext* cx, JSScript* target);
JSAutoRealm(JSContext* cx, JSObject* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
JSAutoRealm(JSContext* cx, JSScript* target MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~JSAutoRealm();
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII JS_PUBLIC_API JSAutoNullableRealm {
@ -427,9 +431,11 @@ class MOZ_RAII JS_PUBLIC_API JSAutoNullableRealm {
JS::Realm* oldRealm_;
public:
explicit JSAutoNullableRealm(JSContext* cx, JSObject* targetOrNull);
explicit JSAutoNullableRealm(
JSContext* cx, JSObject* targetOrNull MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~JSAutoNullableRealm();
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
namespace JS {
@ -2816,13 +2822,16 @@ extern JS_PUBLIC_API void UnhideScriptedCaller(JSContext* cx);
class MOZ_RAII AutoHideScriptedCaller {
public:
explicit AutoHideScriptedCaller(JSContext* cx) : mContext(cx) {
explicit AutoHideScriptedCaller(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mContext(cx) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
HideScriptedCaller(mContext);
}
~AutoHideScriptedCaller() { UnhideScriptedCaller(mContext); }
protected:
JSContext* mContext;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} /* namespace JS */

Просмотреть файл

@ -1358,10 +1358,12 @@ JS_FRIEND_API void js::SetCTypesActivityCallback(JSContext* cx,
js::AutoCTypesActivityCallback::AutoCTypesActivityCallback(
JSContext* cx, js::CTypesActivityType beginType,
js::CTypesActivityType endType)
js::CTypesActivityType endType MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx(cx),
callback(cx->runtime()->ctypesActivityCallback),
endType(endType) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (callback) {
callback(cx, beginType);
}

Просмотреть файл

@ -2189,10 +2189,12 @@ class MOZ_RAII JS_FRIEND_API AutoCTypesActivityCallback {
JSContext* cx;
CTypesActivityCallback callback;
CTypesActivityType endType;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
AutoCTypesActivityCallback(JSContext* cx, CTypesActivityType beginType,
CTypesActivityType endType);
CTypesActivityType endType
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoCTypesActivityCallback() { DoEndCallback(); }
void DoEndCallback() {
if (callback) {

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/Atomics.h"
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/mozalloc.h"
#include "mozilla/PodOperations.h"

Просмотреть файл

@ -495,19 +495,25 @@ struct WrapperValue {
class MOZ_RAII AutoWrapperVector : public JS::GCVector<WrapperValue, 8>,
public JS::AutoGCRooter {
public:
explicit AutoWrapperVector(JSContext* cx)
explicit AutoWrapperVector(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::GCVector<WrapperValue, 8>(cx),
JS::AutoGCRooter(cx, JS::AutoGCRooter::Kind::WrapperVector) {}
JS::AutoGCRooter(cx, JS::AutoGCRooter::Kind::WrapperVector) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
void trace(JSTracer* trc);
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII AutoWrapperRooter : public JS::AutoGCRooter {
public:
AutoWrapperRooter(JSContext* cx, const WrapperValue& v)
: JS::AutoGCRooter(cx, JS::AutoGCRooter::Kind::Wrapper), value(v) {}
AutoWrapperRooter(JSContext* cx,
const WrapperValue& v MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::AutoGCRooter(cx, JS::AutoGCRooter::Kind::Wrapper), value(v) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
operator JSObject*() const { return value; }
@ -515,6 +521,7 @@ class MOZ_RAII AutoWrapperRooter : public JS::AutoGCRooter {
private:
WrapperValue value;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} /* namespace js */

Просмотреть файл

@ -1272,28 +1272,39 @@ const JSClass RuntimeLexicalErrorObject::class_ = {
/*****************************************************************************/
EnvironmentIter::EnvironmentIter(JSContext* cx, const EnvironmentIter& ei)
: si_(cx, ei.si_.get()), env_(cx, ei.env_), frame_(ei.frame_) {}
EnvironmentIter::EnvironmentIter(JSContext* cx,
const EnvironmentIter& ei
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: si_(cx, ei.si_.get()), env_(cx, ei.env_), frame_(ei.frame_) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
EnvironmentIter::EnvironmentIter(JSContext* cx, JSObject* env, Scope* scope)
EnvironmentIter::EnvironmentIter(JSContext* cx, JSObject* env,
Scope* scope
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: si_(cx, ScopeIter(scope)), env_(cx, env), frame_(NullFramePtr()) {
settle();
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
EnvironmentIter::EnvironmentIter(JSContext* cx, AbstractFramePtr frame,
jsbytecode* pc)
jsbytecode* pc
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: si_(cx, frame.script()->innermostScope(pc)),
env_(cx, frame.environmentChain()),
frame_(frame) {
cx->check(frame);
settle();
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
EnvironmentIter::EnvironmentIter(JSContext* cx, JSObject* env, Scope* scope,
AbstractFramePtr frame)
AbstractFramePtr frame
MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: si_(cx, ScopeIter(scope)), env_(cx, env), frame_(frame) {
cx->check(frame);
settle();
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
void EnvironmentIter::incrementScopeIter() {

Просмотреть файл

@ -719,20 +719,23 @@ class MOZ_RAII EnvironmentIter {
public:
// Constructing from a copy of an existing EnvironmentIter.
EnvironmentIter(JSContext* cx, const EnvironmentIter& ei);
EnvironmentIter(JSContext* cx,
const EnvironmentIter& ei MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
// Constructing from an environment, scope pair. All environments
// considered not to be withinInitialFrame, since no frame is given.
EnvironmentIter(JSContext* cx, JSObject* env, Scope* scope);
EnvironmentIter(JSContext* cx, JSObject* env,
Scope* scope MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
// Constructing from a frame. Places the EnvironmentIter on the innermost
// environment at pc.
EnvironmentIter(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc);
EnvironmentIter(JSContext* cx, AbstractFramePtr frame,
jsbytecode* pc MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
// Constructing from an environment, scope and frame. The frame is given
// to initialize to proper enclosing environment/scope.
EnvironmentIter(JSContext* cx, JSObject* env, Scope* scope,
AbstractFramePtr frame);
AbstractFramePtr frame MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
bool done() const { return si_.done(); }
@ -788,6 +791,7 @@ class MOZ_RAII EnvironmentIter {
AbstractFramePtr maybeInitialFrame() const { return frame_; }
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// The key in MissingEnvironmentMap. For live frames, maps live frames to

Просмотреть файл

@ -35,19 +35,22 @@ inline void GeckoProfilerThread::updatePC(JSContext* cx, JSScript* script,
*/
class MOZ_RAII AutoSuppressProfilerSampling {
public:
explicit AutoSuppressProfilerSampling(JSContext* cx);
explicit AutoSuppressProfilerSampling(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoSuppressProfilerSampling();
private:
JSContext* cx_;
bool previouslyEnabled_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
MOZ_ALWAYS_INLINE
GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script)
GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(
JSContext* cx, JSScript* script MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: profiler_(&cx->geckoProfiler()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (MOZ_LIKELY(!profiler_->infraInstalled())) {
profiler_ = nullptr;
#ifdef DEBUG
@ -83,8 +86,9 @@ GeckoProfilerEntryMarker::~GeckoProfilerEntryMarker() {
MOZ_ALWAYS_INLINE
AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(
JSContext* cx, const char* label, JS::ProfilingCategoryPair categoryPair,
uint32_t flags)
uint32_t flags MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: profiler_(&cx->geckoProfiler()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (MOZ_LIKELY(!profiler_->infraInstalled())) {
profiler_ = nullptr;
#ifdef DEBUG

Просмотреть файл

@ -405,8 +405,10 @@ void ProfilingStackFrame::trace(JSTracer* trc) {
}
GeckoProfilerBaselineOSRMarker::GeckoProfilerBaselineOSRMarker(
JSContext* cx, bool hasProfilerFrame)
JSContext* cx,
bool hasProfilerFrame MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: profiler(&cx->geckoProfiler()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (!hasProfilerFrame || !cx->runtime()->geckoProfiler().enabled()) {
profiler = nullptr;
return;
@ -504,8 +506,10 @@ JS_FRIEND_API void js::RegisterContextProfilingEventMarker(
cx->runtime()->geckoProfiler().setEventMarker(fn);
}
AutoSuppressProfilerSampling::AutoSuppressProfilerSampling(JSContext* cx)
AutoSuppressProfilerSampling::AutoSuppressProfilerSampling(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx), previouslyEnabled_(cx->isProfilerSamplingEnabled()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (previouslyEnabled_) {
cx_->disableProfilerSampling();
}

Просмотреть файл

@ -8,6 +8,7 @@
#define vm_GeckoProfiler_h
#include "mozilla/DebugOnly.h"
#include "mozilla/GuardObjects.h"
#include <stddef.h>
@ -156,8 +157,8 @@ inline void GeckoProfilerRuntime::stringsReset() { strings().clear(); }
*/
class MOZ_RAII GeckoProfilerEntryMarker {
public:
explicit MOZ_ALWAYS_INLINE GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script);
explicit MOZ_ALWAYS_INLINE GeckoProfilerEntryMarker(
JSContext* cx, JSScript* script MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
MOZ_ALWAYS_INLINE ~GeckoProfilerEntryMarker();
private:
@ -165,6 +166,7 @@ class MOZ_RAII GeckoProfilerEntryMarker {
#ifdef DEBUG
uint32_t spBefore_;
#endif
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*
@ -177,7 +179,7 @@ class MOZ_NONHEAP_CLASS AutoGeckoProfilerEntry {
explicit MOZ_ALWAYS_INLINE AutoGeckoProfilerEntry(
JSContext* cx, const char* label,
JS::ProfilingCategoryPair categoryPair = JS::ProfilingCategoryPair::JS,
uint32_t flags = 0);
uint32_t flags = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
MOZ_ALWAYS_INLINE ~AutoGeckoProfilerEntry();
private:
@ -185,6 +187,7 @@ class MOZ_NONHEAP_CLASS AutoGeckoProfilerEntry {
#ifdef DEBUG
uint32_t spBefore_;
#endif
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*
@ -194,12 +197,14 @@ class MOZ_NONHEAP_CLASS AutoGeckoProfilerEntry {
*/
class MOZ_RAII GeckoProfilerBaselineOSRMarker {
public:
explicit GeckoProfilerBaselineOSRMarker(JSContext* cx, bool hasProfilerFrame);
explicit GeckoProfilerBaselineOSRMarker(
JSContext* cx, bool hasProfilerFrame MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~GeckoProfilerBaselineOSRMarker();
private:
GeckoProfilerThread* profiler;
mozilla::DebugOnly<uint32_t> spBefore_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*

Просмотреть файл

@ -14,6 +14,7 @@
#define vm_HelperThreads_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/PodOperations.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Utf8.h" // mozilla::Utf8Unit
@ -670,18 +671,26 @@ void RunPendingSourceCompressions(JSRuntime* runtime);
class MOZ_RAII AutoLockHelperThreadState : public LockGuard<Mutex> {
using Base = LockGuard<Mutex>;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoLockHelperThreadState() : Base(HelperThreadState().helperLock) {}
explicit AutoLockHelperThreadState(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: Base(HelperThreadState().helperLock) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
};
class MOZ_RAII AutoUnlockHelperThreadState : public UnlockGuard<Mutex> {
using Base = UnlockGuard<Mutex>;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoUnlockHelperThreadState(AutoLockHelperThreadState& locked)
: Base(locked) {}
explicit AutoUnlockHelperThreadState(
AutoLockHelperThreadState& locked MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: Base(locked) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
};
struct MOZ_RAII AutoSetHelperThreadContext {

Просмотреть файл

@ -1196,7 +1196,10 @@ void AutoEnterOOMUnsafeRegion::crash(size_t size, const char* reason) {
crash(reason);
}
AutoKeepAtoms::AutoKeepAtoms(JSContext* cx) : cx(cx) {
AutoKeepAtoms::AutoKeepAtoms(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx(cx) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
cx->zone()->keepAtoms();
}

Просмотреть файл

@ -61,8 +61,11 @@ class MOZ_RAII AutoCycleDetector {
public:
using Vector = GCVector<JSObject*, 8>;
AutoCycleDetector(JSContext* cx, HandleObject objArg)
: cx(cx), obj(cx, objArg), cyclic(true) {}
AutoCycleDetector(JSContext* cx,
HandleObject objArg MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx), obj(cx, objArg), cyclic(true) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoCycleDetector();
@ -74,6 +77,7 @@ class MOZ_RAII AutoCycleDetector {
JSContext* cx;
RootedObject obj;
bool cyclic;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
struct AutoResolving;
@ -1012,8 +1016,9 @@ struct MOZ_RAII AutoResolving {
enum Kind { LOOKUP, WATCH };
AutoResolving(JSContext* cx, HandleObject obj, HandleId id,
Kind kind = LOOKUP)
Kind kind = LOOKUP MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: context(cx), object(obj), id(id), kind(kind), link(cx->resolvingList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(obj);
cx->resolvingList = this;
}
@ -1033,6 +1038,7 @@ struct MOZ_RAII AutoResolving {
HandleId id;
Kind const kind;
AutoResolving* const link;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*
@ -1095,10 +1101,14 @@ class MOZ_STACK_CLASS ExternalValueArray {
class MOZ_RAII RootedExternalValueArray
: public JS::Rooted<ExternalValueArray> {
public:
RootedExternalValueArray(JSContext* cx, size_t len, Value* vec)
: JS::Rooted<ExternalValueArray>(cx, ExternalValueArray(len, vec)) {}
RootedExternalValueArray(JSContext* cx, size_t len,
Value* vec MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: JS::Rooted<ExternalValueArray>(cx, ExternalValueArray(len, vec)) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class AutoAssertNoPendingException {
@ -1121,7 +1131,8 @@ class MOZ_RAII AutoLockScriptData {
JSRuntime* runtime;
public:
explicit AutoLockScriptData(JSRuntime* rt) {
explicit AutoLockScriptData(JSRuntime* rt MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt) ||
CurrentThreadIsParseThread());
runtime = rt;
@ -1145,6 +1156,7 @@ class MOZ_RAII AutoLockScriptData {
}
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// A token used to prove you can safely access the atoms zone. This zone is
@ -1165,9 +1177,10 @@ class MOZ_STACK_CLASS AutoAccessAtomsZone {
class MOZ_RAII AutoKeepAtoms {
JSContext* cx;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoKeepAtoms(JSContext* cx);
explicit AutoKeepAtoms(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoKeepAtoms();
};

Просмотреть файл

@ -786,9 +786,11 @@ mozilla::HashCodeScrambler Realm::randomHashCodeScrambler() {
randomKeyGenerator_.next());
}
AutoSetNewObjectMetadata::AutoSetNewObjectMetadata(JSContext* cx)
AutoSetNewObjectMetadata::AutoSetNewObjectMetadata(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: cx_(cx->isHelperThreadContext() ? nullptr : cx),
prevState_(cx, cx->realm()->objectMetadataState_) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (cx_) {
cx_->realm()->objectMetadataState_ =
NewObjectMetadataState(DelayMetadata());

Просмотреть файл

@ -192,6 +192,7 @@ using NewObjectMetadataState =
mozilla::Variant<ImmediateMetadata, DelayMetadata, PendingMetadata>;
class MOZ_RAII AutoSetNewObjectMetadata {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
JSContext* cx_;
Rooted<NewObjectMetadataState> prevState_;
@ -200,7 +201,8 @@ class MOZ_RAII AutoSetNewObjectMetadata {
void operator=(const AutoSetNewObjectMetadata& aOther) = delete;
public:
explicit AutoSetNewObjectMetadata(JSContext* cx);
explicit AutoSetNewObjectMetadata(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoSetNewObjectMetadata();
};
@ -851,14 +853,17 @@ namespace js {
class MOZ_RAII AssertRealmUnchanged {
public:
explicit AssertRealmUnchanged(JSContext* cx)
: cx(cx), oldRealm(cx->realm()) {}
explicit AssertRealmUnchanged(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx), oldRealm(cx->realm()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AssertRealmUnchanged() { MOZ_ASSERT(cx->realm() == oldRealm); }
protected:
JSContext* const cx;
JS::Realm* const oldRealm;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// AutoRealm can be used to enter the realm of a JSObject, JSScript or

Просмотреть файл

@ -207,9 +207,13 @@ class SavedStacks {
// reentrancy, just change the behavior of SavedStacks::saveCurrentStack to
// return a nullptr SavedFrame.
struct MOZ_RAII AutoReentrancyGuard {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
SavedStacks& stacks;
explicit AutoReentrancyGuard(SavedStacks& stacks) : stacks(stacks) {
explicit AutoReentrancyGuard(
SavedStacks& stacks MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: stacks(stacks) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
stacks.creatingSavedFrame = true;
}

Просмотреть файл

@ -264,13 +264,13 @@ inline AutoRooterGetterSetter::Inner::Inner(uint8_t attrs, GetterOp* pgetter_,
SetterOp* psetter_)
: attrs(attrs), pgetter(pgetter_), psetter(psetter_) {}
inline AutoRooterGetterSetter::AutoRooterGetterSetter(JSContext* cx,
uint8_t attrs,
GetterOp* pgetter,
SetterOp* psetter) {
inline AutoRooterGetterSetter::AutoRooterGetterSetter(
JSContext* cx, uint8_t attrs, GetterOp* pgetter,
SetterOp* psetter MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) {
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
inner.emplace(cx, Inner(attrs, pgetter, psetter));
}
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
static inline uint8_t GetPropertyAttributes(JSObject* obj,

Просмотреть файл

@ -8,6 +8,7 @@
#define vm_Shape_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Maybe.h"
@ -1497,10 +1498,12 @@ class MOZ_RAII AutoRooterGetterSetter {
public:
inline AutoRooterGetterSetter(JSContext* cx, uint8_t attrs, GetterOp* pgetter,
SetterOp* psetter);
SetterOp* psetter
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
private:
mozilla::Maybe<Rooted<Inner>> inner;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
struct EmptyShape : public js::Shape {

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef TraceLogging_h
#define TraceLogging_h
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
@ -643,8 +644,10 @@ class MOZ_RAII AutoTraceLog {
AutoTraceLog* prev;
public:
AutoTraceLog(TraceLoggerThread* logger, const TraceLoggerEvent& event)
AutoTraceLog(TraceLoggerThread* logger,
const TraceLoggerEvent& event MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: logger(logger), isEvent(true), executed(false), prev(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
payload.event = &event;
if (logger) {
logger->startEvent(event);
@ -654,8 +657,10 @@ class MOZ_RAII AutoTraceLog {
}
}
AutoTraceLog(TraceLoggerThread* logger, TraceLoggerTextId id)
AutoTraceLog(TraceLoggerThread* logger,
TraceLoggerTextId id MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: logger(logger), isEvent(false), executed(false), prev(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
payload.id = id;
if (logger) {
logger->startEvent(id);
@ -691,11 +696,18 @@ class MOZ_RAII AutoTraceLog {
}
#else
public:
AutoTraceLog(TraceLoggerThread* logger, uint32_t textId) {}
AutoTraceLog(TraceLoggerThread* logger, const TraceLoggerEvent& event) {}
AutoTraceLog(TraceLoggerThread* logger,
uint32_t textId MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
AutoTraceLog(TraceLoggerThread* logger,
const TraceLoggerEvent& event MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
#endif
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace js

Просмотреть файл

@ -93,10 +93,12 @@ static void WatchdogMain(void* arg);
class Watchdog;
class WatchdogManager;
class MOZ_RAII AutoLockWatchdog final {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
Watchdog* const mWatchdog;
public:
explicit AutoLockWatchdog(Watchdog* aWatchdog);
explicit AutoLockWatchdog(
Watchdog* aWatchdog MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoLockWatchdog();
};
@ -448,7 +450,10 @@ class WatchdogManager {
PRTime mTimestamps[kWatchdogTimestampCategoryCount - 1];
};
AutoLockWatchdog::AutoLockWatchdog(Watchdog* aWatchdog) : mWatchdog(aWatchdog) {
AutoLockWatchdog::AutoLockWatchdog(
Watchdog* aWatchdog MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mWatchdog(aWatchdog) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mWatchdog) {
PR_Lock(mWatchdog->GetLock());
}

Просмотреть файл

@ -77,6 +77,7 @@
#include "mozilla/CycleCollectedJSRuntime.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/DefineEnum.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
@ -1951,8 +1952,10 @@ class MOZ_RAII AutoScriptEvaluate {
* Saves the JSContext as well as initializing our state
* @param cx The JSContext, this can be null, we don't do anything then
*/
explicit AutoScriptEvaluate(JSContext* cx)
: mJSContext(cx), mEvaluated(false) {}
explicit AutoScriptEvaluate(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mJSContext(cx), mEvaluated(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
/**
* Does the pre script evaluation.
@ -1972,6 +1975,7 @@ class MOZ_RAII AutoScriptEvaluate {
mozilla::Maybe<JS::AutoSaveExceptionState> mState;
bool mEvaluated;
mozilla::Maybe<JSAutoRealm> mAutoRealm;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
// No copying or assignment allowed
AutoScriptEvaluate(const AutoScriptEvaluate&) = delete;
@ -1981,7 +1985,8 @@ class MOZ_RAII AutoScriptEvaluate {
/***************************************************************************/
class MOZ_RAII AutoResolveName {
public:
AutoResolveName(XPCCallContext& ccx, JS::HandleId name)
AutoResolveName(XPCCallContext& ccx,
JS::HandleId name MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mContext(ccx.GetContext()),
mOld(ccx, mContext->SetResolveName(name))
#ifdef DEBUG
@ -1989,6 +1994,7 @@ class MOZ_RAII AutoResolveName {
mCheck(ccx, name)
#endif
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoResolveName() {
@ -2002,6 +2008,7 @@ class MOZ_RAII AutoResolveName {
#ifdef DEBUG
JS::RootedId mCheck;
#endif
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/***************************************************************************/

Просмотреть файл

@ -4597,8 +4597,11 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
// instead of using this class.)
class MOZ_RAII AutoFlexItemMainSizeOverride final {
public:
explicit AutoFlexItemMainSizeOverride(FlexItem& aItem)
explicit AutoFlexItemMainSizeOverride(
FlexItem& aItem MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mItemFrame(aItem.Frame()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(!mItemFrame->HasProperty(nsIFrame::FlexItemMainSizeOverride()),
"FlexItemMainSizeOverride prop shouldn't be set already; "
"it should only be set temporarily (& not recursively)");
@ -4624,6 +4627,7 @@ class MOZ_RAII AutoFlexItemMainSizeOverride final {
private:
nsIFrame* mItemFrame;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void nsFlexContainerFrame::CalculatePackingSpace(

Просмотреть файл

@ -211,7 +211,10 @@ bool nsFrameSelection::IsValidSelectionPoint(nsINode* aNode) const {
namespace mozilla {
struct MOZ_RAII AutoPrepareFocusRange {
AutoPrepareFocusRange(Selection* aSelection,
const bool aMultiRangeSelection) {
const bool aMultiRangeSelection
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(aSelection);
MOZ_ASSERT(aSelection->GetType() == SelectionType::eNormal);
@ -318,6 +321,7 @@ struct MOZ_RAII AutoPrepareFocusRange {
}
Maybe<Selection::AutoUserInitiated> mUserSelect;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace mozilla

Просмотреть файл

@ -77,12 +77,14 @@ class MOZ_RAII AutoReferenceChainGuard {
*/
AutoReferenceChainGuard(nsIFrame* aFrame, bool* aFrameInUse,
int16_t* aChainCounter,
int16_t aMaxChainLength = sDefaultMaxChainLength)
int16_t aMaxChainLength = sDefaultMaxChainLength
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mFrame(aFrame),
mFrameInUse(aFrameInUse),
mChainCounter(aChainCounter),
mMaxChainLength(aMaxChainLength),
mBrokeReference(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(aFrame && aFrameInUse && aChainCounter);
MOZ_ASSERT(aMaxChainLength > 0);
MOZ_ASSERT(*aChainCounter == noChain ||
@ -162,6 +164,7 @@ class MOZ_RAII AutoReferenceChainGuard {
int16_t* mChainCounter;
const int16_t mMaxChainLength;
bool mBrokeReference;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace mozilla

Просмотреть файл

@ -196,8 +196,10 @@ void SVGMarkerFrame::AppendDirectlyOwnedAnonBoxes(
// helper class
SVGMarkerFrame::AutoMarkerReferencer::AutoMarkerReferencer(
SVGMarkerFrame* aFrame, SVGGeometryFrame* aMarkedFrame)
SVGMarkerFrame* aFrame,
SVGGeometryFrame* aMarkedFrame MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mFrame(aFrame) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mFrame->mInUse = true;
mFrame->mMarkedFrame = aMarkedFrame;

Просмотреть файл

@ -111,11 +111,13 @@ class SVGMarkerFrame final : public SVGContainerFrame {
class MOZ_RAII AutoMarkerReferencer {
public:
AutoMarkerReferencer(SVGMarkerFrame* aFrame,
SVGGeometryFrame* aMarkedFrame);
SVGGeometryFrame* aMarkedFrame
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoMarkerReferencer();
private:
SVGMarkerFrame* mFrame;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// SVGMarkerFrame methods:

Просмотреть файл

@ -30,7 +30,10 @@ class DrawTarget;
*/
class MOZ_RAII AutoSetRestorePaintServerState {
public:
explicit AutoSetRestorePaintServerState(nsIFrame* aFrame) : mFrame(aFrame) {
explicit AutoSetRestorePaintServerState(
nsIFrame* aFrame MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mFrame(aFrame) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
}
~AutoSetRestorePaintServerState() {
@ -39,6 +42,7 @@ class MOZ_RAII AutoSetRestorePaintServerState {
private:
nsIFrame* mFrame;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class SVGPaintServerFrame : public SVGContainerFrame {

Просмотреть файл

@ -79,10 +79,12 @@ namespace mozilla {
// we only take the address of this:
static gfx::UserDataKey sSVGAutoRenderStateKey;
SVGAutoRenderState::SVGAutoRenderState(DrawTarget* aDrawTarget)
SVGAutoRenderState::SVGAutoRenderState(
DrawTarget* aDrawTarget MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mDrawTarget(aDrawTarget),
mOriginalRenderState(nullptr),
mPaintingToWindow(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mOriginalRenderState = aDrawTarget->RemoveUserData(&sSVGAutoRenderStateKey);
// We always remove ourselves from aContext before it dies, so
// passing nullptr as the destroy function is okay.

Просмотреть файл

@ -131,7 +131,8 @@ class MOZ_RAII SVGAutoRenderState final {
using DrawTarget = gfx::DrawTarget;
public:
explicit SVGAutoRenderState(DrawTarget* aDrawTarget);
explicit SVGAutoRenderState(
DrawTarget* aDrawTarget MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~SVGAutoRenderState();
void SetPaintingToWindow(bool aPaintingToWindow);
@ -142,6 +143,7 @@ class MOZ_RAII SVGAutoRenderState final {
DrawTarget* mDrawTarget;
void* mOriginalRenderState;
bool mPaintingToWindow;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**

Просмотреть файл

@ -15,6 +15,7 @@
# include <pthread.h>
#endif
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
// Mutexes based on spinlocks. We can't use normal pthread spinlocks in all
// places, because they require malloc()ed memory, which causes bootstrapping
@ -112,11 +113,16 @@ typedef Mutex StaticMutex;
template <typename T>
struct MOZ_RAII AutoLock {
explicit AutoLock(T& aMutex) : mMutex(aMutex) { mMutex.Lock(); }
explicit AutoLock(T& aMutex MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mMutex(aMutex) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mMutex.Lock();
}
~AutoLock() { mMutex.Unlock(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
T& mMutex;
};

Просмотреть файл

@ -11,11 +11,13 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
namespace mozilla {
/* Useful for implementing containers that assert non-reentrancy */
class MOZ_RAII ReentrancyGuard {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
#ifdef DEBUG
bool& mEntered;
#endif
@ -23,12 +25,13 @@ class MOZ_RAII ReentrancyGuard {
public:
template <class T>
#ifdef DEBUG
explicit ReentrancyGuard(T& aObj)
explicit ReentrancyGuard(T& aObj MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mEntered(aObj.mEntered)
#else
explicit ReentrancyGuard(T&)
explicit ReentrancyGuard(T& MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
#endif
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
#ifdef DEBUG
MOZ_ASSERT(!mEntered);
mEntered = true;

Просмотреть файл

@ -83,6 +83,7 @@
#include <utility>
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
namespace mozilla {
@ -90,14 +91,18 @@ template <typename ExitFunction>
class MOZ_STACK_CLASS ScopeExit {
ExitFunction mExitFunction;
bool mExecuteOnDestruction;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit ScopeExit(ExitFunction&& cleanup)
: mExitFunction(cleanup), mExecuteOnDestruction(true) {}
explicit ScopeExit(ExitFunction&& cleanup MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mExitFunction(cleanup), mExecuteOnDestruction(true) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
ScopeExit(ScopeExit&& rhs)
ScopeExit(ScopeExit&& rhs MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mExitFunction(std::move(rhs.mExitFunction)),
mExecuteOnDestruction(rhs.mExecuteOnDestruction) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
rhs.release();
}

Просмотреть файл

@ -46,6 +46,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
namespace mozilla {
@ -69,12 +70,20 @@ class MOZ_NON_TEMPORARY_CLASS Scoped {
public:
typedef typename Traits::type Resource;
explicit Scoped() : mValue(Traits::empty()) {}
explicit Scoped(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: mValue(Traits::empty()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit Scoped(const Resource& aValue) : mValue(aValue) {}
explicit Scoped(const Resource& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mValue(aValue) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
/* Move constructor. */
Scoped(Scoped&& aOther) : mValue(std::move(aOther.mValue)) {
Scoped(Scoped&& aOther MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mValue(std::move(aOther.mValue)) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
aOther.mValue = Traits::empty();
}
@ -144,6 +153,7 @@ class MOZ_NON_TEMPORARY_CLASS Scoped {
private:
Resource mValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*
@ -154,25 +164,28 @@ class MOZ_NON_TEMPORARY_CLASS Scoped {
* @param Traits A struct implementing clean-up. See the implementations
* for more details.
*/
#define SCOPED_TEMPLATE(name, Traits) \
template <typename Type> \
struct MOZ_NON_TEMPORARY_CLASS name \
: public mozilla::Scoped<Traits<Type> > { \
typedef mozilla::Scoped<Traits<Type> > Super; \
typedef typename Super::Resource Resource; \
name& operator=(Resource aRhs) { \
Super::operator=(aRhs); \
return *this; \
} \
name& operator=(name&& aRhs) = default; \
\
explicit name() : Super() {} \
explicit name(Resource aRhs) : Super(aRhs) {} \
name(name&& aRhs) : Super(std::move(aRhs)) {} \
\
private: \
explicit name(const name&) = delete; \
name& operator=(const name&) = delete; \
#define SCOPED_TEMPLATE(name, Traits) \
template <typename Type> \
struct MOZ_NON_TEMPORARY_CLASS name \
: public mozilla::Scoped<Traits<Type> > { \
typedef mozilla::Scoped<Traits<Type> > Super; \
typedef typename Super::Resource Resource; \
name& operator=(Resource aRhs) { \
Super::operator=(aRhs); \
return *this; \
} \
name& operator=(name&& aRhs) = default; \
\
explicit name(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) \
: Super(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT) {} \
explicit name(Resource aRhs MOZ_GUARD_OBJECT_NOTIFIER_PARAM) \
: Super(aRhs MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {} \
name(name&& aRhs MOZ_GUARD_OBJECT_NOTIFIER_PARAM) \
: Super(std::move(aRhs) MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) {} \
\
private: \
explicit name(const name&) = delete; \
name& operator=(const name&) = delete; \
};
/*

Просмотреть файл

@ -67,6 +67,7 @@
# include "mozilla/Assertions.h"
# include "mozilla/Atomics.h"
# include "mozilla/Attributes.h"
# include "mozilla/GuardObjects.h"
# include "mozilla/Maybe.h"
# include "mozilla/PowerOfTwo.h"
# include "mozilla/Sprintf.h"
@ -628,12 +629,16 @@ class StaticBaseProfilerStats {
// `StaticBaseProfilerStats`.
class MOZ_RAII AutoProfilerStats {
public:
explicit AutoProfilerStats(StaticBaseProfilerStats& aStats)
: mStats(aStats), mStart(TimeStamp::NowUnfuzzed()) {}
explicit AutoProfilerStats(
StaticBaseProfilerStats& aStats MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mStats(aStats), mStart(TimeStamp::NowUnfuzzed()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoProfilerStats() { mStats.AddDurationFrom(mStart); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
StaticBaseProfilerStats& mStats;
TimeStamp mStart;
@ -853,13 +858,16 @@ class MOZ_RAII AutoProfilerTextMarker {
AutoProfilerTextMarker(const char* aMarkerName, const std::string& aText,
ProfilingCategoryPair aCategoryPair,
const Maybe<uint64_t>& aInnerWindowID,
UniqueProfilerBacktrace&& aCause = nullptr)
UniqueProfilerBacktrace&& aCause =
nullptr MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mMarkerName(aMarkerName),
mText(aText),
mCategoryPair(aCategoryPair),
mStartTime(TimeStamp::NowUnfuzzed()),
mCause(std::move(aCause)),
mInnerWindowID(aInnerWindowID) {}
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoProfilerTextMarker() {
profiler_add_text_marker(mMarkerName, mText, mCategoryPair, mStartTime,
@ -868,6 +876,7 @@ class MOZ_RAII AutoProfilerTextMarker {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mMarkerName;
std::string mText;
const ProfilingCategoryPair mCategoryPair;
@ -915,18 +924,24 @@ MFBT_API void profiler_save_profile_to_file(const char* aFilename);
class MOZ_RAII AutoProfilerInit {
public:
explicit AutoProfilerInit() { profiler_init(this); }
explicit AutoProfilerInit(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_init(this);
}
~AutoProfilerInit() { profiler_shutdown(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// Convenience class to register and unregister a thread with the profiler.
// Needs to be the first object on the stack of the thread.
class MOZ_RAII AutoProfilerRegisterThread final {
public:
explicit AutoProfilerRegisterThread(const char* aName) {
explicit AutoProfilerRegisterThread(
const char* aName MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_register_thread(aName, this);
}
@ -936,23 +951,29 @@ class MOZ_RAII AutoProfilerRegisterThread final {
AutoProfilerRegisterThread(const AutoProfilerRegisterThread&) = delete;
AutoProfilerRegisterThread& operator=(const AutoProfilerRegisterThread&) =
delete;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII AutoProfilerThreadSleep {
public:
explicit AutoProfilerThreadSleep() { profiler_thread_sleep(); }
explicit AutoProfilerThreadSleep(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_thread_sleep();
}
~AutoProfilerThreadSleep() { profiler_thread_wake(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// Temporarily wake up the profiling of a thread while servicing events such as
// Asynchronous Procedure Calls (APCs).
class MOZ_RAII AutoProfilerThreadWake {
public:
explicit AutoProfilerThreadWake()
explicit AutoProfilerThreadWake(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: mIssuedWake(profiler_thread_is_sleeping()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mIssuedWake) {
profiler_thread_wake();
}
@ -966,6 +987,7 @@ class MOZ_RAII AutoProfilerThreadWake {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mIssuedWake;
};
@ -978,7 +1000,10 @@ class MOZ_RAII AutoProfilerLabel {
// This is the AUTO_BASE_PROFILER_LABEL and AUTO_BASE_PROFILER_LABEL_DYNAMIC
// variant.
AutoProfilerLabel(const char* aLabel, const char* aDynamicString,
ProfilingCategoryPair aCategoryPair, uint32_t aFlags = 0) {
ProfilingCategoryPair aCategoryPair,
uint32_t aFlags = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
// Get the ProfilingStack from TLS.
Push(GetProfilingStack(), aLabel, aDynamicString, aCategoryPair, aFlags);
}
@ -1006,6 +1031,7 @@ class MOZ_RAII AutoProfilerLabel {
MFBT_API static ProfilingStack* GetProfilingStack();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
// We save a ProfilingStack pointer in the ctor so we don't have to redo the
// TLS lookup in the dtor.
@ -1020,23 +1046,26 @@ class MOZ_RAII AutoProfilerTracing {
public:
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
ProfilingCategoryPair aCategoryPair,
const Maybe<uint64_t>& aInnerWindowID)
const Maybe<uint64_t>& aInnerWindowID
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategoryString(aCategoryString),
mMarkerName(aMarkerName),
mCategoryPair(aCategoryPair),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing_marker(mCategoryString, mMarkerName, aCategoryPair,
TRACING_INTERVAL_START, mInnerWindowID);
}
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
ProfilingCategoryPair aCategoryPair,
UniqueProfilerBacktrace aBacktrace,
const Maybe<uint64_t>& aInnerWindowID)
AutoProfilerTracing(
const char* aCategoryString, const char* aMarkerName,
ProfilingCategoryPair aCategoryPair, UniqueProfilerBacktrace aBacktrace,
const Maybe<uint64_t>& aInnerWindowID MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategoryString(aCategoryString),
mMarkerName(aMarkerName),
mCategoryPair(aCategoryPair),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing_marker(mCategoryString, mMarkerName, aCategoryPair,
TRACING_INTERVAL_START, std::move(aBacktrace),
mInnerWindowID);
@ -1048,6 +1077,7 @@ class MOZ_RAII AutoProfilerTracing {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mCategoryString;
const char* mMarkerName;
const ProfilingCategoryPair mCategoryPair;

Просмотреть файл

@ -95,8 +95,11 @@ void ProfilerLabelEnd(const ProfilerLabel& aLabel) {
}
}
AutoProfilerLabel::AutoProfilerLabel(const char* aLabel,
const char* aDynamicString) {
AutoProfilerLabel::AutoProfilerLabel(
const char* aLabel,
const char* aDynamicString MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
Tie(mEntryContext, mGeneration) =
ProfilerLabelBegin(aLabel, aDynamicString, this);
}

Просмотреть файл

@ -8,6 +8,7 @@
#define mozilla_AutoProfilerLabel_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/Tuple.h"
#include "mozilla/Types.h"
@ -42,10 +43,12 @@ MFBT_API void RegisterProfilerLabelEnterExit(ProfilerLabelEnter aEnter,
class MOZ_RAII AutoProfilerLabel {
public:
AutoProfilerLabel(const char* aLabel, const char* aDynamicString);
AutoProfilerLabel(const char* aLabel,
const char* aDynamicString MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
~AutoProfilerLabel();
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
void* mEntryContext;
// Number of RegisterProfilerLabelEnterExit calls, to avoid giving an entry
// context from one generation to the next.

Просмотреть файл

@ -10,6 +10,7 @@
# include "PlatformMutex.h"
# include "mozilla/Atomics.h"
# include "mozilla/GuardObjects.h"
# include "mozilla/MemoryChecking.h"
# include "mozilla/ThreadLocal.h"
# include <signal.h>

Просмотреть файл

@ -37,6 +37,7 @@
// Linux
# include "mozilla/Attributes.h"
# include "mozilla/GuardObjects.h"
# include "mozilla/Types.h"
# include <stdint.h>
# include <setjmp.h>

Просмотреть файл

@ -100,8 +100,9 @@ struct ScopedArrayBufferContentsTraits {
struct MOZ_NON_TEMPORARY_CLASS ScopedArrayBufferContents
: public Scoped<ScopedArrayBufferContentsTraits> {
explicit ScopedArrayBufferContents()
: Scoped<ScopedArrayBufferContentsTraits>() {}
explicit ScopedArrayBufferContents(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: Scoped<ScopedArrayBufferContentsTraits>(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT) {}
ScopedArrayBufferContents& operator=(ArrayBufferContents ptr) {
Scoped<ScopedArrayBufferContentsTraits>::operator=(ptr);

Просмотреть файл

@ -6,6 +6,7 @@
#ifndef Telemetry_h__
#define Telemetry_h__
#include "mozilla/GuardObjects.h"
#include "mozilla/TelemetryEventEnums.h"
#include "mozilla/TelemetryHistogramEnums.h"
#include "mozilla/TelemetryOriginEnums.h"
@ -242,12 +243,17 @@ const char* GetHistogramName(HistogramID id);
class MOZ_RAII RuntimeAutoTimer {
public:
explicit RuntimeAutoTimer(Telemetry::HistogramID aId,
TimeStamp aStart = TimeStamp::Now())
: id(aId), start(aStart) {}
TimeStamp aStart = TimeStamp::Now()
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: id(aId), start(aStart) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit RuntimeAutoTimer(Telemetry::HistogramID aId, const nsCString& aKey,
TimeStamp aStart = TimeStamp::Now())
TimeStamp aStart = TimeStamp::Now()
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: id(aId), key(aKey), start(aStart) {
MOZ_ASSERT(!aKey.IsEmpty(), "The key must not be empty.");
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~RuntimeAutoTimer() {
@ -262,16 +268,23 @@ class MOZ_RAII RuntimeAutoTimer {
Telemetry::HistogramID id;
const nsCString key;
const TimeStamp start;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
template <HistogramID id>
class MOZ_RAII AutoTimer {
public:
explicit AutoTimer(TimeStamp aStart = TimeStamp::Now()) : start(aStart) {}
explicit AutoTimer(TimeStamp aStart = TimeStamp::Now()
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: start(aStart) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoTimer(const nsCString& aKey, TimeStamp aStart = TimeStamp::Now())
explicit AutoTimer(const nsCString& aKey, TimeStamp aStart = TimeStamp::Now()
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: start(aStart), key(aKey) {
MOZ_ASSERT(!aKey.IsEmpty(), "The key must not be empty.");
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoTimer() {
@ -285,12 +298,17 @@ class MOZ_RAII AutoTimer {
private:
const TimeStamp start;
const nsCString key;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII RuntimeAutoCounter {
public:
explicit RuntimeAutoCounter(HistogramID aId, uint32_t counterStart = 0)
: id(aId), counter(counterStart) {}
explicit RuntimeAutoCounter(
HistogramID aId,
uint32_t counterStart = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: id(aId), counter(counterStart) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~RuntimeAutoCounter() { Accumulate(id, counter); }
@ -321,12 +339,17 @@ class MOZ_RAII RuntimeAutoCounter {
private:
HistogramID id;
uint32_t counter;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
template <HistogramID id>
class MOZ_RAII AutoCounter {
public:
explicit AutoCounter(uint32_t counterStart = 0) : counter(counterStart) {}
explicit AutoCounter(
uint32_t counterStart = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: counter(counterStart) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoCounter() { Accumulate(id, counter); }
@ -356,6 +379,7 @@ class MOZ_RAII AutoCounter {
private:
uint32_t counter;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -545,13 +569,18 @@ void ScalarSetMaximum(mozilla::Telemetry::ScalarID aId, const nsAString& aKey,
template <ScalarID id>
class MOZ_RAII AutoScalarTimer {
public:
explicit AutoScalarTimer(TimeStamp aStart = TimeStamp::Now())
: start(aStart) {}
explicit AutoScalarTimer(TimeStamp aStart = TimeStamp::Now()
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: start(aStart) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoScalarTimer(const nsAString& aKey,
TimeStamp aStart = TimeStamp::Now())
TimeStamp aStart = TimeStamp::Now()
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: start(aStart), key(aKey) {
MOZ_ASSERT(!aKey.IsEmpty(), "The key must not be empty.");
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoScalarTimer() {
@ -567,6 +596,7 @@ class MOZ_RAII AutoScalarTimer {
private:
const TimeStamp start;
const nsString key;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**

Просмотреть файл

@ -96,6 +96,7 @@ static inline UniqueProfilerBacktrace profiler_get_backtrace() {
# include "mozilla/Assertions.h"
# include "mozilla/Atomics.h"
# include "mozilla/Attributes.h"
# include "mozilla/GuardObjects.h"
# include "mozilla/Maybe.h"
# include "mozilla/PowerOfTwo.h"
# include "mozilla/Sprintf.h"
@ -994,13 +995,16 @@ class MOZ_RAII AutoProfilerTextMarker {
AutoProfilerTextMarker(const char* aMarkerName, const nsACString& aText,
JS::ProfilingCategoryPair aCategoryPair,
const mozilla::Maybe<uint64_t>& aInnerWindowID,
UniqueProfilerBacktrace&& aCause = nullptr)
UniqueProfilerBacktrace&& aCause =
nullptr MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mMarkerName(aMarkerName),
mText(aText),
mCategoryPair(aCategoryPair),
mStartTime(mozilla::TimeStamp::NowUnfuzzed()),
mCause(std::move(aCause)),
mInnerWindowID(aInnerWindowID) {}
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoProfilerTextMarker() {
profiler_add_text_marker(mMarkerName, mText, mCategoryPair, mStartTime,
@ -1009,6 +1013,7 @@ class MOZ_RAII AutoProfilerTextMarker {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mMarkerName;
nsCString mText;
const JS::ProfilingCategoryPair mCategoryPair;
@ -1076,25 +1081,35 @@ namespace mozilla {
class MOZ_RAII AutoProfilerInit {
public:
explicit AutoProfilerInit() { profiler_init(this); }
explicit AutoProfilerInit(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_init(this);
}
~AutoProfilerInit() { profiler_shutdown(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII AutoProfilerInit2 {
public:
explicit AutoProfilerInit2() { profiler_init_threadmanager(); }
explicit AutoProfilerInit2(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_init_threadmanager();
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// Convenience class to register and unregister a thread with the profiler.
// Needs to be the first object on the stack of the thread.
class MOZ_RAII AutoProfilerRegisterThread final {
public:
explicit AutoProfilerRegisterThread(const char* aName) {
explicit AutoProfilerRegisterThread(
const char* aName MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_register_thread(aName, this);
}
@ -1104,23 +1119,29 @@ class MOZ_RAII AutoProfilerRegisterThread final {
AutoProfilerRegisterThread(const AutoProfilerRegisterThread&) = delete;
AutoProfilerRegisterThread& operator=(const AutoProfilerRegisterThread&) =
delete;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII AutoProfilerThreadSleep {
public:
explicit AutoProfilerThreadSleep() { profiler_thread_sleep(); }
explicit AutoProfilerThreadSleep(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_thread_sleep();
}
~AutoProfilerThreadSleep() { profiler_thread_wake(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
// Temporarily wake up the profiling of a thread while servicing events such as
// Asynchronous Procedure Calls (APCs).
class MOZ_RAII AutoProfilerThreadWake {
public:
explicit AutoProfilerThreadWake()
explicit AutoProfilerThreadWake(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: mIssuedWake(profiler_thread_is_sleeping()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mIssuedWake) {
profiler_thread_wake();
}
@ -1134,6 +1155,7 @@ class MOZ_RAII AutoProfilerThreadWake {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mIssuedWake;
};
@ -1178,7 +1200,9 @@ class MOZ_RAII AutoProfilerLabel {
// This is the AUTO_PROFILER_LABEL and AUTO_PROFILER_LABEL_DYNAMIC variant.
AutoProfilerLabel(const char* aLabel, const char* aDynamicString,
JS::ProfilingCategoryPair aCategoryPair,
uint32_t aFlags = 0) {
uint32_t aFlags = 0 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
// Get the ProfilingStack from TLS.
ProfilingStackOwner* profilingStackOwner = sProfilingStackOwnerTLS.get();
Push(profilingStackOwner ? &profilingStackOwner->ProfilingStack() : nullptr,
@ -1190,7 +1214,9 @@ class MOZ_RAII AutoProfilerLabel {
// inactive.
AutoProfilerLabel(JSContext* aJSContext, const char* aLabel,
const char* aDynamicString,
JS::ProfilingCategoryPair aCategoryPair, uint32_t aFlags) {
JS::ProfilingCategoryPair aCategoryPair,
uint32_t aFlags MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
Push(js::GetContextProfilingStackIfEnabled(aJSContext), aLabel,
aDynamicString, aCategoryPair, aFlags);
}
@ -1216,6 +1242,7 @@ class MOZ_RAII AutoProfilerLabel {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
// We save a ProfilingStack pointer in the ctor so we don't have to redo the
// TLS lookup in the dtor.
@ -1230,11 +1257,13 @@ class MOZ_RAII AutoProfilerTracing {
public:
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
JS::ProfilingCategoryPair aCategoryPair,
const mozilla::Maybe<uint64_t>& aInnerWindowID)
const mozilla::Maybe<uint64_t>& aInnerWindowID
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategoryString(aCategoryString),
mMarkerName(aMarkerName),
mCategoryPair(aCategoryPair),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing_marker(mCategoryString, mMarkerName, aCategoryPair,
TRACING_INTERVAL_START, mInnerWindowID);
}
@ -1242,11 +1271,13 @@ class MOZ_RAII AutoProfilerTracing {
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
JS::ProfilingCategoryPair aCategoryPair,
UniqueProfilerBacktrace aBacktrace,
const mozilla::Maybe<uint64_t>& aInnerWindowID)
const mozilla::Maybe<uint64_t>& aInnerWindowID
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCategoryString(aCategoryString),
mMarkerName(aMarkerName),
mCategoryPair(aCategoryPair),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing_marker(mCategoryString, mMarkerName, aCategoryPair,
TRACING_INTERVAL_START, std::move(aBacktrace),
mInnerWindowID);
@ -1258,6 +1289,7 @@ class MOZ_RAII AutoProfilerTracing {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mCategoryString;
const char* mMarkerName;
const JS::ProfilingCategoryPair mCategoryPair;

Просмотреть файл

@ -10,6 +10,7 @@
#define mozilla_AutoRestore_h_
#include "mozilla/Attributes.h" // MOZ_STACK_CLASS
#include "mozilla/GuardObjects.h"
namespace mozilla {
@ -30,8 +31,12 @@ class MOZ_RAII AutoRestore {
private:
T& mLocation;
T mValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoRestore(T& aValue) : mLocation(aValue), mValue(aValue) {}
explicit AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mLocation(aValue), mValue(aValue) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoRestore() { mLocation = mValue; }
T SavedValue() const { return mValue; }
};

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше