Bug 1883706: part 3) Implement `createHTML`, `createScript` and `createScriptURL...
[gecko.git] / ipc / glue / Neutering.h
blob44cbe042aebeb22e3c099780de0ba83f6c4c10d0
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ipc_Neutering_h
8 #define mozilla_ipc_Neutering_h
10 /**
11 * This header declares RAII wrappers for Window neutering. See
12 * WindowsMessageLoop.cpp for more details.
15 namespace mozilla {
16 namespace ipc {
18 /**
19 * This class is a RAII wrapper around Window neutering. As long as a
20 * NeuteredWindowRegion object is instantiated, Win32 windows belonging to the
21 * current thread will be neutered. It is safe to nest multiple instances of
22 * this class.
24 class MOZ_RAII NeuteredWindowRegion {
25 public:
26 explicit NeuteredWindowRegion(bool aDoNeuter);
27 ~NeuteredWindowRegion();
29 /**
30 * This function clears any backlog of nonqueued messages that are pending for
31 * the current thread.
33 void PumpOnce();
35 private:
36 bool mNeuteredByThis;
39 /**
40 * This class is analagous to MutexAutoUnlock for Mutex; it is an RAII class
41 * that is to be instantiated within a NeuteredWindowRegion, thus temporarily
42 * disabling neutering for the remainder of its enclosing block.
43 * @see NeuteredWindowRegion
45 class MOZ_RAII DeneuteredWindowRegion {
46 public:
47 explicit DeneuteredWindowRegion();
48 ~DeneuteredWindowRegion();
50 private:
51 bool mReneuter;
54 class MOZ_RAII SuppressedNeuteringRegion {
55 public:
56 explicit SuppressedNeuteringRegion();
57 ~SuppressedNeuteringRegion();
59 static inline bool IsNeuteringSuppressed() { return sSuppressNeutering; }
61 private:
62 bool mReenable;
64 static bool sSuppressNeutering;
67 } // namespace ipc
68 } // namespace mozilla
70 #endif // mozilla_ipc_Neutering_h