Bug 974353 - Add MOZ_COUNT_[CD]TOR to SharedMemory - r=bent
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 26 Feb 2014 16:23:51 -0500
changeset 171063 171b2a06b4d925b62f180b936e3b6fc423312b29
parent 171062 9abeb9a2d6cd40584bacd78ad097a06434a39e0a
child 171064 e560b97c43ebab677cc0a47aa965f4e120539b67
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbent
bugs974353
milestone30.0a1
Bug 974353 - Add MOZ_COUNT_[CD]TOR to SharedMemory - r=bent
ipc/glue/SharedMemory.cpp
ipc/glue/SharedMemory.h
--- a/ipc/glue/SharedMemory.cpp
+++ b/ipc/glue/SharedMemory.cpp
@@ -43,16 +43,17 @@ public:
 };
 
 NS_IMPL_ISUPPORTS1(ShmemReporter, nsIMemoryReporter)
 
 SharedMemory::SharedMemory()
   : mAllocSize(0)
   , mMappedSize(0)
 {
+  MOZ_COUNT_CTOR(SharedMemory);
   static Atomic<bool> registered;
   if (registered.compareExchange(false, true)) {
     RegisterStrongMemoryReporter(new ShmemReporter());
   }
 }
 
 /*static*/ size_t
 SharedMemory::PageAlignedSize(size_t aSize)
--- a/ipc/glue/SharedMemory.h
+++ b/ipc/glue/SharedMemory.h
@@ -25,24 +25,29 @@ enum Rights {
 }
 
 namespace mozilla {
 namespace ipc {
 
 class SharedMemory
 {
 public:
+  virtual ~SharedMemory()
+  {
+    MOZ_COUNT_DTOR(SharedMemory);
+    Unmapped();
+    Destroyed();
+  }
+
   enum SharedMemoryType {
     TYPE_BASIC,
     TYPE_SYSV,
     TYPE_UNKNOWN
   };
 
-  virtual ~SharedMemory() { Unmapped(); Destroyed(); }
-
   size_t Size() const { return mMappedSize; }
 
   virtual void* memory() const = 0;
 
   virtual bool Create(size_t size) = 0;
   virtual bool Map(size_t nBytes) = 0;
 
   virtual SharedMemoryType Type() const = 0;