Bug 1183882, properly implement wrapper caching on PushMessageData, r=nsm
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sat, 18 Jul 2015 01:17:14 +0300
changeset 253530 71541c64c605ddf0463ab356c837dfc4e5e203cb
parent 253529 945f8c56a39dd4064f90b6a35fd483a9bb6982dd
child 253531 d86fa46b62b8b35406fef4b014eb3d76ec73ec61
push id62471
push useropettay@mozilla.com
push dateFri, 17 Jul 2015 22:41:50 +0000
treeherdermozilla-inbound@71541c64c605 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm
bugs1183882
milestone42.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 1183882, properly implement wrapper caching on PushMessageData, r=nsm
dom/workers/ServiceWorkerEvents.cpp
dom/workers/ServiceWorkerEvents.h
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -430,18 +430,25 @@ PushMessageData::PushMessageData(const n
   : mData(aData)
 {
 }
 
 PushMessageData::~PushMessageData()
 {
 }
 
-NS_IMPL_ISUPPORTS0(PushMessageData);
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(PushMessageData);
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(PushMessageData)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(PushMessageData)
 
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PushMessageData)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
 
 void
 PushMessageData::Json(JSContext* cx, JS::MutableHandle<JSObject*> aRetval)
 {
   //todo bug 1149195.  Don't be lazy.
    NS_ABORT();
 }
 
--- a/dom/workers/ServiceWorkerEvents.h
+++ b/dom/workers/ServiceWorkerEvents.h
@@ -158,17 +158,18 @@ public:
 #ifndef MOZ_SIMPLEPUSH
 
 class PushMessageData final : public nsISupports,
                               public nsWrapperCache
 {
   nsString mData;
 
 public:
-  NS_DECL_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PushMessageData)
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return mozilla::dom::PushMessageDataBinding_workers::Wrap(aCx, this, aGivenProto);
   }
 
   nsISupports* GetParentObject() const {
     return nullptr;