Bug 1768646 [wpt PR 34018] - [mq-4] Enable CSSMediaQueries4 for stable, a=testonly
[gecko.git] / image / ShutdownTracker.h
blob9e5237cc3d629de2437cf78386fc6d24101198fd
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /**
7 * ShutdownTracker is an imagelib-global service that allows callers to check
8 * whether shutdown has started.
9 */
11 #ifndef mozilla_image_ShutdownTracker_h
12 #define mozilla_image_ShutdownTracker_h
14 namespace mozilla {
15 namespace image {
17 /**
18 * ShutdownTracker is an imagelib-global service that allows callers to check
19 * whether shutdown has started. It exists to avoid the need for registering
20 * many 'xpcom-will-shutdown' notification observers on short-lived objects,
21 * which would have an unnecessary performance cost.
23 struct ShutdownTracker {
24 /**
25 * Initialize static data. Called during imagelib module initialization.
27 static void Initialize();
29 /**
30 * Check whether shutdown has started. Callers can use this to check whether
31 * it's safe to access XPCOM services; if shutdown has started, such calls
32 * must be avoided.
34 * @return true if shutdown has already started.
36 static bool ShutdownHasStarted();
38 private:
39 virtual ~ShutdownTracker() = 0; // Forbid instantiation.
42 } // namespace image
43 } // namespace mozilla
45 #endif // mozilla_image_ShutdownTracker_h