Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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 #ifndef gfxCrashReporterUtils_h__
7 #define gfxCrashReporterUtils_h__
9 #include "gfxCore.h"
11 namespace mozilla {
13 /** \class ScopedGfxFeatureReporter
14 *
15 * On creation, adds "FeatureName?" to AppNotes
16 * On destruction, adds "FeatureName-", or "FeatureName+" if you called SetSuccessful().
17 *
18 * Any such string is added at most once to AppNotes, and is subsequently skipped.
19 *
20 * This ScopedGfxFeatureReporter class is designed to be fool-proof to use in functions that
21 * have many exit points. We don't want to encourage having function with many exit points.
22 * It just happens that our graphics features initialization functions are like that.
23 */
24 class NS_GFX ScopedGfxFeatureReporter
25 {
26 public:
27 ScopedGfxFeatureReporter(const char *aFeature, bool force = false)
28 : mFeature(aFeature), mStatusChar('-')
29 {
30 WriteAppNote(force ? '!' : '?');
31 }
32 ~ScopedGfxFeatureReporter() {
33 WriteAppNote(mStatusChar);
34 }
35 void SetSuccessful() { mStatusChar = '+'; }
37 class AppNoteWritingRunnable;
39 protected:
40 const char *mFeature;
41 char mStatusChar;
43 private:
44 void WriteAppNote(char statusChar);
45 };
47 } // end namespace mozilla
49 #endif // gfxCrashReporterUtils_h__