Bug 1223932 - delete guard object uses from the tree; r=jwalden

CLOSED TREE

We don't need these macros anymore, for two reasons:

1. We have static analysis to provide the same sort of checks via `MOZ_RAII`
   and friends.
2. clang now warns for the "temporary that should have been a declaration" case.

The extra requirements on class construction also show up during debug tests
as performance problems.

This change was automated by using the following sed script:

```
# Remove declarations in classes.
/MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER/d
/MOZ_GUARD_OBJECT_NOTIFIER_INIT/d

# Remove individual macros, carefully.
{
  # We don't have to worry about substrings here because the closing
  # parenthesis "anchors" the match.
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)/)/g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)/)/g;

  # Remove the longer identifier first.
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_TO_PARENT//g;
  s/MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM//g;
}

# Remove the actual include.
\@# *include "mozilla/GuardObjects.h"@d
```

and running:

```
find . -name \*.cpp -o -name \*.h | grep -v 'GuardObjects.h' |xargs sed -i -f script 2>/dev/null
mach clang-format
```

Differential Revision: https://phabricator.services.mozilla.com/D85168
This commit is contained in:
Nathan Froyd 2020-07-30 14:22:38 +00:00
Родитель 0c20e550e5
Коммит e3ebda1914
104 изменённых файлов: 270 добавлений и 828 удалений

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

@ -10,7 +10,6 @@
#include <prio.h>
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
namespace mozilla {
namespace devtools {
@ -34,7 +33,6 @@ 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;
@ -45,10 +43,8 @@ class MOZ_RAII AutoMemMap {
void operator=(const AutoMemMap& aOther) = delete;
public:
explicit AutoMemMap(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: fileInfo(), fd(nullptr), fileMap(nullptr), addr(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
};
explicit AutoMemMap()
: fileInfo(), fd(nullptr), fileMap(nullptr), addr(nullptr){};
~AutoMemMap();
// Initialize this AutoMemMap.

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

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

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

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

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

@ -7,7 +7,6 @@
#ifndef mozilla_AutoRestyleTimelineMarker_h_
#define mozilla_AutoRestyleTimelineMarker_h_
#include "mozilla/GuardObjects.h"
#include "mozilla/RefPtr.h"
class nsIDocShell;
@ -15,15 +14,12 @@ 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
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
AutoRestyleTimelineMarker(nsIDocShell* aDocShell, bool aIsAnimationOnly);
~AutoRestyleTimelineMarker();
AutoRestyleTimelineMarker(const AutoRestyleTimelineMarker& aOther) = delete;

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

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

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

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

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

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

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

@ -671,14 +671,11 @@ class Selection final : public nsSupportsWeakReference,
friend struct AutoUserInitiated;
struct MOZ_RAII AutoUserInitiated {
explicit AutoUserInitiated(
Selection* aSelection MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoUserInitiated(Selection* aSelection)
: mSavedValue(aSelection->mUserInitiated) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
aSelection->mUserInitiated = true;
}
AutoRestore<bool> mSavedValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
private:
@ -920,14 +917,11 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoHideSelectionChanges(Selection* aSelection)
: mSelection(aSelection) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mSelection = aSelection;
if (mSelection) {
mSelection->AddSelectionChangeBlocker();

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

@ -25,7 +25,6 @@
#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"
@ -3461,14 +3460,10 @@ nsContentUtils::InternalContentPolicyTypeToExternalOrWorker(
class MOZ_RAII nsAutoScriptBlocker {
public:
explicit nsAutoScriptBlocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
nsContentUtils::AddScriptBlocker();
}
explicit nsAutoScriptBlocker() { nsContentUtils::AddScriptBlocker(); }
~nsAutoScriptBlocker() { nsContentUtils::RemoveScriptBlocker(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_STACK_CLASS nsAutoScriptBlockerSuppressNodeRemoved

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

@ -69,7 +69,6 @@
#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"
@ -1374,19 +1373,17 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
class MOZ_RAII AutoResetInFrameSwap final {
public:
AutoResetInFrameSwap(
nsFrameLoader* aThisFrameLoader, nsFrameLoader* aOtherFrameLoader,
nsDocShell* aThisDocShell, nsDocShell* aOtherDocShell,
EventTarget* aThisEventTarget,
EventTarget* aOtherEventTarget MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
AutoResetInFrameSwap(nsFrameLoader* aThisFrameLoader,
nsFrameLoader* aOtherFrameLoader,
nsDocShell* aThisDocShell, nsDocShell* aOtherDocShell,
EventTarget* aThisEventTarget,
EventTarget* aOtherEventTarget)
: 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);
@ -1433,7 +1430,6 @@ 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,7 +42,6 @@
#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,10 +7466,8 @@ AbstractThread* nsGlobalWindowOuter::AbstractMainThreadFor(
}
nsGlobalWindowOuter::TemporarilyDisableDialogs::TemporarilyDisableDialogs(
nsGlobalWindowOuter* aWindow MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
nsGlobalWindowOuter* aWindow)
: mSavedDialogsEnabled(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(aWindow);
nsGlobalWindowOuter* topWindowOuter =
aWindow->GetInProcessScriptableTopInternal();

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

@ -41,7 +41,6 @@
#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"
@ -394,12 +393,10 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
class MOZ_RAII TemporarilyDisableDialogs {
public:
explicit TemporarilyDisableDialogs(
nsGlobalWindowOuter* aWindow MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit TemporarilyDisableDialogs(nsGlobalWindowOuter* aWindow);
~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,7 +19,6 @@
#include "nsWrapperCache.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/LinkedList.h"
#include "mozilla/RangeBoundary.h"
@ -399,14 +398,10 @@ class nsRange final : public mozilla::dom::AbstractRange,
private:
nsRange& mRange;
bool mOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoCalledByJSRestore(
nsRange& aRange MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mRange(aRange), mOldValue(aRange.mCalledByJS) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoCalledByJSRestore(nsRange& aRange)
: mRange(aRange), mOldValue(aRange.mCalledByJS) {}
~AutoCalledByJSRestore() { mRange.mCalledByJS = mOldValue; }
bool SavedValue() const { return mOldValue; }
};

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

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

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

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

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

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

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

@ -152,17 +152,13 @@ static int64_t gCanvasAzureMemoryUsed = 0;
// Adds Save() / Restore() calls to the scope.
class MOZ_RAII AutoSaveRestore {
public:
explicit AutoSaveRestore(
CanvasRenderingContext2D* aCtx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mCtx(aCtx) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
explicit AutoSaveRestore(CanvasRenderingContext2D* aCtx) : mCtx(aCtx) {
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,12 +200,10 @@ class RestoreSelectionState : public Runnable {
class MOZ_RAII AutoRestoreEditorState final {
public:
explicit AutoRestoreEditorState(
TextEditor* aTextEditor MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoRestoreEditorState(TextEditor* aTextEditor)
: 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
@ -230,7 +228,6 @@ class MOZ_RAII AutoRestoreEditorState final {
TextEditor* mTextEditor;
uint32_t mSavedFlags;
int32_t mSavedMaxLength;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*****************************************************************************
@ -239,10 +236,8 @@ class MOZ_RAII AutoRestoreEditorState final {
class MOZ_RAII AutoDisableUndo final {
public:
explicit AutoDisableUndo(
TextEditor* aTextEditor MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoDisableUndo(TextEditor* aTextEditor)
: mTextEditor(aTextEditor), mNumberOfMaximumTransactions(0) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTextEditor);
mNumberOfMaximumTransactions =
@ -276,7 +271,6 @@ class MOZ_RAII AutoDisableUndo final {
private:
TextEditor* mTextEditor;
int32_t mNumberOfMaximumTransactions;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
static bool SuppressEventHandlers(nsPresContext* aPresContext) {

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

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

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

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

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

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

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

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

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

@ -66,11 +66,9 @@ NS_INTERFACE_MAP_END
// DidChangeLengthList.
class MOZ_RAII AutoChangeLengthNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeLengthNotifier(
DOMSVGLength* aLength MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeLengthNotifier(DOMSVGLength* aLength)
: 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");
@ -91,7 +89,6 @@ 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,11 +88,9 @@ JSObject* DOMSVGLengthList::WrapObject(JSContext* cx,
// DidChangeLengthList.
class MOZ_RAII AutoChangeLengthListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeLengthListNotifier(
DOMSVGLengthList* aLengthList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeLengthListNotifier(DOMSVGLengthList* aLengthList)
: 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);
@ -109,7 +107,6 @@ 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,11 +57,9 @@ NS_INTERFACE_MAP_END
// DidChangeNumberList.
class MOZ_RAII AutoChangeNumberNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeNumberNotifier(
DOMSVGNumber* aNumber MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeNumberNotifier(DOMSVGNumber* aNumber)
: 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");
@ -82,7 +80,6 @@ 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,11 +81,9 @@ JSObject* DOMSVGNumberList::WrapObject(JSContext* cx,
// DidChangeNumberList.
class MOZ_RAII AutoChangeNumberListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeNumberListNotifier(
DOMSVGNumberList* aNumberList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeNumberListNotifier(DOMSVGNumberList* aNumberList)
: 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);
@ -102,7 +100,6 @@ 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,11 +50,9 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGPathSeg, Release)
// and DidChangePathSegList.
class MOZ_RAII AutoChangePathSegNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePathSegNotifier(
DOMSVGPathSeg* aPathSeg MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangePathSegNotifier(DOMSVGPathSeg* aPathSeg)
: 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");
@ -73,7 +71,6 @@ 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,11 +57,9 @@ NS_INTERFACE_MAP_END
// DidChangePathSegList.
class MOZ_RAII AutoChangePathSegListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePathSegListNotifier(
DOMSVGPathSegList* aPathSegList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangePathSegListNotifier(DOMSVGPathSegList* aPathSegList)
: mozAutoDocUpdate(aPathSegList->Element()->GetComposedDoc(), true),
mPathSegList(aPathSegList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mPathSegList, "Expecting non-null pathSegList");
mEmptyOrOldValue = mPathSegList->Element()->WillChangePathSegList(*this);
}
@ -76,7 +74,6 @@ class MOZ_RAII AutoChangePathSegListNotifier : public mozAutoDocUpdate {
private:
DOMSVGPathSegList* const mPathSegList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

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

@ -28,11 +28,9 @@ namespace dom {
// DidChangePointList.
class MOZ_RAII AutoChangePointNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangePointNotifier(
DOMSVGPoint* aPoint MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangePointNotifier(DOMSVGPoint* aPoint)
: 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");
@ -51,7 +49,6 @@ class MOZ_RAII AutoChangePointNotifier : public mozAutoDocUpdate {
private:
DOMSVGPoint* const mPoint;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
float DOMSVGPoint::X() {

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

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

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

@ -56,11 +56,9 @@ NS_INTERFACE_MAP_END
// DidChangeStringListList.
class MOZ_RAII AutoChangeStringListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeStringListNotifier(
DOMSVGStringList* aStringList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeStringListNotifier(DOMSVGStringList* aStringList)
: 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,
@ -76,7 +74,6 @@ class MOZ_RAII AutoChangeStringListNotifier : public mozAutoDocUpdate {
private:
DOMSVGStringList* const mStringList;
nsAttrValue mEmptyOrOldValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

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

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

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

@ -81,11 +81,9 @@ JSObject* DOMSVGTransformList::WrapObject(JSContext* cx,
// DidChangeTransformList.
class MOZ_RAII AutoChangeTransformListNotifier : public mozAutoDocUpdate {
public:
explicit AutoChangeTransformListNotifier(
DOMSVGTransformList* aTransformList MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeTransformListNotifier(DOMSVGTransformList* aTransformList)
: mozAutoDocUpdate(aTransformList->Element()->GetComposedDoc(), true),
mTransformList(aTransformList) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_ASSERT(mTransformList, "Expecting non-null transformList");
mEmptyOrOldValue =
mTransformList->Element()->WillChangeTransformList(*this);
@ -101,7 +99,6 @@ 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,11 +49,10 @@ static SVGAttrTearoffTable<SVGAnimatedOrient, DOMSVGAngle>
// DidChangeOrient with mozAutoDocUpdate.
class MOZ_RAII AutoChangeOrientNotifier {
public:
explicit AutoChangeOrientNotifier(
SVGAnimatedOrient* aOrient, SVGElement* aSVGElement,
bool aDoSetAttr = true MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoChangeOrientNotifier(SVGAnimatedOrient* aOrient,
SVGElement* aSVGElement,
bool aDoSetAttr = true)
: 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);
@ -78,7 +77,6 @@ class MOZ_RAII AutoChangeOrientNotifier {
SVGElement* const mSVGElement;
nsAttrValue mEmptyOrOldValue;
bool mDoSetAttr;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
static bool IsValidAngleUnitType(uint16_t unit) {

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

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

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

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

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

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

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

@ -2292,10 +2292,8 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoTransactionBatch final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoTransactionBatch(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
MOZ_CAN_RUN_SCRIPT explicit AutoTransactionBatch(EditorBase& aEditorBase)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_KnownLive(mEditorBase).BeginTransactionInternal();
}
@ -2305,7 +2303,6 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2316,18 +2313,14 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoPlaceholderBatch final {
public:
explicit AutoPlaceholderBatch(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoPlaceholderBatch(EditorBase& aEditorBase)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase->BeginPlaceholderTransaction(*nsGkAtoms::_empty);
}
AutoPlaceholderBatch(EditorBase& aEditorBase,
nsStaticAtom& aTransactionName
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
nsStaticAtom& aTransactionName)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase->BeginPlaceholderTransaction(aTransactionName);
}
@ -2335,7 +2328,6 @@ class EditorBase : public nsIEditor,
protected:
OwningNonNull<EditorBase> mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2348,8 +2340,7 @@ class EditorBase : public nsIEditor,
* Constructor responsible for remembering all state needed to restore
* aSelection.
*/
explicit AutoSelectionRestorer(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit AutoSelectionRestorer(EditorBase& aEditorBase);
/**
* Destructor restores mSelection to its former state
@ -2363,7 +2354,6 @@ class EditorBase : public nsIEditor,
protected:
EditorBase* mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2374,10 +2364,8 @@ class EditorBase : public nsIEditor,
public:
MOZ_CAN_RUN_SCRIPT AutoEditSubActionNotifier(
EditorBase& aEditorBase, EditSubAction aEditSubAction,
nsIEditor::EDirection aDirection,
ErrorResult& aRv MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
nsIEditor::EDirection aDirection, ErrorResult& aRv)
: 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
@ -2402,7 +2390,6 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
bool mIsTopLevel;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**
@ -2411,12 +2398,10 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoTransactionsConserveSelection final {
public:
explicit AutoTransactionsConserveSelection(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoTransactionsConserveSelection(EditorBase& aEditorBase)
: mEditorBase(aEditorBase),
mAllowedTransactionsToChangeSelection(
aEditorBase.AllowsTransactionsToChangeSelection()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase.MakeThisAllowTransactionsToChangeSelection(false);
}
@ -2428,7 +2413,6 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
bool mAllowedTransactionsToChangeSelection;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/***************************************************************************
@ -2436,10 +2420,8 @@ class EditorBase : public nsIEditor,
*/
class MOZ_RAII AutoUpdateViewBatch final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoUpdateViewBatch(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
MOZ_CAN_RUN_SCRIPT explicit AutoUpdateViewBatch(EditorBase& aEditorBase)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mEditorBase.BeginUpdateViewBatch();
}
@ -2449,7 +2431,6 @@ class EditorBase : public nsIEditor,
protected:
EditorBase& mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
protected:

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

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

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

@ -10,7 +10,6 @@
#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"
@ -700,9 +699,8 @@ class MOZ_STACK_CLASS SplitRangeOffResult final {
class MOZ_RAII AutoTransactionBatchExternal final {
public:
MOZ_CAN_RUN_SCRIPT explicit AutoTransactionBatchExternal(
EditorBase& aEditorBase MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
EditorBase& aEditorBase)
: mEditorBase(aEditorBase) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
MOZ_KnownLive(mEditorBase).BeginTransaction();
}
@ -712,7 +710,6 @@ class MOZ_RAII AutoTransactionBatchExternal final {
private:
EditorBase& mEditorBase;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_STACK_CLASS AutoRangeArray final {
@ -736,8 +733,8 @@ class MOZ_STACK_CLASS AutoRangeArray final {
class MOZ_RAII DOMIterator {
public:
explicit DOMIterator(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
explicit DOMIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit DOMIterator();
explicit DOMIterator(nsINode& aNode);
virtual ~DOMIterator() = default;
nsresult Init(nsRange& aRange);
@ -766,20 +763,18 @@ 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(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM);
explicit DOMSubtreeIterator();
virtual ~DOMSubtreeIterator() = default;
nsresult Init(nsRange& aRange);
private:
ContentSubtreeIterator mSubtreeIter;
explicit DOMSubtreeIterator(nsINode& aNode MOZ_GUARD_OBJECT_NOTIFIER_PARAM) =
delete;
explicit DOMSubtreeIterator(nsINode& aNode) = delete;
};
/**

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

@ -101,14 +101,11 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
explicit AutoSetTemporaryAncestorLimiter(HTMLEditor& aHTMLEditor,
Selection& aSelection,
nsINode& aStartPointNode) {
MOZ_ASSERT(aSelection.GetType() == SelectionType::eNormal);
if (aSelection.GetAncestorLimiter()) {

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

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

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

@ -784,14 +784,10 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
TextureClientAutoLock(TextureClient* aTexture, OpenMode aMode)
: mTexture(aTexture), mSucceeded(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mSucceeded = mTexture->Lock(aMode);
#ifdef DEBUG
mChecked = false;

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

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

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

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

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

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

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

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

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

@ -10,7 +10,6 @@
#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,7 +11,6 @@
#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,11 +5802,8 @@ MOZ_MUST_USE bool js::TrySkipAwait(JSContext* cx, HandleValue val,
return true;
}
JS::AutoDebuggerJobQueueInterruption::AutoDebuggerJobQueueInterruption(
MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL)
: cx(nullptr) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
JS::AutoDebuggerJobQueueInterruption::AutoDebuggerJobQueueInterruption()
: cx(nullptr) {}
JS::AutoDebuggerJobQueueInterruption::~AutoDebuggerJobQueueInterruption() {
MOZ_ASSERT_IF(initialized(), cx->jobQueue->empty());

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

@ -9,7 +9,6 @@
#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
@ -2943,11 +2942,7 @@ class MOZ_RAII ExecutionObservableRealms
HashSet<Zone*> zones_;
public:
explicit ExecutionObservableRealms(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: realms_(cx), zones_(cx) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit ExecutionObservableRealms(JSContext* cx) : realms_(cx), zones_(cx) {}
bool add(Realm* realm) {
return realms_.put(realm) && zones_.put(realm->zone());
@ -2967,7 +2962,6 @@ 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
@ -2979,11 +2973,7 @@ class MOZ_RAII ExecutionObservableFrame
AbstractFramePtr frame_;
public:
explicit ExecutionObservableFrame(
AbstractFramePtr frame MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: frame_(frame) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit ExecutionObservableFrame(AbstractFramePtr frame) : frame_(frame) {}
Zone* singleZone() const override {
// We never inline across realms, let alone across zones, so
@ -3036,7 +3026,6 @@ class MOZ_RAII ExecutionObservableFrame
iter.abstractFramePtr() == frame_;
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII ExecutionObservableScript
@ -3044,11 +3033,8 @@ class MOZ_RAII ExecutionObservableScript
RootedScript script_;
public:
ExecutionObservableScript(JSContext* cx,
JSScript* script MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: script_(cx, script) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
ExecutionObservableScript(JSContext* cx, JSScript* script)
: script_(cx, script) {}
Zone* singleZone() const override { return script_->zone(); }
JSScript* singleScriptForZoneInvalidation() const override { return script_; }
@ -3072,7 +3058,6 @@ class MOZ_RAII ExecutionObservableScript
iter.abstractFramePtr().script() == script_;
}
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/* static */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -2189,12 +2189,10 @@ 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
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
CTypesActivityType endType);
~AutoCTypesActivityCallback() { DoEndCallback(); }
void DoEndCallback() {
if (callback) {

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

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

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

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

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

@ -719,23 +719,20 @@ class MOZ_RAII EnvironmentIter {
public:
// Constructing from a copy of an existing EnvironmentIter.
EnvironmentIter(JSContext* cx,
const EnvironmentIter& ei MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
EnvironmentIter(JSContext* cx, const EnvironmentIter& ei);
// 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
EnvironmentIter(JSContext* cx, JSObject* env, Scope* scope);
// Constructing from a frame. Places the EnvironmentIter on the innermost
// environment at pc.
EnvironmentIter(JSContext* cx, AbstractFramePtr frame,
jsbytecode* pc MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
EnvironmentIter(JSContext* cx, AbstractFramePtr frame, jsbytecode* pc);
// 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
AbstractFramePtr frame);
bool done() const { return si_.done(); }
@ -791,7 +788,6 @@ 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,22 +35,19 @@ inline void GeckoProfilerThread::updatePC(JSContext* cx, JSScript* script,
*/
class MOZ_RAII AutoSuppressProfilerSampling {
public:
explicit AutoSuppressProfilerSampling(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit AutoSuppressProfilerSampling(JSContext* cx);
~AutoSuppressProfilerSampling();
private:
JSContext* cx_;
bool previouslyEnabled_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
MOZ_ALWAYS_INLINE
GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(
JSContext* cx, JSScript* script MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
GeckoProfilerEntryMarker::GeckoProfilerEntryMarker(JSContext* cx,
JSScript* script)
: profiler_(&cx->geckoProfiler()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (MOZ_LIKELY(!profiler_->infraInstalled())) {
profiler_ = nullptr;
#ifdef DEBUG
@ -86,9 +83,8 @@ GeckoProfilerEntryMarker::~GeckoProfilerEntryMarker() {
MOZ_ALWAYS_INLINE
AutoGeckoProfilerEntry::AutoGeckoProfilerEntry(
JSContext* cx, const char* label, JS::ProfilingCategoryPair categoryPair,
uint32_t flags MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
uint32_t flags)
: profiler_(&cx->geckoProfiler()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (MOZ_LIKELY(!profiler_->infraInstalled())) {
profiler_ = nullptr;
#ifdef DEBUG

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

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

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

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

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

@ -14,7 +14,6 @@
#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
@ -671,26 +670,18 @@ void RunPendingSourceCompressions(JSRuntime* runtime);
class MOZ_RAII AutoLockHelperThreadState : public LockGuard<Mutex> {
using Base = LockGuard<Mutex>;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoLockHelperThreadState(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: Base(HelperThreadState().helperLock) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoLockHelperThreadState() : Base(HelperThreadState().helperLock) {}
};
class MOZ_RAII AutoUnlockHelperThreadState : public UnlockGuard<Mutex> {
using Base = UnlockGuard<Mutex>;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoUnlockHelperThreadState(
AutoLockHelperThreadState& locked MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: Base(locked) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoUnlockHelperThreadState(AutoLockHelperThreadState& locked)
: Base(locked) {}
};
struct MOZ_RAII AutoSetHelperThreadContext {

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

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

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

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

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

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

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

@ -192,7 +192,6 @@ using NewObjectMetadataState =
mozilla::Variant<ImmediateMetadata, DelayMetadata, PendingMetadata>;
class MOZ_RAII AutoSetNewObjectMetadata {
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
JSContext* cx_;
Rooted<NewObjectMetadataState> prevState_;
@ -201,8 +200,7 @@ class MOZ_RAII AutoSetNewObjectMetadata {
void operator=(const AutoSetNewObjectMetadata& aOther) = delete;
public:
explicit AutoSetNewObjectMetadata(
JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit AutoSetNewObjectMetadata(JSContext* cx);
~AutoSetNewObjectMetadata();
};
@ -853,17 +851,14 @@ namespace js {
class MOZ_RAII AssertRealmUnchanged {
public:
explicit AssertRealmUnchanged(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: cx(cx), oldRealm(cx->realm()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AssertRealmUnchanged(JSContext* cx)
: cx(cx), oldRealm(cx->realm()) {}
~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,13 +207,9 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: stacks(stacks) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
explicit AutoReentrancyGuard(SavedStacks& stacks) : stacks(stacks) {
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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) {
inline AutoRooterGetterSetter::AutoRooterGetterSetter(JSContext* cx,
uint8_t attrs,
GetterOp* pgetter,
SetterOp* psetter) {
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,7 +8,6 @@
#define vm_Shape_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Maybe.h"
@ -1498,12 +1497,10 @@ class MOZ_RAII AutoRooterGetterSetter {
public:
inline AutoRooterGetterSetter(JSContext* cx, uint8_t attrs, GetterOp* pgetter,
SetterOp* psetter
MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
SetterOp* psetter);
private:
mozilla::Maybe<Rooted<Inner>> inner;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
struct EmptyShape : public js::Shape {

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

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

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

@ -93,12 +93,10 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit AutoLockWatchdog(Watchdog* aWatchdog);
~AutoLockWatchdog();
};
@ -450,10 +448,7 @@ class WatchdogManager {
PRTime mTimestamps[kWatchdogTimestampCategoryCount - 1];
};
AutoLockWatchdog::AutoLockWatchdog(
Watchdog* aWatchdog MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
: mWatchdog(aWatchdog) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
AutoLockWatchdog::AutoLockWatchdog(Watchdog* aWatchdog) : mWatchdog(aWatchdog) {
if (mWatchdog) {
PR_Lock(mWatchdog->GetLock());
}

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

@ -77,7 +77,6 @@
#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"
@ -1952,10 +1951,8 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mJSContext(cx), mEvaluated(false) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoScriptEvaluate(JSContext* cx)
: mJSContext(cx), mEvaluated(false) {}
/**
* Does the pre script evaluation.
@ -1975,7 +1972,6 @@ 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;
@ -1985,8 +1981,7 @@ class MOZ_RAII AutoScriptEvaluate {
/***************************************************************************/
class MOZ_RAII AutoResolveName {
public:
AutoResolveName(XPCCallContext& ccx,
JS::HandleId name MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
AutoResolveName(XPCCallContext& ccx, JS::HandleId name)
: mContext(ccx.GetContext()),
mOld(ccx, mContext->SetResolveName(name))
#ifdef DEBUG
@ -1994,7 +1989,6 @@ class MOZ_RAII AutoResolveName {
mCheck(ccx, name)
#endif
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoResolveName() {
@ -2008,7 +2002,6 @@ class MOZ_RAII AutoResolveName {
#ifdef DEBUG
JS::RootedId mCheck;
#endif
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/***************************************************************************/

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

@ -4597,11 +4597,8 @@ void nsFlexContainerFrame::Reflow(nsPresContext* aPresContext,
// instead of using this class.)
class MOZ_RAII AutoFlexItemMainSizeOverride final {
public:
explicit AutoFlexItemMainSizeOverride(
FlexItem& aItem MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoFlexItemMainSizeOverride(FlexItem& aItem)
: 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)");
@ -4627,7 +4624,6 @@ class MOZ_RAII AutoFlexItemMainSizeOverride final {
private:
nsIFrame* mItemFrame;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
void nsFlexContainerFrame::CalculatePackingSpace(

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

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

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

@ -77,14 +77,12 @@ class MOZ_RAII AutoReferenceChainGuard {
*/
AutoReferenceChainGuard(nsIFrame* aFrame, bool* aFrameInUse,
int16_t* aChainCounter,
int16_t aMaxChainLength = sDefaultMaxChainLength
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
int16_t aMaxChainLength = sDefaultMaxChainLength)
: 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 ||
@ -164,7 +162,6 @@ class MOZ_RAII AutoReferenceChainGuard {
int16_t* mChainCounter;
const int16_t mMaxChainLength;
bool mBrokeReference;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace mozilla

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

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

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

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

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

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

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

@ -79,12 +79,10 @@ namespace mozilla {
// we only take the address of this:
static gfx::UserDataKey sSVGAutoRenderStateKey;
SVGAutoRenderState::SVGAutoRenderState(
DrawTarget* aDrawTarget MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
SVGAutoRenderState::SVGAutoRenderState(DrawTarget* aDrawTarget)
: 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,8 +131,7 @@ class MOZ_RAII SVGAutoRenderState final {
using DrawTarget = gfx::DrawTarget;
public:
explicit SVGAutoRenderState(
DrawTarget* aDrawTarget MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
explicit SVGAutoRenderState(DrawTarget* aDrawTarget);
~SVGAutoRenderState();
void SetPaintingToWindow(bool aPaintingToWindow);
@ -143,7 +142,6 @@ class MOZ_RAII SVGAutoRenderState final {
DrawTarget* mDrawTarget;
void* mOriginalRenderState;
bool mPaintingToWindow;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/**

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

@ -15,7 +15,6 @@
# 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
@ -113,16 +112,11 @@ typedef Mutex StaticMutex;
template <typename T>
struct MOZ_RAII AutoLock {
explicit AutoLock(T& aMutex MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mMutex(aMutex) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mMutex.Lock();
}
explicit AutoLock(T& aMutex) : mMutex(aMutex) { mMutex.Lock(); }
~AutoLock() { mMutex.Unlock(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER;
T& mMutex;
};

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

@ -11,13 +11,11 @@
#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
@ -25,13 +23,12 @@ class MOZ_RAII ReentrancyGuard {
public:
template <class T>
#ifdef DEBUG
explicit ReentrancyGuard(T& aObj MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit ReentrancyGuard(T& aObj)
: mEntered(aObj.mEntered)
#else
explicit ReentrancyGuard(T& MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit ReentrancyGuard(T&)
#endif
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
#ifdef DEBUG
MOZ_ASSERT(!mEntered);
mEntered = true;

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

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

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

@ -46,7 +46,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
namespace mozilla {
@ -70,20 +69,12 @@ class MOZ_NON_TEMPORARY_CLASS Scoped {
public:
typedef typename Traits::type Resource;
explicit Scoped(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: mValue(Traits::empty()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit Scoped() : mValue(Traits::empty()) {}
explicit Scoped(const Resource& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mValue(aValue) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit Scoped(const Resource& aValue) : mValue(aValue) {}
/* Move constructor. */
Scoped(Scoped&& aOther MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mValue(std::move(aOther.mValue)) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
Scoped(Scoped&& aOther) : mValue(std::move(aOther.mValue)) {
aOther.mValue = Traits::empty();
}
@ -153,7 +144,6 @@ class MOZ_NON_TEMPORARY_CLASS Scoped {
private:
Resource mValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
/*
@ -164,28 +154,25 @@ 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(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; \
#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; \
};
/*

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

@ -67,7 +67,6 @@
# 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"
@ -629,16 +628,12 @@ class StaticBaseProfilerStats {
// `StaticBaseProfilerStats`.
class MOZ_RAII AutoProfilerStats {
public:
explicit AutoProfilerStats(
StaticBaseProfilerStats& aStats MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mStats(aStats), mStart(TimeStamp::NowUnfuzzed()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
explicit AutoProfilerStats(StaticBaseProfilerStats& aStats)
: mStats(aStats), mStart(TimeStamp::NowUnfuzzed()) {}
~AutoProfilerStats() { mStats.AddDurationFrom(mStart); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
StaticBaseProfilerStats& mStats;
TimeStamp mStart;
@ -858,16 +853,13 @@ class MOZ_RAII AutoProfilerTextMarker {
AutoProfilerTextMarker(const char* aMarkerName, const std::string& aText,
ProfilingCategoryPair aCategoryPair,
const Maybe<uint64_t>& aInnerWindowID,
UniqueProfilerBacktrace&& aCause =
nullptr MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
UniqueProfilerBacktrace&& aCause = nullptr)
: mMarkerName(aMarkerName),
mText(aText),
mCategoryPair(aCategoryPair),
mStartTime(TimeStamp::NowUnfuzzed()),
mCause(std::move(aCause)),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
mInnerWindowID(aInnerWindowID) {}
~AutoProfilerTextMarker() {
profiler_add_text_marker(mMarkerName, mText, mCategoryPair, mStartTime,
@ -876,7 +868,6 @@ class MOZ_RAII AutoProfilerTextMarker {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mMarkerName;
std::string mText;
const ProfilingCategoryPair mCategoryPair;
@ -924,24 +915,18 @@ MFBT_API void profiler_save_profile_to_file(const char* aFilename);
class MOZ_RAII AutoProfilerInit {
public:
explicit AutoProfilerInit(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_init(this);
}
explicit AutoProfilerInit() { 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
explicit AutoProfilerRegisterThread(const char* aName) {
profiler_register_thread(aName, this);
}
@ -951,29 +936,23 @@ 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(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_thread_sleep();
}
explicit AutoProfilerThreadSleep() { 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(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
explicit AutoProfilerThreadWake()
: mIssuedWake(profiler_thread_is_sleeping()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mIssuedWake) {
profiler_thread_wake();
}
@ -987,7 +966,6 @@ class MOZ_RAII AutoProfilerThreadWake {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mIssuedWake;
};
@ -1000,10 +978,7 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
ProfilingCategoryPair aCategoryPair, uint32_t aFlags = 0) {
// Get the ProfilingStack from TLS.
Push(GetProfilingStack(), aLabel, aDynamicString, aCategoryPair, aFlags);
}
@ -1031,7 +1006,6 @@ 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.
@ -1046,26 +1020,23 @@ class MOZ_RAII AutoProfilerTracing {
public:
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
ProfilingCategoryPair aCategoryPair,
const Maybe<uint64_t>& aInnerWindowID
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
const Maybe<uint64_t>& aInnerWindowID)
: 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
ProfilingCategoryPair aCategoryPair,
UniqueProfilerBacktrace aBacktrace,
const Maybe<uint64_t>& aInnerWindowID)
: 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);
@ -1077,7 +1048,6 @@ class MOZ_RAII AutoProfilerTracing {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mCategoryString;
const char* mMarkerName;
const ProfilingCategoryPair mCategoryPair;

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

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

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

@ -8,7 +8,6 @@
#define mozilla_AutoProfilerLabel_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/Tuple.h"
#include "mozilla/Types.h"
@ -43,12 +42,10 @@ MFBT_API void RegisterProfilerLabelEnterExit(ProfilerLabelEnter aEnter,
class MOZ_RAII AutoProfilerLabel {
public:
AutoProfilerLabel(const char* aLabel,
const char* aDynamicString MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
AutoProfilerLabel(const char* aLabel, const char* aDynamicString);
~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,7 +10,6 @@
# include "PlatformMutex.h"
# include "mozilla/Atomics.h"
# include "mozilla/GuardObjects.h"
# include "mozilla/MemoryChecking.h"
# include "mozilla/ThreadLocal.h"
# include <signal.h>

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

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

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

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

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

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

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

@ -96,7 +96,6 @@ 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"
@ -995,16 +994,13 @@ class MOZ_RAII AutoProfilerTextMarker {
AutoProfilerTextMarker(const char* aMarkerName, const nsACString& aText,
JS::ProfilingCategoryPair aCategoryPair,
const mozilla::Maybe<uint64_t>& aInnerWindowID,
UniqueProfilerBacktrace&& aCause =
nullptr MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
UniqueProfilerBacktrace&& aCause = nullptr)
: mMarkerName(aMarkerName),
mText(aText),
mCategoryPair(aCategoryPair),
mStartTime(mozilla::TimeStamp::NowUnfuzzed()),
mCause(std::move(aCause)),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
mInnerWindowID(aInnerWindowID) {}
~AutoProfilerTextMarker() {
profiler_add_text_marker(mMarkerName, mText, mCategoryPair, mStartTime,
@ -1013,7 +1009,6 @@ class MOZ_RAII AutoProfilerTextMarker {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mMarkerName;
nsCString mText;
const JS::ProfilingCategoryPair mCategoryPair;
@ -1081,35 +1076,25 @@ namespace mozilla {
class MOZ_RAII AutoProfilerInit {
public:
explicit AutoProfilerInit(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_init(this);
}
explicit AutoProfilerInit() { profiler_init(this); }
~AutoProfilerInit() { profiler_shutdown(); }
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
class MOZ_RAII AutoProfilerInit2 {
public:
explicit AutoProfilerInit2(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_init_threadmanager();
}
explicit AutoProfilerInit2() { 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
explicit AutoProfilerRegisterThread(const char* aName) {
profiler_register_thread(aName, this);
}
@ -1119,29 +1104,23 @@ 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(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_thread_sleep();
}
explicit AutoProfilerThreadSleep() { 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(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
explicit AutoProfilerThreadWake()
: mIssuedWake(profiler_thread_is_sleeping()) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
if (mIssuedWake) {
profiler_thread_wake();
}
@ -1155,7 +1134,6 @@ class MOZ_RAII AutoProfilerThreadWake {
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
bool mIssuedWake;
};
@ -1200,9 +1178,7 @@ 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 MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
uint32_t aFlags = 0) {
// Get the ProfilingStack from TLS.
ProfilingStackOwner* profilingStackOwner = sProfilingStackOwnerTLS.get();
Push(profilingStackOwner ? &profilingStackOwner->ProfilingStack() : nullptr,
@ -1214,9 +1190,7 @@ class MOZ_RAII AutoProfilerLabel {
// inactive.
AutoProfilerLabel(JSContext* aJSContext, const char* aLabel,
const char* aDynamicString,
JS::ProfilingCategoryPair aCategoryPair,
uint32_t aFlags MOZ_GUARD_OBJECT_NOTIFIER_PARAM) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
JS::ProfilingCategoryPair aCategoryPair, uint32_t aFlags) {
Push(js::GetContextProfilingStackIfEnabled(aJSContext), aLabel,
aDynamicString, aCategoryPair, aFlags);
}
@ -1242,7 +1216,6 @@ 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.
@ -1257,13 +1230,11 @@ class MOZ_RAII AutoProfilerTracing {
public:
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
JS::ProfilingCategoryPair aCategoryPair,
const mozilla::Maybe<uint64_t>& aInnerWindowID
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
const mozilla::Maybe<uint64_t>& aInnerWindowID)
: mCategoryString(aCategoryString),
mMarkerName(aMarkerName),
mCategoryPair(aCategoryPair),
mInnerWindowID(aInnerWindowID) {
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
profiler_tracing_marker(mCategoryString, mMarkerName, aCategoryPair,
TRACING_INTERVAL_START, mInnerWindowID);
}
@ -1271,13 +1242,11 @@ class MOZ_RAII AutoProfilerTracing {
AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName,
JS::ProfilingCategoryPair aCategoryPair,
UniqueProfilerBacktrace aBacktrace,
const mozilla::Maybe<uint64_t>& aInnerWindowID
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
const mozilla::Maybe<uint64_t>& aInnerWindowID)
: 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);
@ -1289,7 +1258,6 @@ class MOZ_RAII AutoProfilerTracing {
}
protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
const char* mCategoryString;
const char* mMarkerName;
const JS::ProfilingCategoryPair mCategoryPair;

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

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

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