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