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/. */
7 * ShutdownTracker is an imagelib-global service that allows callers to check
8 * whether shutdown has started.
11 #ifndef mozilla_image_ShutdownTracker_h
12 #define mozilla_image_ShutdownTracker_h
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
{
25 * Initialize static data. Called during imagelib module initialization.
27 static void Initialize();
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
34 * @return true if shutdown has already started.
36 static bool ShutdownHasStarted();
39 virtual ~ShutdownTracker() = 0; // Forbid instantiation.
43 } // namespace mozilla
45 #endif // mozilla_image_ShutdownTracker_h