Bumping manifests a=b2g-bump
[gecko.git] / image / src / ShutdownTracker.h
blobe1287b6cfb3853d5b3750f328e194881146da212
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_IMAGELIB_SHUTDOWNTRACKER_H_
12 #define MOZILLA_IMAGELIB_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 many
20 * 'xpcom-shutdown' notification observers on short-lived objects, which would
21 * have an unnecessary performance cost.
23 struct ShutdownTracker
25 /**
26 * Initialize static data. Called during imagelib module initialization.
28 static void Initialize();
30 /**
31 * Check whether shutdown has started. Callers can use this to check whether
32 * it's safe to access XPCOM services; if shutdown has started, such calls
33 * must be avoided.
35 * @return true if shutdown has already started.
37 static bool ShutdownHasStarted();
39 private:
40 virtual ~ShutdownTracker() = 0; // Forbid instantiation.
43 } // namespace image
44 } // namespace mozilla
46 #endif // MOZILLA_IMAGELIB_SHUTDOWNTRACKER_H_