2000-03-28 09:10:05 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-03-28 09:10:05 +04:00
|
|
|
|
|
|
|
/* Library-private header for Interface Info system. */
|
|
|
|
|
|
|
|
#ifndef xptiprivate_h___
|
|
|
|
#define xptiprivate_h___
|
|
|
|
|
|
|
|
#include "nscore.h"
|
2013-07-12 04:16:41 +04:00
|
|
|
#include <new>
|
2000-03-28 09:10:05 +04:00
|
|
|
#include "nsISupports.h"
|
|
|
|
|
|
|
|
// this after nsISupports, to pick up IID
|
|
|
|
// so that xpt stuff doesn't try to define it itself...
|
|
|
|
#include "xpt_struct.h"
|
|
|
|
#include "xpt_xdr.h"
|
|
|
|
|
|
|
|
#include "nsIInterfaceInfo.h"
|
|
|
|
#include "nsIInterfaceInfoManager.h"
|
|
|
|
#include "xptinfo.h"
|
2014-05-17 01:19:26 +04:00
|
|
|
#include "ShimInterfaceInfo.h"
|
2000-03-28 09:10:05 +04:00
|
|
|
|
|
|
|
#include "nsIServiceManager.h"
|
2012-06-06 06:08:30 +04:00
|
|
|
#include "nsIFile.h"
|
2000-04-25 09:01:05 +04:00
|
|
|
#include "nsIDirectoryService.h"
|
2000-08-17 05:20:02 +04:00
|
|
|
#include "nsDirectoryServiceDefs.h"
|
2001-10-18 08:23:25 +04:00
|
|
|
#include "nsAppDirectoryServiceDefs.h"
|
2002-02-03 03:56:16 +03:00
|
|
|
#include "nsIWeakReference.h"
|
2000-04-25 09:01:05 +04:00
|
|
|
|
2011-04-29 23:21:57 +04:00
|
|
|
#include "mozilla/ReentrantMonitor.h"
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-04-01 08:29:02 +04:00
|
|
|
#include "mozilla/Mutex.h"
|
2012-06-06 03:51:58 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-04-01 08:29:02 +04:00
|
|
|
|
2014-05-09 00:45:36 +04:00
|
|
|
#include "js/TypeDecls.h"
|
|
|
|
|
2000-04-25 09:01:05 +04:00
|
|
|
#include "nsCRT.h"
|
2000-06-03 13:46:12 +04:00
|
|
|
#include "nsMemory.h"
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2009-04-14 12:02:58 +04:00
|
|
|
#include "nsCOMArray.h"
|
2000-03-28 09:10:05 +04:00
|
|
|
#include "nsQuickSort.h"
|
2000-08-31 13:48:39 +04:00
|
|
|
|
2001-10-18 08:23:25 +04:00
|
|
|
#include "nsXPIDLString.h"
|
|
|
|
|
2000-05-15 02:46:24 +04:00
|
|
|
#include "nsIInputStream.h"
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2010-06-10 20:51:29 +04:00
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "nsDataHashtable.h"
|
2000-03-28 09:10:05 +04:00
|
|
|
#include "plstr.h"
|
|
|
|
#include "prprf.h"
|
2000-04-15 03:06:39 +04:00
|
|
|
#include "prio.h"
|
|
|
|
#include "prtime.h"
|
2000-08-17 05:20:02 +04:00
|
|
|
#include "prenv.h"
|
2000-03-28 09:10:05 +04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-04-15 03:06:39 +04:00
|
|
|
#if 0 && defined(DEBUG_jband)
|
|
|
|
#define LOG_RESOLVE(x) printf x
|
|
|
|
#define LOG_LOAD(x) printf x
|
|
|
|
#define LOG_AUTOREG(x) do{printf x; xptiInterfaceInfoManager::WriteToLog x;}while(0)
|
|
|
|
#else
|
|
|
|
#define LOG_RESOLVE(x) ((void)0)
|
|
|
|
#define LOG_LOAD(x) ((void)0)
|
2010-06-10 20:51:29 +04:00
|
|
|
#define LOG_AUTOREG(x) ((void)0)
|
2000-04-15 03:06:39 +04:00
|
|
|
#endif
|
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
#if 1 && defined(DEBUG_jband)
|
|
|
|
#define SHOW_INFO_COUNT_STATS
|
|
|
|
#endif
|
|
|
|
|
2000-04-15 03:06:39 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-03-28 09:10:05 +04:00
|
|
|
class xptiInterfaceInfo;
|
2002-01-11 02:49:47 +03:00
|
|
|
class xptiInterfaceEntry;
|
2000-03-28 09:10:05 +04:00
|
|
|
class xptiTypelibGuts;
|
|
|
|
|
2010-06-10 20:51:29 +04:00
|
|
|
extern XPTArena* gXPTIStructArena;
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2010-06-10 20:51:29 +04:00
|
|
|
/***************************************************************************/
|
2000-03-28 09:10:05 +04:00
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
// No virtuals.
|
|
|
|
// These are always constructed in the struct arena using placement new.
|
|
|
|
// dtor need not be called.
|
|
|
|
|
2000-03-28 09:10:05 +04:00
|
|
|
class xptiTypelibGuts
|
|
|
|
{
|
|
|
|
public:
|
2010-06-10 20:51:29 +04:00
|
|
|
static xptiTypelibGuts* Create(XPTHeader* aHeader);
|
2002-01-11 02:49:47 +03:00
|
|
|
|
|
|
|
XPTHeader* GetHeader() {return mHeader;}
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t GetEntryCount() const {return mHeader->num_interfaces;}
|
2002-01-11 02:49:47 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetEntryAt(uint16_t i, xptiInterfaceEntry* ptr)
|
2002-01-11 02:49:47 +03:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mHeader,"bad state!");
|
|
|
|
NS_ASSERTION(i < GetEntryCount(),"bad param!");
|
|
|
|
mEntryArray[i] = ptr;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
xptiInterfaceEntry* GetEntryAt(uint16_t i);
|
2014-05-17 00:48:29 +04:00
|
|
|
const char* GetEntryNameAt(uint16_t i);
|
2002-01-11 02:49:47 +03:00
|
|
|
|
|
|
|
private:
|
2014-08-05 17:21:27 +04:00
|
|
|
explicit xptiTypelibGuts(XPTHeader* aHeader)
|
2010-06-10 20:51:29 +04:00
|
|
|
: mHeader(aHeader)
|
|
|
|
{ }
|
|
|
|
~xptiTypelibGuts();
|
2000-03-28 09:10:05 +04:00
|
|
|
|
|
|
|
private:
|
2002-01-11 02:49:47 +03:00
|
|
|
XPTHeader* mHeader; // hold pointer into arena
|
|
|
|
xptiInterfaceEntry* mEntryArray[1]; // Always last. Sized to fit.
|
2000-03-28 09:10:05 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-04-15 03:06:39 +04:00
|
|
|
// This class exists to help xptiInterfaceInfo store a 4-state (2 bit) value
|
|
|
|
// and a set of bitflags in one 8bit value. See below.
|
|
|
|
|
|
|
|
class xptiInfoFlags
|
|
|
|
{
|
|
|
|
enum {STATE_MASK = 3};
|
|
|
|
public:
|
2014-08-05 17:21:27 +04:00
|
|
|
explicit xptiInfoFlags(uint8_t n) : mData(n) {}
|
2002-01-11 02:49:47 +03:00
|
|
|
xptiInfoFlags(const xptiInfoFlags& r) : mData(r.mData) {}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
static uint8_t GetStateMask()
|
|
|
|
{return uint8_t(STATE_MASK);}
|
2000-04-15 03:06:39 +04:00
|
|
|
|
|
|
|
void Clear()
|
|
|
|
{mData = 0;}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetData() const
|
2000-04-15 03:06:39 +04:00
|
|
|
{return mData;}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetState() const
|
2000-04-15 03:06:39 +04:00
|
|
|
{return mData & GetStateMask();}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetState(uint8_t state)
|
2000-04-15 03:06:39 +04:00
|
|
|
{mData &= ~GetStateMask(); mData |= state;}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetFlagBit(uint8_t flag, bool on)
|
2000-04-15 03:06:39 +04:00
|
|
|
{if(on)
|
|
|
|
mData |= ~GetStateMask() & flag;
|
|
|
|
else
|
|
|
|
mData &= GetStateMask() | ~flag;}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
bool GetFlagBit(uint8_t flag) const
|
2011-10-17 18:59:28 +04:00
|
|
|
{return (mData & flag) ? true : false;}
|
2000-04-15 03:06:39 +04:00
|
|
|
|
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t mData;
|
2000-04-15 03:06:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************/
|
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
// No virtual methods.
|
|
|
|
// We always create in the struct arena and construct using "placement new".
|
|
|
|
// No members need dtor calls.
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
class xptiInterfaceEntry
|
|
|
|
{
|
2000-03-28 09:10:05 +04:00
|
|
|
public:
|
2010-06-10 20:51:29 +04:00
|
|
|
static xptiInterfaceEntry* Create(const char* name,
|
|
|
|
const nsID& iid,
|
|
|
|
XPTInterfaceDescriptor* aDescriptor,
|
|
|
|
xptiTypelibGuts* aTypelib);
|
2000-04-15 03:06:39 +04:00
|
|
|
|
2000-03-28 09:10:05 +04:00
|
|
|
enum {
|
|
|
|
PARTIALLY_RESOLVED = 1,
|
|
|
|
FULLY_RESOLVED = 2,
|
|
|
|
RESOLVE_FAILED = 3
|
|
|
|
};
|
2000-04-15 03:06:39 +04:00
|
|
|
|
|
|
|
// Additional bit flags...
|
2015-03-06 19:34:08 +03:00
|
|
|
enum {SCRIPTABLE = 4, BUILTINCLASS = 8, HASNOTXPCOM = 16,
|
|
|
|
MAIN_PROCESS_SCRIPTABLE_ONLY = 32};
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t GetResolveState() const {return mFlags.GetState();}
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsFullyResolved() const
|
2012-08-22 19:56:38 +04:00
|
|
|
{return GetResolveState() == (uint8_t) FULLY_RESOLVED;}
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2015-03-06 19:34:08 +03:00
|
|
|
void SetScriptableFlag(bool on)
|
2012-08-22 19:56:38 +04:00
|
|
|
{mFlags.SetFlagBit(uint8_t(SCRIPTABLE),on);}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetScriptableFlag() const
|
2012-08-22 19:56:38 +04:00
|
|
|
{return mFlags.GetFlagBit(uint8_t(SCRIPTABLE));}
|
2015-03-06 19:34:08 +03:00
|
|
|
void SetBuiltinClassFlag(bool on)
|
2012-08-22 19:56:38 +04:00
|
|
|
{mFlags.SetFlagBit(uint8_t(BUILTINCLASS),on);}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetBuiltinClassFlag() const
|
2012-08-22 19:56:38 +04:00
|
|
|
{return mFlags.GetFlagBit(uint8_t(BUILTINCLASS));}
|
2015-03-06 19:34:08 +03:00
|
|
|
void SetMainProcessScriptableOnlyFlag(bool on)
|
|
|
|
{mFlags.SetFlagBit(uint8_t(MAIN_PROCESS_SCRIPTABLE_ONLY),on);}
|
|
|
|
bool GetMainProcessScriptableOnlyFlag() const
|
|
|
|
{return mFlags.GetFlagBit(uint8_t(MAIN_PROCESS_SCRIPTABLE_ONLY));}
|
2000-04-15 03:06:39 +04:00
|
|
|
|
2014-09-22 23:10:31 +04:00
|
|
|
|
|
|
|
// AddRef/Release are special and are not considered for the NOTXPCOM flag.
|
|
|
|
void SetHasNotXPCOMFlag()
|
|
|
|
{
|
|
|
|
mFlags.SetFlagBit(HASNOTXPCOM, true);
|
|
|
|
}
|
|
|
|
bool GetHasNotXPCOMFlag() const
|
|
|
|
{
|
|
|
|
return mFlags.GetFlagBit(HASNOTXPCOM);
|
|
|
|
}
|
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
const nsID* GetTheIID() const {return &mIID;}
|
2000-03-28 09:10:05 +04:00
|
|
|
const char* GetTheName() const {return mName;}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool EnsureResolved()
|
2011-10-17 18:59:28 +04:00
|
|
|
{return IsFullyResolved() ? true : Resolve();}
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2013-05-04 05:54:31 +04:00
|
|
|
already_AddRefed<xptiInterfaceInfo> InterfaceInfo();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool InterfaceInfoEquals(const xptiInterfaceInfo* info) const
|
2002-01-11 02:49:47 +03:00
|
|
|
{return info == mInfo;}
|
|
|
|
|
|
|
|
void LockedInvalidateInterfaceInfo();
|
2012-07-30 18:20:58 +04:00
|
|
|
void LockedInterfaceInfoDeathNotification() {mInfo = nullptr;}
|
2002-01-11 02:49:47 +03:00
|
|
|
|
2010-06-10 20:51:29 +04:00
|
|
|
xptiInterfaceEntry* Parent() const {
|
|
|
|
NS_ASSERTION(IsFullyResolved(), "Parent() called while not resolved?");
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsID& IID() const { return mIID; }
|
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
//////////////////////
|
|
|
|
// These non-virtual methods handle the delegated nsIInterfaceInfo methods.
|
|
|
|
|
|
|
|
nsresult GetName(char * *aName);
|
|
|
|
nsresult GetIID(nsIID * *aIID);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IsScriptable(bool *_retval);
|
|
|
|
nsresult IsBuiltinClass(bool *_retval) {
|
2011-06-16 23:21:25 +04:00
|
|
|
*_retval = GetBuiltinClassFlag();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-06 19:34:08 +03:00
|
|
|
nsresult IsMainProcessScriptableOnly(bool *_retval) {
|
|
|
|
*_retval = GetMainProcessScriptableOnlyFlag();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2002-01-11 02:49:47 +03:00
|
|
|
// Except this one.
|
|
|
|
//nsresult GetParent(nsIInterfaceInfo * *aParent);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetMethodCount(uint16_t *aMethodCount);
|
|
|
|
nsresult GetConstantCount(uint16_t *aConstantCount);
|
|
|
|
nsresult GetMethodInfo(uint16_t index, const nsXPTMethodInfo * *info);
|
|
|
|
nsresult GetMethodInfoForName(const char *methodName, uint16_t *index, const nsXPTMethodInfo * *info);
|
2014-05-09 00:45:36 +04:00
|
|
|
nsresult GetConstant(uint16_t index, JS::MutableHandleValue, char** constant);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetInfoForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIInterfaceInfo **_retval);
|
|
|
|
nsresult GetIIDForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID * *_retval);
|
|
|
|
nsresult GetTypeForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, nsXPTType *_retval);
|
|
|
|
nsresult GetSizeIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, uint8_t *_retval);
|
|
|
|
nsresult GetInterfaceIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint8_t *_retval);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IsIID(const nsIID * IID, bool *_retval);
|
2002-01-11 02:49:47 +03:00
|
|
|
nsresult GetNameShared(const char **name);
|
|
|
|
nsresult GetIIDShared(const nsIID * *iid);
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IsFunction(bool *_retval);
|
|
|
|
nsresult HasAncestor(const nsIID * iid, bool *_retval);
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid);
|
2002-01-11 02:49:47 +03:00
|
|
|
|
2000-03-28 09:10:05 +04:00
|
|
|
private:
|
2002-01-11 02:49:47 +03:00
|
|
|
xptiInterfaceEntry(const char* name,
|
|
|
|
size_t nameLength,
|
|
|
|
const nsID& iid,
|
2010-06-10 20:51:29 +04:00
|
|
|
XPTInterfaceDescriptor* aDescriptor,
|
|
|
|
xptiTypelibGuts* aTypelib);
|
2002-01-11 02:49:47 +03:00
|
|
|
~xptiInterfaceEntry();
|
|
|
|
|
2000-03-28 09:10:05 +04:00
|
|
|
void SetResolvedState(int state)
|
2012-08-22 19:56:38 +04:00
|
|
|
{mFlags.SetState(uint8_t(state));}
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool Resolve();
|
2000-04-19 01:33:46 +04:00
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
// We only call these "*Locked" variants after locking. This is done to
|
2000-04-19 01:33:46 +04:00
|
|
|
// allow reentrace as files are loaded and various interfaces resolved
|
|
|
|
// without having to worry about the locked state.
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool EnsureResolvedLocked()
|
2011-10-17 18:59:28 +04:00
|
|
|
{return IsFullyResolved() ? true : ResolveLocked();}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ResolveLocked();
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
// private helpers
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult GetEntryForParam(uint16_t methodIndex,
|
2002-01-11 02:49:47 +03:00
|
|
|
const nsXPTParamInfo * param,
|
|
|
|
xptiInterfaceEntry** entry);
|
|
|
|
|
|
|
|
nsresult GetTypeInArray(const nsXPTParamInfo* param,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t dimension,
|
2002-01-11 02:49:47 +03:00
|
|
|
const XPTTypeDescriptor** type);
|
2000-03-28 09:10:05 +04:00
|
|
|
|
2014-05-17 00:49:34 +04:00
|
|
|
nsresult GetInterfaceIndexForParam(uint16_t methodIndex,
|
|
|
|
const nsXPTParamInfo* param,
|
|
|
|
uint16_t* interfaceIndex);
|
|
|
|
|
2014-05-17 01:19:26 +04:00
|
|
|
already_AddRefed<ShimInterfaceInfo>
|
|
|
|
GetShimForParam(uint16_t methodIndex, const nsXPTParamInfo* param);
|
|
|
|
|
2002-01-11 02:49:47 +03:00
|
|
|
private:
|
2010-06-10 20:51:29 +04:00
|
|
|
nsID mIID;
|
|
|
|
XPTInterfaceDescriptor* mDescriptor;
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t mMethodBaseIndex;
|
|
|
|
uint16_t mConstantBaseIndex;
|
2010-06-10 20:51:29 +04:00
|
|
|
xptiTypelibGuts* mTypelib;
|
|
|
|
|
|
|
|
xptiInterfaceEntry* mParent; // Valid only when fully resolved
|
|
|
|
|
2015-01-18 04:40:29 +03:00
|
|
|
xptiInterfaceInfo* MOZ_UNSAFE_REF("The safety of this pointer is ensured "
|
|
|
|
"by the semantics of xptiWorkingSet.")
|
|
|
|
mInfo; // May come and go.
|
2002-01-11 02:49:47 +03:00
|
|
|
xptiInfoFlags mFlags;
|
|
|
|
char mName[1]; // Always last. Sized to fit.
|
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class xptiInterfaceInfo final : public nsIInterfaceInfo
|
2002-01-11 02:49:47 +03:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:31:26 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2002-01-11 02:49:47 +03:00
|
|
|
|
|
|
|
// Use delegation to implement (most!) of nsIInterfaceInfo.
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetName(char * *aName) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetName(aName); }
|
|
|
|
NS_IMETHOD GetInterfaceIID(nsIID * *aIID) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIID(aIID); }
|
|
|
|
NS_IMETHOD IsScriptable(bool *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsScriptable(_retval); }
|
|
|
|
NS_IMETHOD IsBuiltinClass(bool *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsBuiltinClass(_retval); }
|
2015-06-29 21:53:55 +03:00
|
|
|
NS_IMETHOD IsMainProcessScriptableOnly(bool *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsMainProcessScriptableOnly(_retval); }
|
2002-01-11 02:49:47 +03:00
|
|
|
// Except this one.
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetParent(nsIInterfaceInfo * *aParent) override
|
2002-01-11 02:49:47 +03:00
|
|
|
{
|
|
|
|
if(!EnsureResolved() || !EnsureParent())
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
NS_IF_ADDREF(*aParent = mParent);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-06-29 21:53:55 +03:00
|
|
|
NS_IMETHOD GetMethodCount(uint16_t *aMethodCount) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodCount(aMethodCount); }
|
|
|
|
NS_IMETHOD GetConstantCount(uint16_t *aConstantCount) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetConstantCount(aConstantCount); }
|
|
|
|
NS_IMETHOD GetMethodInfo(uint16_t index, const nsXPTMethodInfo * *info) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodInfo(index, info); }
|
|
|
|
NS_IMETHOD GetMethodInfoForName(const char *methodName, uint16_t *index, const nsXPTMethodInfo * *info) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodInfoForName(methodName, index, info); }
|
|
|
|
NS_IMETHOD GetConstant(uint16_t index, JS::MutableHandleValue constant, char** name) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetConstant(index, constant, name); }
|
|
|
|
NS_IMETHOD GetInfoForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIInterfaceInfo **_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInfoForParam(methodIndex, param, _retval); }
|
|
|
|
NS_IMETHOD GetIIDForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID * *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParam(methodIndex, param, _retval); }
|
|
|
|
NS_IMETHOD GetTypeForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, nsXPTType *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetTypeForParam(methodIndex, param, dimension, _retval); }
|
|
|
|
NS_IMETHOD GetSizeIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, uint8_t *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetSizeIsArgNumberForParam(methodIndex, param, dimension, _retval); }
|
|
|
|
NS_IMETHOD GetInterfaceIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint8_t *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInterfaceIsArgNumberForParam(methodIndex, param, _retval); }
|
|
|
|
NS_IMETHOD IsIID(const nsIID * IID, bool *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsIID(IID, _retval); }
|
|
|
|
NS_IMETHOD GetNameShared(const char **name) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetNameShared(name); }
|
|
|
|
NS_IMETHOD GetIIDShared(const nsIID * *iid) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDShared(iid); }
|
|
|
|
NS_IMETHOD IsFunction(bool *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsFunction(_retval); }
|
|
|
|
NS_IMETHOD HasAncestor(const nsIID * iid, bool *_retval) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->HasAncestor(iid, _retval); }
|
|
|
|
NS_IMETHOD GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid) override { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParamNoAlloc(methodIndex, param, iid); }
|
2002-01-11 02:49:47 +03:00
|
|
|
|
|
|
|
public:
|
2014-08-05 17:21:27 +04:00
|
|
|
explicit xptiInterfaceInfo(xptiInterfaceEntry* entry);
|
2002-01-11 02:49:47 +03:00
|
|
|
|
2015-01-18 04:40:29 +03:00
|
|
|
void Invalidate();
|
2002-01-11 02:49:47 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2004-01-15 09:14:18 +03:00
|
|
|
~xptiInterfaceInfo();
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
// Note that mParent might still end up as nullptr if we don't have one.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool EnsureParent()
|
2002-01-11 02:49:47 +03:00
|
|
|
{
|
|
|
|
NS_ASSERTION(mEntry && mEntry->IsFullyResolved(), "bad EnsureParent call");
|
2010-06-10 20:51:29 +04:00
|
|
|
return mParent || !mEntry->Parent() || BuildParent();
|
2002-01-11 02:49:47 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool EnsureResolved()
|
2002-01-11 02:49:47 +03:00
|
|
|
{
|
2010-06-10 20:51:29 +04:00
|
|
|
return mEntry && mEntry->EnsureResolved();
|
2002-01-11 02:49:47 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool BuildParent();
|
2002-01-11 02:49:47 +03:00
|
|
|
|
|
|
|
xptiInterfaceInfo(); // not implemented
|
|
|
|
|
|
|
|
private:
|
|
|
|
xptiInterfaceEntry* mEntry;
|
2015-01-18 04:40:29 +03:00
|
|
|
nsRefPtr<xptiInterfaceInfo> mParent;
|
2000-03-28 09:10:05 +04:00
|
|
|
};
|
|
|
|
|
2000-04-15 03:06:39 +04:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-03-28 09:10:05 +04:00
|
|
|
#endif /* xptiprivate_h___ */
|