Bug 1477753: Implement missing cycle collection hooks for SharedMap. r=mccr8
authorKris Maglione <maglione.k@gmail.com>
Thu, 26 Jul 2018 14:36:57 -0700
changeset 428783 411056404d23df3c7deb26b602d2c1b4af33b9f1
parent 428782 a5bc7fb873cb40a152e261fc8d0605e48198e840
child 428784 565b62023b58fbaa84fb1075f6f86feaec36fecc
push id34343
push userdvarga@mozilla.com
push dateFri, 27 Jul 2018 22:31:28 +0000
treeherdermozilla-central@71f410a4fe34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1477753
milestone63.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 1477753: Implement missing cycle collection hooks for SharedMap. r=mccr8 MozReview-Commit-ID: E0ncT3e1Wb2
dom/base/nsFrameMessageManager.cpp
dom/ipc/SharedMap.cpp
dom/ipc/SharedMap.h
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -121,28 +121,30 @@ ImplCycleCollectionTraverse(nsCycleColle
   ImplCycleCollectionTraverse(aCallback, aField.mWeakListener, aName, aFlags);
 }
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsFrameMessageManager)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsFrameMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListeners)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildManagers)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSharedData)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsFrameMessageManager)
   NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mInitialProcessData)
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsFrameMessageManager)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mListeners)
   for (int32_t i = tmp->mChildManagers.Length(); i > 0; --i) {
     tmp->mChildManagers[i - 1]->Disconnect(false);
   }
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mChildManagers)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK(mSharedData)
   tmp->mInitialProcessData.setNull();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentFrameMessageManager)
 
   /* Message managers in child process implement nsIMessageSender.
--- a/dom/ipc/SharedMap.cpp
+++ b/dom/ipc/SharedMap.cpp
@@ -509,11 +509,19 @@ SharedMapChangeEvent::Constructor(EventT
   event->SetTrusted(trusted);
   event->SetComposed(aInit.mComposed);
 
   event->mChangedKeys = aInit.mChangedKeys;
 
   return event.forget();
 }
 
+NS_IMPL_CYCLE_COLLECTION_INHERITED(WritableSharedMap, SharedMap, mReadOnly)
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WritableSharedMap)
+NS_INTERFACE_MAP_END_INHERITING(SharedMap)
+
+NS_IMPL_ADDREF_INHERITED(WritableSharedMap, SharedMap)
+NS_IMPL_RELEASE_INHERITED(WritableSharedMap, SharedMap)
+
 } // ipc
 } // dom
 } // mozilla
--- a/dom/ipc/SharedMap.h
+++ b/dom/ipc/SharedMap.h
@@ -317,16 +317,18 @@ protected:
   // offsets are relative to this pointer, and Entry objects access their
   // structured clone data by indexing this pointer.
   char* Data() { return mMap.get<char>().get(); }
 };
 
 class WritableSharedMap final : public SharedMap
 {
 public:
+  NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(WritableSharedMap, SharedMap)
 
   WritableSharedMap();
 
   // Sets the value of the given (UTF-8 encoded) key to a structured clone
   // snapshot of the given value.
   void Set(JSContext* cx, const nsACString& name, JS::HandleValue value, ErrorResult& aRv);
 
   // Deletes the given (UTF-8 encoded) key from the map.