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
parent 60787e0f88
commit 1a5e36fc8f
104 changed files with 270 additions and 828 deletions

View File

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