Bug 738593 - Rename IsProxy to IsDOMBinding; r=mrbkap

This commit is contained in:
Peter Van der Beken 2012-03-16 16:44:09 +01:00
parent 679b93a7ba
commit 6fd0c1b877
23 changed files with 38 additions and 43 deletions

View File

@ -337,7 +337,7 @@ class nsDOMFileList MOZ_FINAL : public nsIDOMFileList,
public:
nsDOMFileList(nsISupports *aParent) : mParent(aParent)
{
SetIsProxy();
SetIsDOMBinding();
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS

View File

@ -86,8 +86,7 @@ class nsBaseContentList : public nsINodeList
public:
nsBaseContentList()
{
// Mark ourselves as a proxy
SetIsProxy();
SetIsDOMBinding();
}
virtual ~nsBaseContentList();

View File

@ -6616,7 +6616,7 @@ nsContentUtils::ReleaseWrapper(nsISupports* aScriptObjectHolder,
{
if (aCache->PreservingWrapper()) {
JSObject* obj = aCache->GetWrapperPreserveColor();
if (aCache->IsProxy()) {
if (aCache->IsDOMBinding()) {
JSCompartment *compartment = js::GetObjectCompartment(obj);
xpc::CompartmentPrivate *priv =
static_cast<xpc::CompartmentPrivate *>(JS_GetCompartmentPrivate(compartment));

View File

@ -53,7 +53,7 @@ nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
{
// We don't add a reference to our element. If it goes away,
// we'll be told to drop our reference
SetIsProxy();
SetIsDOMBinding();
}
nsDOMTokenList::~nsDOMTokenList() { }

View File

@ -100,7 +100,7 @@ public:
nsChildContentList(nsINode* aNode)
: mNode(aNode)
{
SetIsProxy();
SetIsDOMBinding();
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS

View File

@ -139,14 +139,14 @@ public:
nsDOMTouchList(nsISupports *aParent) : mParent(aParent)
{
SetIsProxy();
SetIsDOMBinding();
}
nsDOMTouchList(nsISupports *aParent,
nsTArray<nsCOMPtr<nsIDOMTouch> > &aTouches)
: mPoints(aTouches),
mParent(aParent)
{
SetIsProxy();
SetIsDOMBinding();
}
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,

View File

@ -68,7 +68,7 @@ class nsPaintRequestList MOZ_FINAL : public nsIDOMPaintRequestList,
public:
nsPaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
{
SetIsProxy();
SetIsDOMBinding();
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS

View File

@ -72,7 +72,7 @@ class nsClientRectList MOZ_FINAL : public nsIDOMClientRectList,
public:
nsClientRectList(nsISupports *aParent) : mParent(aParent)
{
SetIsProxy();
SetIsDOMBinding();
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS

View File

@ -2164,8 +2164,7 @@ nsFormControlList::nsFormControlList(nsHTMLFormElement* aForm) :
// of 8 to reduce allocations on small forms.
mElements(8)
{
// Mark ourselves as a proxy
SetIsProxy();
SetIsDOMBinding();
}
nsFormControlList::~nsFormControlList()

View File

@ -1966,7 +1966,7 @@ nsHTMLSelectElement::VerifyOptionsArray()
nsHTMLOptionCollection::nsHTMLOptionCollection(nsHTMLSelectElement* aSelect)
{
SetIsProxy();
SetIsDOMBinding();
// Do not maintain a reference counted reference. When
// the select goes away, it will let us know.

View File

@ -107,8 +107,7 @@ TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent)
nsGkAtoms::tr,
false))
{
// Mark ourselves as a proxy
SetIsProxy();
SetIsDOMBinding();
}
TableRowsCollection::~TableRowsCollection()

View File

@ -83,7 +83,7 @@ public:
const SVGLengthList &aInternalList)
: mAList(aAList)
{
SetIsProxy();
SetIsDOMBinding();
// aInternalList must be passed in explicitly because we can't use
// InternalList() here. (Because it depends on IsAnimValList, which depends

View File

@ -82,7 +82,7 @@ public:
const SVGNumberList &aInternalList)
: mAList(aAList)
{
SetIsProxy();
SetIsDOMBinding();
// aInternalList must be passed in explicitly because we can't use
// InternalList() here. (Because it depends on IsAnimValList, which depends

View File

@ -171,7 +171,7 @@ private:
: mElement(aElement)
, mIsAnimValList(aIsAnimValList)
{
SetIsProxy();
SetIsDOMBinding();
InternalListWillChangeTo(InternalList()); // Sync mItems
}

View File

@ -171,7 +171,7 @@ private:
: mElement(aElement)
, mIsAnimValList(aIsAnimValList)
{
SetIsProxy();
SetIsDOMBinding();
InternalListWillChangeTo(InternalList()); // Sync mItems
}

View File

@ -78,7 +78,7 @@ public:
const SVGTransformList &aInternalList)
: mAList(aAList)
{
SetIsProxy();
SetIsDOMBinding();
// aInternalList must be passed in explicitly because we can't use
// InternalList() here. (Because it depends on IsAnimValList, which depends

View File

@ -136,7 +136,7 @@ nsAnonymousContentList::nsAnonymousContentList(nsIContent *aContent,
// We don't reference count our Anonymous reference (to avoid circular
// references). We'll be told when the Anonymous goes away.
SetIsProxy();
SetIsDOMBinding();
}
nsAnonymousContentList::~nsAnonymousContentList()

View File

@ -936,7 +936,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
Freeze();
mObserver = nsnull;
SetIsProxy();
SetIsDOMBinding();
}
// We could have failed the first time through trying

View File

@ -68,10 +68,10 @@ typedef PRUptrdiff PtrBits;
*
* The cache can store 2 types of objects:
*
* If WRAPPER_IS_PROXY is not set (IsProxy() returns false):
* If WRAPPER_IS_DOM_BINDING is not set (IsDOMBinding() returns false):
* - a slim wrapper or the JSObject of an XPCWrappedNative wrapper
*
* If WRAPPER_IS_PROXY is set (IsProxy() returns true):
* If WRAPPER_IS_DOM_BINDING is set (IsDOMBinding() returns true):
* - a DOM binding object (proxy)
*
* The finalizer for the wrapper clears the cache.
@ -141,22 +141,22 @@ public:
return (mWrapperPtrBits & WRAPPER_BIT_PRESERVED) != 0;
}
void SetIsProxy()
void SetIsDOMBinding()
{
NS_ASSERTION(!mWrapperPtrBits,
"This flag should be set before creating any wrappers.");
mWrapperPtrBits = WRAPPER_IS_PROXY;
mWrapperPtrBits = WRAPPER_IS_DOM_BINDING;
}
void ClearIsProxy()
void ClearIsDOMBinding()
{
NS_ASSERTION(!mWrapperPtrBits || mWrapperPtrBits == WRAPPER_IS_PROXY,
NS_ASSERTION(!mWrapperPtrBits || mWrapperPtrBits == WRAPPER_IS_DOM_BINDING,
"This flag should be cleared before creating any wrappers.");
mWrapperPtrBits = 0;
}
bool IsProxy() const
bool IsDOMBinding() const
{
return (mWrapperPtrBits & WRAPPER_IS_PROXY) != 0;
return (mWrapperPtrBits & WRAPPER_IS_DOM_BINDING) != 0;
}
@ -199,7 +199,7 @@ private:
void SetWrapperBits(void *aWrapper)
{
mWrapperPtrBits = reinterpret_cast<PtrBits>(aWrapper) |
(mWrapperPtrBits & WRAPPER_IS_PROXY);
(mWrapperPtrBits & WRAPPER_IS_DOM_BINDING);
}
/**
@ -216,14 +216,12 @@ private:
enum { WRAPPER_BIT_PRESERVED = 1 << 0 };
/**
* If this bit is set then the wrapper for the native object is a proxy. Note
* that that doesn't necessarily mean that the JS object stored in the cache
* is a JS proxy, as we sometimes store objects other than the wrapper in the
* cache.
* If this bit is set then the wrapper for the native object is a DOM binding
* (proxy).
*/
enum { WRAPPER_IS_PROXY = 1 << 1 };
enum { WRAPPER_IS_DOM_BINDING = 1 << 1 };
enum { kWrapperBitMask = (WRAPPER_BIT_PRESERVED | WRAPPER_IS_PROXY) };
enum { kWrapperBitMask = (WRAPPER_BIT_PRESERVED | WRAPPER_IS_DOM_BINDING) };
PtrBits mWrapperPtrBits;
};

View File

@ -912,7 +912,7 @@ XPCConvert::NativeInterface2JSObject(XPCLazyCallContext& lccx,
JSObject *flat;
if (cache) {
flat = cache->GetWrapper();
if (cache->IsProxy()) {
if (cache->IsDOMBinding()) {
XPCCallContext &ccx = lccx.GetXPCCallContext();
if (!ccx.IsValid())
return false;

View File

@ -61,9 +61,9 @@ bool
xpc_OkToHandOutWrapper(nsWrapperCache *cache)
{
NS_ABORT_IF_FALSE(cache->GetWrapper(), "Must have wrapper");
NS_ABORT_IF_FALSE(cache->IsProxy() || IS_WN_WRAPPER(cache->GetWrapper()),
NS_ABORT_IF_FALSE(cache->IsDOMBinding() || IS_WN_WRAPPER(cache->GetWrapper()),
"Must have proxy or XPCWrappedNative wrapper");
return cache->IsProxy() ?
return cache->IsDOMBinding() ?
mozilla::dom::binding::instanceIsProxy(cache->GetWrapper()) :
!static_cast<XPCWrappedNative*>(xpc_GetJSPrivate(cache->GetWrapper()))->
NeedsSOW();

View File

@ -557,7 +557,7 @@ ListBase<LC>::create(JSContext *cx, JSObject *scope, ListType *aList,
XPCWrappedNativeScope::FindInJSObjectScope(cx, parent);
JSObject *proto = getPrototype(cx, xpcscope, triedToWrap);
if (!proto && !*triedToWrap)
aWrapperCache->ClearIsProxy();
aWrapperCache->ClearIsDOMBinding();
if (!proto)
return NULL;
JSObject *obj = NewProxyObject(cx, &ListBase<LC>::instance,

View File

@ -138,9 +138,9 @@ xpc_FastGetCachedWrapper(nsWrapperCache *cache, JSObject *scope, jsval *vp)
if (cache) {
JSObject* wrapper = cache->GetWrapper();
NS_ASSERTION(!wrapper ||
!cache->IsProxy() ||
!cache->IsDOMBinding() ||
!IS_SLIM_WRAPPER(wrapper),
"Should never have a slim wrapper when IsProxy()");
"Should never have a slim wrapper when IsDOMBinding()");
if (wrapper &&
js::GetObjectCompartment(wrapper) == js::GetObjectCompartment(scope) &&
(IS_SLIM_WRAPPER(wrapper) ||