Bug 1450321, part 2 - Remove the Locked methods. draft
authorAndrew McCreight <continuation@gmail.com>
Fri, 30 Mar 2018 12:19:06 -0700
changeset 776986 764f688b823c307e70e8aa0792b9c9296a88aa70
parent 776985 96c505f27f40c218b793dad0a9975c88c336bc66
child 776987 d247f217c7cf7b5c55b9e7244c24ab49d742ea2e
push id105047
push userbmo:continuation@gmail.com
push dateTue, 03 Apr 2018 23:36:00 +0000
bugs1450321
milestone61.0a1
Bug 1450321, part 2 - Remove the Locked methods. Now that there are no locks, there's no need for "Locked" methods. MozReview-Commit-ID: 39Vx6v2GV42
xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
xpcom/reflect/xptinfo/xptiWorkingSet.cpp
xpcom/reflect/xptinfo/xptiprivate.h
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
@@ -43,22 +43,16 @@ xptiInterfaceEntry::xptiInterfaceEntry(c
   SetScriptableFlag(aIface->IsScriptable());
   SetBuiltinClassFlag(aIface->IsBuiltinClass());
   SetMainProcessScriptableOnlyFlag(aIface->IsMainProcessScriptableOnly());
 }
 
 bool
 xptiInterfaceEntry::Resolve()
 {
-  return ResolveLocked();
-}
-
-bool
-xptiInterfaceEntry::ResolveLocked()
-{
   int resolvedState = GetResolveState();
 
   if (resolvedState == FULLY_RESOLVED) {
     return true;
   }
   if (resolvedState == RESOLVE_FAILED) {
     return false;
   }
@@ -68,17 +62,17 @@ xptiInterfaceEntry::ResolveLocked()
   // Finish out resolution by finding parent and Resolving it so
   // we can set the info we get from it.
 
   uint16_t parent_index = mDescriptor->mParentInterface;
 
   if (parent_index) {
     xptiInterfaceEntry* parent = mTypelib->GetEntryAt(parent_index - 1);
 
-    if (!parent || !parent->EnsureResolvedLocked()) {
+    if (!parent || !parent->EnsureResolved()) {
       SetResolvedState(RESOLVE_FAILED);
       return false;
     }
 
     mParent = parent;
     if (parent->GetHasNotXPCOMFlag()) {
       SetHasNotXPCOMFlag();
     } else {
@@ -566,17 +560,17 @@ xptiInterfaceEntry::InterfaceInfo()
     mInfo = new xptiInterfaceInfo(this);
   }
 
   RefPtr<xptiInterfaceInfo> info = mInfo;
   return info.forget();
 }
 
 void
-xptiInterfaceEntry::LockedInvalidateInterfaceInfo()
+xptiInterfaceEntry::InvalidateInterfaceInfo()
 {
   if (mInfo) {
     mInfo->Invalidate();
     mInfo = nullptr;
   }
 }
 
 bool
@@ -637,17 +631,17 @@ xptiInterfaceInfo::Release(void)
 
     // If InterfaceInfo added a reference before we acquired the monitor
     // then we want to bail out of here without destorying the object.
     if (mRefCnt) {
       return 1;
     }
 
     if (mEntry) {
-      mEntry->LockedInterfaceInfoDeathNotification();
+      mEntry->InterfaceInfoDeathNotification();
       mEntry = nullptr;
     }
 
     delete this;
     return 0;
   }
   return cnt;
 }
--- a/xpcom/reflect/xptinfo/xptiWorkingSet.cpp
+++ b/xpcom/reflect/xptinfo/xptiWorkingSet.cpp
@@ -28,17 +28,17 @@ XPTInterfaceInfoManager::xptiWorkingSet:
     XPT_NewArena(XPTI_ARENA8_BLOCK_SIZE, XPTI_ARENA1_BLOCK_SIZE);
 }
 
 void
 XPTInterfaceInfoManager::xptiWorkingSet::InvalidateInterfaceInfos()
 {
   for (auto iter = mNameTable.Iter(); !iter.Done(); iter.Next()) {
     xptiInterfaceEntry* entry = iter.UserData();
-    entry->LockedInvalidateInterfaceInfo();
+    entry->InvalidateInterfaceInfo();
   }
 }
 
 XPTInterfaceInfoManager::xptiWorkingSet::~xptiWorkingSet()
 {
   MOZ_COUNT_DTOR(xptiWorkingSet);
 
   // Only destroy the arena if we're doing leak stats. Why waste shutdown
--- a/xpcom/reflect/xptinfo/xptiprivate.h
+++ b/xpcom/reflect/xptinfo/xptiprivate.h
@@ -219,18 +219,18 @@ public:
   bool EnsureResolved() { return IsFullyResolved() ? true : Resolve(); }
 
   already_AddRefed<xptiInterfaceInfo> InterfaceInfo();
   bool InterfaceInfoEquals(const xptiInterfaceInfo* info) const
   {
     return info == mInfo;
   }
 
-  void LockedInvalidateInterfaceInfo();
-  void LockedInterfaceInfoDeathNotification() { mInfo = nullptr; }
+  void InvalidateInterfaceInfo();
+  void InterfaceInfoDeathNotification() { mInfo = nullptr; }
 
   xptiInterfaceEntry* Parent() const
   {
     NS_ASSERTION(IsFullyResolved(), "Parent() called while not resolved?");
     return mParent;
   }
 
   const nsID& IID() const { return mIID; }
@@ -284,26 +284,16 @@ private:
   xptiInterfaceEntry(const XPTInterfaceDescriptor* aIface,
                      xptiTypelibGuts* aTypelib);
   ~xptiInterfaceEntry();
 
   void SetResolvedState(int state) { mFlags.SetState(uint8_t(state)); }
 
   bool Resolve();
 
-  // We only call these "*Locked" variants after locking. This is done to
-  // allow reentrace as files are loaded and various interfaces resolved
-  // without having to worry about the locked state.
-
-  bool EnsureResolvedLocked()
-  {
-    return IsFullyResolved() ? true : ResolveLocked();
-  }
-  bool ResolveLocked();
-
   // private helpers
 
   nsresult GetEntryForParam(uint16_t methodIndex,
                             const nsXPTParamInfo* param,
                             xptiInterfaceEntry** entry);
 
   nsresult GetTypeInArray(const nsXPTParamInfo* param,
                           uint16_t dimension,