Bug 1119482, part 4 - Move IsJSHolder into HoldDropJSObjects. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Tue, 10 Mar 2015 16:41:38 -0700
changeset 232895 6df619aca8397154d2db902b249a9401629c7708
parent 232894 6efde76492aec4498d8c913641ccfd13f4024f7d
child 232896 9e3bb49db815e8e5211c1c9f970a0ba9a8c9dfb5
push id56674
push useramccreight@mozilla.com
push dateTue, 10 Mar 2015 23:41:54 +0000
treeherdermozilla-inbound@6df619aca839 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1119482
milestone39.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 1119482, part 4 - Move IsJSHolder into HoldDropJSObjects. r=smaug
dom/indexedDB/IDBWrapperCache.cpp
xpcom/base/HoldDropJSObjects.cpp
xpcom/base/HoldDropJSObjects.h
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsCycleCollector.h
--- a/dom/indexedDB/IDBWrapperCache.cpp
+++ b/dom/indexedDB/IDBWrapperCache.cpp
@@ -6,20 +6,16 @@
 
 #include "IDBWrapperCache.h"
 
 #include "mozilla/HoldDropJSObjects.h"
 #include "nsCOMPtr.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsPIDOMWindow.h"
 
-#ifdef DEBUG
-#include "nsCycleCollector.h"
-#endif
-
 namespace mozilla {
 namespace dom {
 namespace indexedDB {
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(IDBWrapperCache)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IDBWrapperCache,
                                                   DOMEventTargetHelper)
@@ -71,16 +67,16 @@ IDBWrapperCache::SetScriptOwner(JSObject
   mScriptOwner = aScriptOwner;
   mozilla::HoldJSObjects(this);
 }
 
 #ifdef DEBUG
 void
 IDBWrapperCache::AssertIsRooted() const
 {
-  MOZ_ASSERT(cyclecollector::IsJSHolder(const_cast<IDBWrapperCache*>(this)),
+  MOZ_ASSERT(IsJSHolder(const_cast<IDBWrapperCache*>(this)),
              "Why aren't we rooted?!");
 }
 #endif
 
 } // namespace indexedDB
 } // namespace dom
 } // namespace mozilla
--- a/xpcom/base/HoldDropJSObjects.cpp
+++ b/xpcom/base/HoldDropJSObjects.cpp
@@ -49,9 +49,20 @@ DropJSObjectsImpl(nsISupports* aHolder)
   MOZ_ASSERT(participant, "Failed to QI to nsXPCOMCycleCollectionParticipant!");
   MOZ_ASSERT(participant->CheckForRightISupports(aHolder),
              "The result of QIing a JS holder should be the same as ToSupports");
 #endif
   DropJSObjectsImpl(static_cast<void*>(aHolder));
 }
 
 } // namespace cyclecollector
+
+#ifdef DEBUG
+bool
+IsJSHolder(void* aHolder)
+{
+  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
+  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
+  return rt->IsJSHolder(aHolder);
+}
+#endif
+
 } // namespace mozilla
--- a/xpcom/base/HoldDropJSObjects.h
+++ b/xpcom/base/HoldDropJSObjects.h
@@ -63,11 +63,15 @@ HoldJSObjects(T* aHolder)
 
 template<class T>
 void
 DropJSObjects(T* aHolder)
 {
   HoldDropJSObjectsHelper<T>::Drop(aHolder);
 }
 
+#ifdef DEBUG
+bool IsJSHolder(void* aHolder);
+#endif
+
 } // namespace mozilla
 
 #endif // mozilla_HoldDropJSObjects_h
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -3907,26 +3907,16 @@ CycleCollectedJSRuntime::Get()
   }
   return nullptr;
 }
 
 
 namespace mozilla {
 namespace cyclecollector {
 
-#ifdef DEBUG
-bool
-IsJSHolder(void* aHolder)
-{
-  CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
-  MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
-  return rt->IsJSHolder(aHolder);
-}
-#endif
-
 void
 DeferredFinalize(nsISupports* aSupports)
 {
   CycleCollectedJSRuntime* rt = CycleCollectedJSRuntime::Get();
   MOZ_ASSERT(rt, "Should have a CycleCollectedJSRuntime by now");
   rt->DeferredFinalize(aSupports);
 }
 
--- a/xpcom/base/nsCycleCollector.h
+++ b/xpcom/base/nsCycleCollector.h
@@ -75,20 +75,16 @@ void nsCycleCollector_forgetJSRuntime();
 extern nsresult
 nsCycleCollectorLoggerConstructor(nsISupports* aOuter,
                                   const nsIID& aIID,
                                   void** aInstancePtr);
 
 namespace mozilla {
 namespace cyclecollector {
 
-#ifdef DEBUG
-bool IsJSHolder(void* aHolder);
-#endif
-
 void DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc,
                       DeferredFinalizeFunction aFunc,
                       void* aThing);
 void DeferredFinalize(nsISupports* aSupports);
 
 
 } // namespace cyclecollector
 } // namespace mozilla