Bug 877924 - Always trace IDBFactory owner pointer r=mccr8
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 05 Nov 2014 08:44:26 +0000
changeset 214075 8aab8aebc1a5d951e48a84a7c53508a84b9d8c1a
parent 214074 21ddb8a58fea635e047c00827675fed3c42b3d31
child 214076 2acbf923b6a82bb6b038c6076bd210c2e52d5a00
push id27771
push userryanvm@gmail.com
push dateWed, 05 Nov 2014 19:04:24 +0000
treeherdermozilla-central@305b4fecce99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs877924
milestone36.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 877924 - Always trace IDBFactory owner pointer r=mccr8
dom/indexedDB/IDBFactory.cpp
dom/indexedDB/IDBFactory.h
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.cpp
@@ -105,34 +105,31 @@ struct IDBFactory::PendingRequestInfo
     MOZ_ASSERT(aRequest);
     MOZ_ASSERT(aParams.type() != FactoryRequestParams::T__None);
   }
 };
 
 IDBFactory::IDBFactory()
   : mOwningObject(nullptr)
   , mBackgroundActor(nullptr)
-  , mRootedOwningObject(false)
   , mBackgroundActorFailed(false)
   , mPrivateBrowsingMode(false)
 {
 #ifdef DEBUG
   mOwningThread = PR_GetCurrentThread();
 #endif
   AssertIsOnOwningThread();
 }
 
 IDBFactory::~IDBFactory()
 {
   MOZ_ASSERT_IF(mBackgroundActorFailed, !mBackgroundActor);
 
-  if (mRootedOwningObject) {
-    mOwningObject = nullptr;
-    mozilla::DropJSObjects(this);
-  }
+  mOwningObject = nullptr;
+  mozilla::DropJSObjects(this);
 
   if (mBackgroundActor) {
     mBackgroundActor->SendDeleteMeInternal();
     MOZ_ASSERT(!mBackgroundActor, "SendDeleteMeInternal should have cleared!");
   }
 }
 
 // static
@@ -266,19 +263,17 @@ IDBFactory::CreateForJSInternal(JSContex
   if (NS_WARN_IF(!mgr)) {
     IDB_REPORT_INTERNAL_ERR();
     return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
   }
 
   nsRefPtr<IDBFactory> factory = new IDBFactory();
   factory->mPrincipalInfo = aPrincipalInfo.forget();
   factory->mOwningObject = aOwningObject;
-
   mozilla::HoldJSObjects(factory.get());
-  factory->mRootedOwningObject = true;
 
   factory.forget(aFactory);
   return NS_OK;
 }
 
 #ifdef DEBUG
 
 void
@@ -711,23 +706,17 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(IDBFactor
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IDBFactory)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IDBFactory)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
-  if (tmp->mOwningObject) {
-    tmp->mOwningObject = nullptr;
-  }
-  if (tmp->mRootedOwningObject) {
-    mozilla::DropJSObjects(tmp);
-    tmp->mRootedOwningObject = false;
-  }
+  tmp->mOwningObject = nullptr;
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(IDBFactory)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
   NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mOwningObject)
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
--- a/dom/indexedDB/IDBFactory.h
+++ b/dom/indexedDB/IDBFactory.h
@@ -68,17 +68,16 @@ class IDBFactory MOZ_FINAL
   nsTArray<nsAutoPtr<PendingRequestInfo>> mPendingRequests;
 
   BackgroundFactoryChild* mBackgroundActor;
 
 #ifdef DEBUG
   PRThread* mOwningThread;
 #endif
 
-  bool mRootedOwningObject;
   bool mBackgroundActorFailed;
   bool mPrivateBrowsingMode;
 
 public:
   static nsresult
   CreateForWindow(nsPIDOMWindow* aWindow,
                   IDBFactory** aFactory);