rename fields of XPTInterfaceDescriptor draft
authorAndrew McCreight <continuation@gmail.com>
Wed, 28 Feb 2018 14:24:24 -0800
changeset 762245 ab882325af45beb5aae9b9f178ee287018927cf7
parent 762244 6ec18a5287f08278b6a02600acb23f8f7d826c17
child 762246 38d785af0f0d3d82e5e2f11cac1462d2185edde7
push id101107
push userbmo:continuation@gmail.com
push dateThu, 01 Mar 2018 22:22:59 +0000
milestone60.0a1
rename fields of XPTInterfaceDescriptor don't bother with the additional types thing because that's going away MozReview-Commit-ID: 1tB17LKBeh6
xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
xpcom/reflect/xptinfo/xptiInterfaceInfoManager.cpp
xpcom/typelib/xpt/xpt_struct.h
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
@@ -65,50 +65,50 @@ xptiInterfaceEntry::ResolveLocked()
     if(resolvedState == RESOLVE_FAILED)
         return false;
 
     NS_ASSERTION(GetResolveState() == PARTIALLY_RESOLVED, "bad state!");
 
     // Finish out resolution by finding parent and Resolving it so
     // we can set the info we get from it.
 
-    uint16_t parent_index = mDescriptor->parent_interface;
+    uint16_t parent_index = mDescriptor->mParentInterface;
 
     if(parent_index)
     {
         xptiInterfaceEntry* parent =
             mTypelib->GetEntryAt(parent_index - 1);
 
         if(!parent || !parent->EnsureResolvedLocked())
         {
             SetResolvedState(RESOLVE_FAILED);
             return false;
         }
 
         mParent = parent;
         if (parent->GetHasNotXPCOMFlag()) {
             SetHasNotXPCOMFlag();
         } else {
-            for (uint16_t idx = 0; idx < mDescriptor->num_methods; ++idx) {
+            for (uint16_t idx = 0; idx < mDescriptor->mNumMethods; ++idx) {
                 nsXPTMethodInfoRef method(mHeader, mDescriptor->Method(mHeader, idx));
                 if (method.IsNotXPCOM()) {
                     SetHasNotXPCOMFlag();
                     break;
                 }
             }
         }
 
 
         mMethodBaseIndex =
             parent->mMethodBaseIndex +
-            parent->mDescriptor->num_methods;
+            parent->mDescriptor->mNumMethods;
 
         mConstantBaseIndex =
             parent->mConstantBaseIndex +
-            parent->mDescriptor->num_constants;
+            parent->mDescriptor->mNumConstants;
 
     }
     LOG_RESOLVE(("+ complete resolve of %s\n", mName));
 
     SetResolvedState(FULLY_RESOLVED);
     return true;
 }
 
@@ -151,45 +151,45 @@ xptiInterfaceEntry::IsFunction(bool* res
 
 nsresult
 xptiInterfaceEntry::GetMethodCount(uint16_t* count)
 {
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     *count = mMethodBaseIndex +
-             mDescriptor->num_methods;
+             mDescriptor->mNumMethods;
     return NS_OK;
 }
 
 nsresult
 xptiInterfaceEntry::GetConstantCount(uint16_t* count)
 {
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(!count)
         return NS_ERROR_UNEXPECTED;
 
     *count = mConstantBaseIndex +
-             mDescriptor->num_constants;
+             mDescriptor->mNumConstants;
     return NS_OK;
 }
 
 nsresult
 xptiInterfaceEntry::GetMethodInfo(uint16_t index, nsXPTMethodInfoRef* info)
 {
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(index < mMethodBaseIndex)
         return mParent->GetMethodInfo(index, info);
 
     if(index >= mMethodBaseIndex +
-                mDescriptor->num_methods)
+                mDescriptor->mNumMethods)
     {
         NS_ERROR("bad param");
         *info = nsXPTMethodInfoRef();
         return NS_ERROR_INVALID_ARG;
     }
 
     // else...
     *info = nsXPTMethodInfoRef(mHeader,
@@ -201,17 +201,17 @@ nsresult
 xptiInterfaceEntry::GetMethodInfoForName(const char* methodName,
                                          uint16_t* index,
                                          nsXPTMethodInfoRef* result)
 {
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     // This is a slow algorithm, but this is not expected to be called much.
-    for(uint16_t i = 0; i < mDescriptor->num_methods; ++i)
+    for(uint16_t i = 0; i < mDescriptor->mNumMethods; ++i)
     {
         nsXPTMethodInfoRef info(mHeader, mDescriptor->Method(mHeader, i));
         if (PL_strcmp(methodName, info.GetName()) == 0) {
             *index = i + mMethodBaseIndex;
             *result = info;
             return NS_OK;
         }
     }
@@ -230,17 +230,17 @@ xptiInterfaceEntry::GetConstant(uint16_t
 {
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(index < mConstantBaseIndex)
         return mParent->GetConstant(index, constant, name);
 
     if(index >= mConstantBaseIndex +
-                mDescriptor->num_constants)
+                mDescriptor->mNumConstants)
     {
         NS_PRECONDITION(0, "bad param");
         return NS_ERROR_INVALID_ARG;
     }
 
     const auto& c = mDescriptor->Const(mHeader, index - mConstantBaseIndex);
     AutoJSContext cx;
     JS::Rooted<JS::Value> v(cx);
@@ -289,17 +289,17 @@ xptiInterfaceEntry::GetInterfaceIndexFor
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(methodIndex < mMethodBaseIndex)
         return mParent->GetInterfaceIndexForParam(methodIndex, param,
                                                   interfaceIndex);
 
     if(methodIndex >= mMethodBaseIndex +
-                      mDescriptor->num_methods)
+                      mDescriptor->mNumMethods)
     {
         NS_ERROR("bad param");
         return NS_ERROR_INVALID_ARG;
     }
 
     const XPTTypeDescriptor *td = &param->type;
 
     while (td->Tag() == TD_ARRAY) {
@@ -462,17 +462,17 @@ xptiInterfaceEntry::GetTypeForParam(uint
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(methodIndex < mMethodBaseIndex)
         return mParent->
             GetTypeForParam(methodIndex, param, dimension, type);
 
     if(methodIndex >= mMethodBaseIndex +
-                      mDescriptor->num_methods)
+                      mDescriptor->mNumMethods)
     {
         NS_ERROR("bad index");
         return NS_ERROR_INVALID_ARG;
     }
 
     const XPTTypeDescriptor *td;
 
     if(dimension) {
@@ -496,17 +496,17 @@ xptiInterfaceEntry::GetSizeIsArgNumberFo
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(methodIndex < mMethodBaseIndex)
         return mParent->
             GetSizeIsArgNumberForParam(methodIndex, param, dimension, argnum);
 
     if(methodIndex >= mMethodBaseIndex +
-                      mDescriptor->num_methods)
+                      mDescriptor->mNumMethods)
     {
         NS_ERROR("bad index");
         return NS_ERROR_INVALID_ARG;
     }
 
     const XPTTypeDescriptor *td;
 
     if(dimension) {
@@ -542,17 +542,17 @@ xptiInterfaceEntry::GetInterfaceIsArgNum
     if(!EnsureResolved())
         return NS_ERROR_UNEXPECTED;
 
     if(methodIndex < mMethodBaseIndex)
         return mParent->
             GetInterfaceIsArgNumberForParam(methodIndex, param, argnum);
 
     if(methodIndex >= mMethodBaseIndex +
-                      mDescriptor->num_methods)
+                      mDescriptor->mNumMethods)
     {
         NS_ERROR("bad index");
         return NS_ERROR_INVALID_ARG;
     }
 
     const XPTTypeDescriptor *td = &param->type;
 
     while (td->Tag() == TD_ARRAY) {
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfoManager.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfoManager.cpp
@@ -117,17 +117,17 @@ XPTInterfaceInfoManager::VerifyAndAddEnt
     const XPTInterfaceDescriptor* interfaceDescriptor = iface->InterfaceDescriptor(header);
 
     if (!interfaceDescriptor)
         return;
 
     // The number of maximum methods is not arbitrary. It is the same value as
     // in xpcom/reflect/xptcall/genstubs.pl; do not change this value
     // without changing that one or you WILL see problems.
-    if (interfaceDescriptor->num_methods > 250 &&
+    if (interfaceDescriptor->mNumMethods > 250 &&
             !interfaceDescriptor->IsBuiltinClass()) {
         NS_ASSERTION(0, "Too many methods to handle for the stub, cannot load");
         fprintf(stderr, "ignoring too large interface: %s\n", name);
         return;
     }
 
     mWorkingSet.mTableReentrantMonitor.AssertCurrentThreadIn();
     xptiInterfaceEntry* entry = mWorkingSet.mIIDTable.Get(iface->mIID);
--- a/xpcom/typelib/xpt/xpt_struct.h
+++ b/xpcom/typelib/xpt/xpt_struct.h
@@ -47,34 +47,34 @@ struct XPTInterfaceDirectoryEntry {
  * its methods.
  */
 struct XPTInterfaceDescriptor {
   static const uint8_t kScriptableMask =                0x80;
   static const uint8_t kFunctionMask =                  0x40;
   static const uint8_t kBuiltinClassMask =              0x20;
   static const uint8_t kMainProcessScriptableOnlyMask = 0x10;
 
-  bool IsScriptable() const { return !!(flags & kScriptableMask); }
-  bool IsFunction() const { return !!(flags & kFunctionMask); }
-  bool IsBuiltinClass() const { return !!(flags & kBuiltinClassMask); }
-  bool IsMainProcessScriptableOnly() const { return !!(flags & kMainProcessScriptableOnlyMask); }
+  bool IsScriptable() const { return !!(mFlags & kScriptableMask); }
+  bool IsFunction() const { return !!(mFlags & kFunctionMask); }
+  bool IsBuiltinClass() const { return !!(mFlags & kBuiltinClassMask); }
+  bool IsMainProcessScriptableOnly() const { return !!(mFlags & kMainProcessScriptableOnlyMask); }
 
   inline const XPTMethodDescriptor& Method(const XPTHeader* aHeader, size_t aIndex) const;
   inline const XPTConstDescriptor& Const(const XPTHeader* aHeader, size_t aIndex) const;
 
   /*
    * This field ordering minimizes the size of this struct.
    */
-  const XPTMethodDescriptor* method_descriptors;
-  const XPTConstDescriptor* const_descriptors;
+  const XPTMethodDescriptor* mMethodDescriptors;
+  const XPTConstDescriptor* mConstDescriptors;
   const XPTTypeDescriptor* additional_types;
-  uint16_t parent_interface;
-  uint16_t num_methods;
-  uint16_t num_constants;
-  uint8_t flags;
+  uint16_t mParentInterface;
+  uint16_t mNumMethods;
+  uint16_t mNumConstants;
+  uint8_t mFlags;
   uint8_t num_additional_types;
 };
 
 /*
  * A TypeDescriptor is a union used to identify the type of a method
  * argument or return value.
  *
  * There are three types of TypeDescriptors:
@@ -226,17 +226,17 @@ XPTInterfaceDirectoryEntry::Name(const X
 
 const XPTInterfaceDescriptor*
 XPTInterfaceDirectoryEntry::InterfaceDescriptor(const XPTHeader* aHeader) const {
   return mInterfaceDescriptor;
 }
 
 const XPTMethodDescriptor&
 XPTInterfaceDescriptor::Method(const XPTHeader* aHeader, size_t aIndex) const {
-  return method_descriptors[aIndex];
+  return mMethodDescriptors[aIndex];
 }
 
 const XPTConstDescriptor&
 XPTInterfaceDescriptor::Const(const XPTHeader* aHeader, size_t aIndex) const {
-  return const_descriptors[aIndex];
+  return mConstDescriptors[aIndex];
 }
 
 #endif /* xpt_struct_h */