michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:set ts=4 sw=4 sts=4 ci et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_LateWriteChecks_h michael@0: #define mozilla_LateWriteChecks_h michael@0: michael@0: // This file, along with LateWriteChecks.cpp, serves to check for and report michael@0: // late writes. The idea is discover writes to the file system that happens michael@0: // during shutdown such that these maybe be moved forward and the process may be michael@0: // killed without waiting for static destructors. michael@0: michael@0: namespace mozilla { michael@0: michael@0: /** Different shutdown check modes */ michael@0: enum ShutdownChecksMode { michael@0: SCM_CRASH, /** Crash on shutdown check failure */ michael@0: SCM_RECORD, /** Record shutdown check violations */ michael@0: SCM_NOTHING /** Don't attempt any shutdown checks */ michael@0: }; michael@0: michael@0: /** michael@0: * Current shutdown check mode. michael@0: * This variable is defined and initialized in nsAppRunner.cpp michael@0: */ michael@0: extern ShutdownChecksMode gShutdownChecks; michael@0: michael@0: /** michael@0: * Allocate structures and acquire information from XPCOM necessary to do late michael@0: * write checks. This function must be invoked before BeginLateWriteChecks() michael@0: * and before XPCOM has stopped working. michael@0: */ michael@0: void InitLateWriteChecks(); michael@0: michael@0: /** michael@0: * Begin recording all writes as late-writes. This function should be called michael@0: * when all legitimate writes have occurred. This function does not rely on michael@0: * XPCOM as it is designed to be invoked during XPCOM shutdown. michael@0: * michael@0: * For late-write checks to work you must initialize one or more backends that michael@0: * reports IO through the IOInterposer API. PoisonIOInterposer would probably michael@0: * be the backend of choice in this case. michael@0: * michael@0: * Note: BeginLateWriteChecks() must have been invoked before this function. michael@0: */ michael@0: void BeginLateWriteChecks(); michael@0: michael@0: /** michael@0: * Stop recording all writes as late-writes, call this function when you want michael@0: * late-write checks to stop. I.e. exception handling, or the special case on michael@0: * Mac described in bug 826029. michael@0: */ michael@0: void StopLateWriteChecks(); michael@0: michael@0: } // mozilla michael@0: michael@0: #endif // mozilla_LateWriteChecks_h