Bug 1298676 - part 2 - add an AutoIOInterposerDisable RAII class; r=aklotz

This will ensure the I/O Interposer is re-enabled after temporarily
disabling it.
This commit is contained in:
Nathan Froyd 2017-01-10 16:31:25 -05:00
Родитель 9d007ffa3e
Коммит 0ac6ef352e
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -8,6 +8,7 @@
#define mozilla_IOInterposer_h
#include "mozilla/Attributes.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/TimeStamp.h"
namespace mozilla {
@ -272,6 +273,23 @@ public:
}
};
class MOZ_RAII AutoIOInterposerDisable final
{
public:
explicit AutoIOInterposerDisable(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
IOInterposer::Disable();
}
~AutoIOInterposerDisable()
{
IOInterposer::Enable();
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
} // namespace mozilla
#endif // mozilla_IOInterposer_h