Bug 1183882 - Properly implement wrapper caching on PushMessageData. r=nsm, a=abillings
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sat, 18 Jul 2015 01:17:14 +0300
changeset 270362 837a1a106b4275b1eac554da700c2ab25520a178
parent 270361 0a803b1d8ed25a066bc23b5b65f71495b114f7b7
child 270363 b4a6171753f2dbbb73e2af1489cb343f6236f80f
push id8228
push userryanvm@gmail.com
push dateMon, 20 Jul 2015 17:57:15 +0000
treeherdermozilla-aurora@b4a6171753f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnsm, abillings
bugs1183882
milestone41.0a2
Bug 1183882 - Properly implement wrapper caching on PushMessageData. r=nsm, a=abillings
dom/workers/ServiceWorkerEvents.cpp
dom/workers/ServiceWorkerEvents.h
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -382,18 +382,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;