Bug 1445073 - Pass XPTInterfaceDirectoryEntry into xptiInterfaceEntry::Create(). r=njn

Also, I set some flags in the ctor instead of later and I also removed
a comment which refers to SetHeader(), which does not exist any more.

MozReview-Commit-ID: 27mcRTnanrZ

--HG--
extra : rebase_source : ec87aed9fa46c2202b607cbcdb4c8347eaa50949
This commit is contained in:
Andrew McCreight 2018-03-12 11:17:48 -07:00
Родитель a51f109149
Коммит 47cc3bb70c
3 изменённых файлов: 12 добавлений и 26 удалений

Просмотреть файл

@ -16,33 +16,32 @@
using namespace mozilla;
/* static */ xptiInterfaceEntry*
xptiInterfaceEntry::Create(const char* aName,
const nsID& aIID,
const XPTInterfaceDescriptor* aDescriptor,
xptiInterfaceEntry::Create(const XPTInterfaceDirectoryEntry* aEntry,
xptiTypelibGuts* aTypelib)
{
void* place = XPT_CALLOC8(gXPTIStructArena, sizeof(xptiInterfaceEntry));
if (!place) {
return nullptr;
}
return new (place) xptiInterfaceEntry(aName, aIID, aDescriptor, aTypelib);
return new (place) xptiInterfaceEntry(aEntry, aTypelib);
}
xptiInterfaceEntry::xptiInterfaceEntry(const char* aName,
const nsID& aIID,
const XPTInterfaceDescriptor* aDescriptor,
xptiInterfaceEntry::xptiInterfaceEntry(const XPTInterfaceDirectoryEntry* aEntry,
xptiTypelibGuts* aTypelib)
: mIID(aIID)
, mDescriptor(aDescriptor)
: mIID(aEntry->mIID)
, mDescriptor(aEntry->mInterfaceDescriptor)
, mTypelib(aTypelib)
, mParent(nullptr)
, mInfo(nullptr)
, mMethodBaseIndex(0)
, mConstantBaseIndex(0)
, mFlags(0)
, mName(aName)
, mName(aEntry->mName)
{
SetResolvedState(PARTIALLY_RESOLVED);
SetScriptableFlag(mDescriptor->IsScriptable());
SetBuiltinClassFlag(mDescriptor->IsBuiltinClass());
SetMainProcessScriptableOnlyFlag(mDescriptor->IsMainProcessScriptableOnly());
}
bool

Просмотреть файл

@ -156,19 +156,10 @@ XPTInterfaceInfoManager::VerifyAndAddEntryIfNew(const XPTInterfaceDirectoryEntry
// Build a new xptiInterfaceEntry object and hook it up.
entry = xptiInterfaceEntry::Create(iface->mName,
iface->mIID,
iface->mInterfaceDescriptor,
typelib);
entry = xptiInterfaceEntry::Create(iface, typelib);
if (!entry)
return;
//XXX We should SetHeader too as part of the validation, no?
entry->SetScriptableFlag(iface->mInterfaceDescriptor->IsScriptable());
entry->SetBuiltinClassFlag(iface->mInterfaceDescriptor->IsBuiltinClass());
entry->SetMainProcessScriptableOnlyFlag(
iface->mInterfaceDescriptor->IsMainProcessScriptableOnly());
mWorkingSet.mIIDTable.Put(entry->IID(), entry);
mWorkingSet.mNameTable.Put(entry->GetTheName(), entry);

Просмотреть файл

@ -151,9 +151,7 @@ private:
class xptiInterfaceEntry
{
public:
static xptiInterfaceEntry* Create(const char* aName,
const nsID& aIID,
const XPTInterfaceDescriptor* aDescriptor,
static xptiInterfaceEntry* Create(const XPTInterfaceDirectoryEntry* aEntry,
xptiTypelibGuts* aTypelib);
enum {
@ -249,9 +247,7 @@ public:
nsresult GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid);
private:
xptiInterfaceEntry(const char* aName,
const nsID& aIID,
const XPTInterfaceDescriptor* aDescriptor,
xptiInterfaceEntry(const XPTInterfaceDirectoryEntry* aDescriptor,
xptiTypelibGuts* aTypelib);
~xptiInterfaceEntry();