1 : #ifndef mozilla_PaintTracker_h
2 : #define mozilla_PaintTracker_h
3 :
4 : #include "nscore.h"
5 : #include "nsDebug.h"
6 :
7 : namespace mozilla {
8 :
9 : class NS_STACK_CLASS PaintTracker
10 : {
11 : public:
12 0 : PaintTracker() {
13 0 : ++gPaintTracker;
14 0 : }
15 0 : ~PaintTracker() {
16 0 : NS_ASSERTION(gPaintTracker > 0, "Mismatched constructor/destructor");
17 0 : --gPaintTracker;
18 0 : }
19 :
20 : static bool IsPainting() {
21 : return !!gPaintTracker;
22 : }
23 :
24 : private:
25 : static int gPaintTracker;
26 : };
27 :
28 : } // namespace mozilla
29 :
30 : #endif // mozilla_PaintTracker_h
|