Bug 1869043 assert that graph set access is main thread only r=padenot
[gecko.git] / xpcom / string / nsStringStats.h
bloba38304c2b71ed87b80f5029fb935ce82f5ac43c7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsStringStats_h
8 #define nsStringStats_h
10 #include "mozilla/Atomics.h"
12 class nsStringStats {
13 public:
14 nsStringStats() = default;
16 ~nsStringStats();
18 using AtomicInt = mozilla::Atomic<int32_t, mozilla::SequentiallyConsistent>;
20 AtomicInt mAllocCount{0};
21 AtomicInt mReallocCount{0};
22 AtomicInt mFreeCount{0};
23 AtomicInt mShareCount{0};
24 AtomicInt mAdoptCount{0};
25 AtomicInt mAdoptFreeCount{0};
28 extern nsStringStats gStringStats;
30 #define STRING_STAT_INCREMENT(_s) (gStringStats.m##_s##Count)++
32 #endif // nsStringStats_h