Bug 926081 - Move stuff from xpcpublic.h to xpcprivate.h. r=bholley

This commit is contained in:
Andrew McCreight 2013-10-17 09:02:20 -07:00
parent 66fbf0f582
commit 74a3bafe4a
2 changed files with 51 additions and 50 deletions

View File

@ -277,6 +277,18 @@ extern const char XPC_XPCONNECT_CONTRACTID[];
// JS engine never uses that slot. This still needs fixing though. See bug 760095.
#define WN_XRAYEXPANDOCHAIN_SLOT 0
// If IS_WN_CLASS for the JSClass of an object is true, the object is a
// wrappednative wrapper, holding the XPCWrappedNative in its private slot.
static inline bool IS_WN_CLASS(const js::Class* clazz)
{
return clazz->ext.isWrappedNative;
}
static inline bool IS_WN_REFLECTOR(JSObject *obj)
{
return IS_WN_CLASS(js::GetObjectClass(obj));
}
inline void SetWNExpandoChain(JSObject *obj, JSObject *chain)
{
MOZ_ASSERT(IS_WN_REFLECTOR(obj));
@ -2169,6 +2181,9 @@ private:
void *xpc_GetJSPrivate(JSObject *obj);
void
TraceXPCGlobal(JSTracer *trc, JSObject *obj);
/***************************************************************************/
// XPCWrappedNative the wrapper around one instance of a native xpcom object
// to be used from JavaScript.
@ -3820,8 +3835,43 @@ bool IsOutObject(JSContext* cx, JSObject* obj);
nsresult HasInstance(JSContext *cx, JS::HandleObject objArg, const nsID *iid, bool *bp);
/**
* Define quick stubs on the given object, @a proto.
*
* @param cx
* A context. Requires request.
* @param proto
* The (newly created) prototype object for a DOM class. The JS half
* of an XPCWrappedNativeProto.
* @param flags
* Property flags for the quick stub properties--should be either
* JSPROP_ENUMERATE or 0.
* @param interfaceCount
* The number of interfaces the class implements.
* @param interfaceArray
* The interfaces the class implements; interfaceArray and
* interfaceCount are like what nsIClassInfo.getInterfaces returns.
*/
bool
DOM_DefineQuickStubs(JSContext *cx, JSObject *proto, uint32_t flags,
uint32_t interfaceCount, const nsIID **interfaceArray);
nsIPrincipal *GetObjectPrincipal(JSObject *obj);
} // namespace xpc
namespace mozilla {
namespace dom {
extern bool
DefineStaticJSVals(JSContext *cx);
} // namespace dom
} // namespace mozilla
NS_EXPORT_(bool)
xpc_LocalizeRuntime(JSRuntime *rt);
NS_EXPORT_(void)
xpc_DelocalizeRuntime(JSRuntime *rt);
/***************************************************************************/
// Inlines use the above - include last.

View File

@ -22,13 +22,12 @@
#include "mozilla/dom/JSSlots.h"
#include "nsMathUtils.h"
#include "nsStringBuffer.h"
#include "nsIGlobalObject.h"
#include "mozilla/dom/BindingDeclarations.h"
class nsIPrincipal;
class nsIXPConnectWrappedJS;
class nsScriptNameSpaceManager;
class nsIGlobalObject;
class nsIMemoryReporterCallback;
#ifndef BAD_TLS_INDEX
#define BAD_TLS_INDEX ((uint32_t) -1)
@ -77,27 +76,6 @@ struct RuntimeStats;
#define XPCONNECT_GLOBAL_FLAGS XPCONNECT_GLOBAL_FLAGS_WITH_EXTRA_SLOTS(0)
void
TraceXPCGlobal(JSTracer *trc, JSObject *obj);
// XXX These should be moved into XPCJSRuntime!
NS_EXPORT_(bool)
xpc_LocalizeRuntime(JSRuntime *rt);
NS_EXPORT_(void)
xpc_DelocalizeRuntime(JSRuntime *rt);
// If IS_WN_CLASS for the JSClass of an object is true, the object is a
// wrappednative wrapper, holding the XPCWrappedNative in its private slot.
static inline bool IS_WN_CLASS(const js::Class* clazz)
{
return clazz->ext.isWrappedNative;
}
static inline bool IS_WN_REFLECTOR(JSObject *obj)
{
return IS_WN_CLASS(js::GetObjectClass(obj));
}
extern bool
xpc_OkToHandOutWrapper(nsWrapperCache *cache);
@ -158,8 +136,6 @@ xpc_UnmarkSkippableJSHolders();
NS_EXPORT_(void)
xpc_ActivateDebugMode();
class nsIMemoryReporterCallback;
// readable string conversions, static methods and members only
class XPCStringConvert
{
@ -288,35 +264,12 @@ bool StringToJsval(JSContext* cx, mozilla::dom::DOMString& str,
}
nsIPrincipal *GetCompartmentPrincipal(JSCompartment *compartment);
nsIPrincipal *GetObjectPrincipal(JSObject *obj);
bool IsXBLScope(JSCompartment *compartment);
void SetLocationForGlobal(JSObject *global, const nsACString& location);
void SetLocationForGlobal(JSObject *global, nsIURI *locationURI);
/**
* Define quick stubs on the given object, @a proto.
*
* @param cx
* A context. Requires request.
* @param proto
* The (newly created) prototype object for a DOM class. The JS half
* of an XPCWrappedNativeProto.
* @param flags
* Property flags for the quick stub properties--should be either
* JSPROP_ENUMERATE or 0.
* @param interfaceCount
* The number of interfaces the class implements.
* @param interfaceArray
* The interfaces the class implements; interfaceArray and
* interfaceCount are like what nsIClassInfo.getInterfaces returns.
*/
bool
DOM_DefineQuickStubs(JSContext *cx, JSObject *proto, uint32_t flags,
uint32_t interfaceCount, const nsIID **interfaceArray);
// ReportJSRuntimeExplicitTreeStats will expect this in the |extra| member
// of JS::ZoneStats.
class ZoneStatsExtras {
@ -427,8 +380,6 @@ typedef JSObject*
typedef bool
(ConstructorEnabled)(JSContext* cx, JS::Handle<JSObject*> obj);
extern bool
DefineStaticJSVals(JSContext *cx);
void
Register(nsScriptNameSpaceManager* aNameSpaceManager);