Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim:set ts=4 sw=4 sts=4 ci et: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_LateWriteChecks_h |
michael@0 | 8 | #define mozilla_LateWriteChecks_h |
michael@0 | 9 | |
michael@0 | 10 | // This file, along with LateWriteChecks.cpp, serves to check for and report |
michael@0 | 11 | // late writes. The idea is discover writes to the file system that happens |
michael@0 | 12 | // during shutdown such that these maybe be moved forward and the process may be |
michael@0 | 13 | // killed without waiting for static destructors. |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | |
michael@0 | 17 | /** Different shutdown check modes */ |
michael@0 | 18 | enum ShutdownChecksMode { |
michael@0 | 19 | SCM_CRASH, /** Crash on shutdown check failure */ |
michael@0 | 20 | SCM_RECORD, /** Record shutdown check violations */ |
michael@0 | 21 | SCM_NOTHING /** Don't attempt any shutdown checks */ |
michael@0 | 22 | }; |
michael@0 | 23 | |
michael@0 | 24 | /** |
michael@0 | 25 | * Current shutdown check mode. |
michael@0 | 26 | * This variable is defined and initialized in nsAppRunner.cpp |
michael@0 | 27 | */ |
michael@0 | 28 | extern ShutdownChecksMode gShutdownChecks; |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Allocate structures and acquire information from XPCOM necessary to do late |
michael@0 | 32 | * write checks. This function must be invoked before BeginLateWriteChecks() |
michael@0 | 33 | * and before XPCOM has stopped working. |
michael@0 | 34 | */ |
michael@0 | 35 | void InitLateWriteChecks(); |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Begin recording all writes as late-writes. This function should be called |
michael@0 | 39 | * when all legitimate writes have occurred. This function does not rely on |
michael@0 | 40 | * XPCOM as it is designed to be invoked during XPCOM shutdown. |
michael@0 | 41 | * |
michael@0 | 42 | * For late-write checks to work you must initialize one or more backends that |
michael@0 | 43 | * reports IO through the IOInterposer API. PoisonIOInterposer would probably |
michael@0 | 44 | * be the backend of choice in this case. |
michael@0 | 45 | * |
michael@0 | 46 | * Note: BeginLateWriteChecks() must have been invoked before this function. |
michael@0 | 47 | */ |
michael@0 | 48 | void BeginLateWriteChecks(); |
michael@0 | 49 | |
michael@0 | 50 | /** |
michael@0 | 51 | * Stop recording all writes as late-writes, call this function when you want |
michael@0 | 52 | * late-write checks to stop. I.e. exception handling, or the special case on |
michael@0 | 53 | * Mac described in bug 826029. |
michael@0 | 54 | */ |
michael@0 | 55 | void StopLateWriteChecks(); |
michael@0 | 56 | |
michael@0 | 57 | } // mozilla |
michael@0 | 58 | |
michael@0 | 59 | #endif // mozilla_LateWriteChecks_h |