Bug 1334421 - Don't use templated class for refcount macros in MediaParent. r=jib
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 20 Mar 2017 16:55:31 +0100
changeset 349022 cf0f994a49af4d9e07856d4714eba1b5bc7dd1f8
parent 349021 0837622d710538d3ff099531d5ddd137c0e7f159
child 349023 2cb65b6a5a873089b310383a9509b9b6c8221ed3
push id39384
push userpehrsons@gmail.com
push dateThu, 23 Mar 2017 08:36:01 +0000
treeherderautoland@2cb65b6a5a87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1334421
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1334421 - Don't use templated class for refcount macros in MediaParent. r=jib The assert in bug 1334421 mentions the MOZ_COUNT_{C|D}TOR macros, but the same comment seems to apply to the NS_LogAddRef that's part of the NS_INLINE_DECL_THREADSAFE_REFCOUNTING macro. This fixes it for me. MozReview-Commit-ID: CPjdO8YBbt0
dom/media/systemservices/MediaParent.h
--- a/dom/media/systemservices/MediaParent.h
+++ b/dom/media/systemservices/MediaParent.h
@@ -35,26 +35,37 @@ protected:
                                                          const bool& aOnlyPrivateBrowsing) = 0;
   virtual void
   ActorDestroy(ActorDestroyReason aWhy) = 0;
 
   bool SendGetPrincipalKeyResponse(const uint32_t& aRequestId,
                                    nsCString aKey);
 };
 
+/**
+ * Dummy class to avoid a templated class being passed to the refcounting macro
+ * (see Bug 1334421 for what happens then)
+ */
+class RefCountedParent
+{
+public:
+  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RefCountedParent)
+
+protected:
+  virtual ~RefCountedParent() {}
+};
+
 // Super = PMediaParent or NonE10s
 
 template<class Super>
-class Parent : public Super
+class Parent : public RefCountedParent, public Super
 {
   typedef mozilla::ipc::IProtocol::ActorDestroyReason
       ActorDestroyReason;
 public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Parent<Super>)
-
   virtual mozilla::ipc::IPCResult
   RecvGetPrincipalKey(const uint32_t& aRequestId,
                       const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
                       const bool& aPersist) override;
   virtual mozilla::ipc::IPCResult RecvSanitizeOriginKeys(const uint64_t& aSinceWhen,
                                                          const bool& aOnlyPrivateBrowsing) override;
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;