Bumping manifests a=b2g-bump
[gecko.git] / gfx / src / gfxCrashReporterUtils.h
blobf67139a79a4efc1affd78b09f5a462ce8101702c
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
15 * On creation, adds "FeatureName?" to AppNotes
16 * On destruction, adds "FeatureName-", or "FeatureName+" if you called SetSuccessful().
18 * Any such string is added at most once to AppNotes, and is subsequently skipped.
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.
24 class NS_GFX ScopedGfxFeatureReporter
26 public:
27 explicit ScopedGfxFeatureReporter(const char *aFeature, bool force = false)
28 : mFeature(aFeature), mStatusChar('-')
30 WriteAppNote(force ? '!' : '?');
32 ~ScopedGfxFeatureReporter() {
33 WriteAppNote(mStatusChar);
35 void SetSuccessful() { mStatusChar = '+'; }
37 class AppNoteWritingRunnable;
39 protected:
40 const char *mFeature;
41 char mStatusChar;
43 private:
44 void WriteAppNote(char statusChar);
47 } // end namespace mozilla
49 #endif // gfxCrashReporterUtils_h__