Bug 677079 - Part y: Move AutoIdVector to jsapi.h; r=evilpie
authorMs2ger <ms2ger@gmail.com>
Sun, 15 Jan 2012 09:13:11 +0100
changeset 85702 9ee7f65718423e5a684602699295933a08624fdf
parent 85701 4b70a75df702f70bede9cf47005a4ed2039c5391
child 85703 cf1294a14a4c97a3ed2dd1da1ceca715a0d926df
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs677079
milestone12.0a1
Bug 677079 - Part y: Move AutoIdVector to jsapi.h; r=evilpie
js/src/jsapi.h
js/src/jsclass.h
js/src/jscntxt.h
js/src/jsgc.h
js/xpconnect/src/dombindings.cpp
js/xpconnect/src/dombindings.h
js/xpconnect/wrappers/FilteringWrapper.cpp
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -51,16 +51,17 @@
 #include "js-config.h"
 #include "jspubtd.h"
 #include "jsutil.h"
 #include "jsval.h"
 
 #include "js/Utility.h"
 
 #ifdef __cplusplus
+#include "jsalloc.h"
 #include "js/Vector.h"
 #include "mozilla/Attributes.h"
 #endif
 
 /************************************************************************/
 
 /* JS::Value can store a full int32_t. */
 #define JSVAL_INT_BITS          32
@@ -1114,16 +1115,29 @@ class AutoValueVector : public AutoVecto
         : AutoVectorRooter<Value>(cx, VALVECTOR)
     {
         JS_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     JS_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
+class AutoIdVector : public AutoVectorRooter<jsid>
+{
+  public:
+    explicit AutoIdVector(JSContext *cx
+                          JS_GUARD_OBJECT_NOTIFIER_PARAM)
+        : AutoVectorRooter<jsid>(cx, IDVECTOR)
+    {
+        JS_GUARD_OBJECT_NOTIFIER_INIT;
+    }
+
+    JS_DECL_USE_GUARD_OBJECT_NOTIFIER
+};
+
 }  /* namespace JS */
 
 /************************************************************************/
 
 /*
  * JS::Value and jsval are the same type; jsval is the old name, kept around
  * for backwards compatibility along with all the JSVAL_* operations below.
  * jsval_layout is an implementation detail and should not be used externally.
--- a/js/src/jsclass.h
+++ b/js/src/jsclass.h
@@ -47,17 +47,16 @@
  */
 #include "jsapi.h"
 #include "jsprvtd.h"
 
 #ifdef __cplusplus
 
 namespace js {
 
-class AutoIdVector;
 class PropertyName;
 class SpecialId;
 
 static JS_ALWAYS_INLINE jsid
 SPECIALID_TO_JSID(const SpecialId &sid);
 
 /*
  * We partition the ways to refer to a property into three: by an index
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -2081,29 +2081,16 @@ class AutoObjectVector : public AutoVect
         : AutoVectorRooter<JSObject *>(cx, OBJVECTOR)
     {
         JS_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     JS_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
-class AutoIdVector : public AutoVectorRooter<jsid>
-{
-  public:
-    explicit AutoIdVector(JSContext *cx
-                          JS_GUARD_OBJECT_NOTIFIER_PARAM)
-        : AutoVectorRooter<jsid>(cx, IDVECTOR)
-    {
-        JS_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-
-    JS_DECL_USE_GUARD_OBJECT_NOTIFIER
-};
-
 class AutoShapeVector : public AutoVectorRooter<const Shape *>
 {
   public:
     explicit AutoShapeVector(JSContext *cx
                              JS_GUARD_OBJECT_NOTIFIER_PARAM)
         : AutoVectorRooter<const Shape *>(cx, SHAPEVECTOR)
     {
         JS_GUARD_OBJECT_NOTIFIER_INIT;
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -1305,18 +1305,16 @@ struct WrapperHasher
         return uint32_t(bits) ^ uint32_t(bits >> 32);
     }
 
     static bool match(const Value &l, const Value &k) { return l == k; }
 };
 
 typedef HashMap<Value, Value, WrapperHasher, SystemAllocPolicy> WrapperMap;
 
-class AutoIdVector;
-
 } /* namespace js */
 
 #ifdef DEBUG
 extern bool
 CheckAllocation(JSContext *cx);
 #endif
 
 extern JS_FRIEND_API(JSGCTraceKind)
--- a/js/xpconnect/src/dombindings.cpp
+++ b/js/xpconnect/src/dombindings.cpp
@@ -45,21 +45,19 @@
 #include "XPCQuickStubs.h"
 #include "XPCWrapper.h"
 #include "WrapperFactory.h"
 #include "nsDOMClassInfo.h"
 #include "nsGlobalWindow.h"
 #include "nsWrapperCacheInlines.h"
 
 #include "jsapi.h"
-
-#include "jscntxt.h" // js::AutoIdVector
+#include "jsatom.h"
 
 using namespace JS;
-using js::AutoIdVector;
 
 namespace mozilla {
 namespace dom {
 namespace binding {
 
 
 static jsid s_constructor_id = JSID_VOID;
 static jsid s_prototype_id = JSID_VOID;
@@ -737,17 +735,17 @@ ListBase<LC>::getOwnPropertyNames(JSCont
     JS_ASSERT(int32_t(length) >= 0);
     for (int32_t i = 0; i < int32_t(length); ++i) {
         if (!props.append(INT_TO_JSID(i)))
             return false;
     }
 
     JSObject *expando;
     if (!xpc::WrapperFactory::IsXrayWrapper(proxy) && (expando = getExpandoObject(proxy)) &&
-        !GetPropertyNames(cx, expando, JSITER_OWNONLY | JSITER_HIDDEN, &props))
+        !js::GetPropertyNames(cx, expando, JSITER_OWNONLY | JSITER_HIDDEN, &props))
         return false;
 
     // FIXME: Add named items
     return true;
 }
 
 template<class LC>
 bool
--- a/js/xpconnect/src/dombindings.h
+++ b/js/xpconnect/src/dombindings.h
@@ -213,29 +213,29 @@ public:
     static JSObject *getPrototype(JSContext *cx, XPCWrappedNativeScope *scope, bool *enabled);
 
     bool getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set,
                                JSPropertyDescriptor *desc);
     bool getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool set,
                                   JSPropertyDescriptor *desc);
     bool defineProperty(JSContext *cx, JSObject *proxy, jsid id,
                         JSPropertyDescriptor *desc);
-    bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, js::AutoIdVector &props);
+    bool getOwnPropertyNames(JSContext *cx, JSObject *proxy, JS::AutoIdVector &props);
     bool delete_(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
-    bool enumerate(JSContext *cx, JSObject *proxy, js::AutoIdVector &props);
+    bool enumerate(JSContext *cx, JSObject *proxy, JS::AutoIdVector &props);
     bool fix(JSContext *cx, JSObject *proxy, JS::Value *vp);
 
     bool has(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
     bool hasOwn(JSContext *cx, JSObject *proxy, jsid id, bool *bp);
     bool get(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, JS::Value *vp);
     bool getElementIfPresent(JSContext *cx, JSObject *proxy, JSObject *receiver,
                              uint32_t index, JS::Value *vp, bool *present);
     bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict,
              JS::Value *vp);
-    bool keys(JSContext *cx, JSObject *proxy, js::AutoIdVector &props);
+    bool keys(JSContext *cx, JSObject *proxy, JS::AutoIdVector &props);
     bool iterate(JSContext *cx, JSObject *proxy, uintN flags, JS::Value *vp);
 
     /* Spidermonkey extensions. */
     bool hasInstance(JSContext *cx, JSObject *proxy, const JS::Value *vp, bool *bp);
     JSString *obj_toString(JSContext *cx, JSObject *proxy);
     void finalize(JSContext *cx, JSObject *proxy);
 
     static bool proxyHandlerIsList(js::ProxyHandler *handler) {
--- a/js/xpconnect/wrappers/FilteringWrapper.cpp
+++ b/js/xpconnect/wrappers/FilteringWrapper.cpp
@@ -41,17 +41,17 @@
 #include "FilteringWrapper.h"
 #include "AccessCheck.h"
 #include "CrossOriginWrapper.h"
 #include "XrayWrapper.h"
 #include "WrapperFactory.h"
 
 #include "XPCWrapper.h"
 
-#include "jscntxt.h" // js::AutoIdVector
+#include "jsapi.h"
 
 using namespace js;
 
 namespace xpc {
 
 template <typename Base, typename Policy>
 FilteringWrapper<Base, Policy>::FilteringWrapper(uintN flags) : Base(flags)
 {
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -44,17 +44,17 @@
 #include "WrapperFactory.h"
 
 #include "nsINode.h"
 #include "nsIDocument.h"
 
 #include "XPCWrapper.h"
 #include "xpcprivate.h"
 
-#include "jscntxt.h" // js::AutoIdVector
+#include "jsapi.h"
 
 namespace xpc {
 
 using namespace js;
 
 static const uint32_t JSSLOT_WN = 0;
 static const uint32_t JSSLOT_RESOLVING = 1;
 static const uint32_t JSSLOT_EXPANDO = 2;
@@ -829,17 +829,17 @@ XrayWrapper<Base>::defineProperty(JSCont
     if (!expando)
         return false;
 
     return JS_DefinePropertyById(cx, expando, id, jsdesc->value, jsdesc->getter, jsdesc->setter,
                                  jsdesc->attrs);
 }
 
 static bool
-EnumerateNames(JSContext *cx, JSObject *wrapper, uintN flags, js::AutoIdVector &props)
+EnumerateNames(JSContext *cx, JSObject *wrapper, uintN flags, JS::AutoIdVector &props)
 {
     JSObject *holder = GetHolder(wrapper);
 
     JSObject *wnObject = GetWrappedNativeObjectFromHolder(holder);
 
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
         JSAutoEnterCompartment ac;
@@ -855,17 +855,17 @@ EnumerateNames(JSContext *cx, JSObject *
     }
 
     // Enumerate expando properties first.
     JSObject *expando = GetExpandoObject(holder);
     if (expando && !js::GetPropertyNames(cx, expando, flags, &props))
         return false;
 
     // Force all native properties to be materialized onto the wrapped native.
-    js::AutoIdVector wnProps(cx);
+    JS::AutoIdVector wnProps(cx);
     {
         JSAutoEnterCompartment ac;
         if (!ac.enter(cx, wnObject))
             return false;
         if (!js::GetPropertyNames(cx, wnObject, flags, &wnProps))
             return false;
     }
 
@@ -879,17 +879,17 @@ EnumerateNames(JSContext *cx, JSObject *
             props.append(id);
     }
     return true;
 }
 
 template <typename Base>
 bool
 XrayWrapper<Base>::getOwnPropertyNames(JSContext *cx, JSObject *wrapper,
-                                       js::AutoIdVector &props)
+                                       JS::AutoIdVector &props)
 {
     return EnumerateNames(cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN, props);
 }
 
 template <typename Base>
 bool
 XrayWrapper<Base>::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
 {
@@ -920,17 +920,17 @@ XrayWrapper<Base>::delete_(JSContext *cx
     }
 
     *bp = !!b;
     return true;
 }
 
 template <typename Base>
 bool
-XrayWrapper<Base>::enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props)
+XrayWrapper<Base>::enumerate(JSContext *cx, JSObject *wrapper, JS::AutoIdVector &props)
 {
     return EnumerateNames(cx, wrapper, 0, props);
 }
 
 template <typename Base>
 bool
 XrayWrapper<Base>::fix(JSContext *cx, JSObject *proxy, js::Value *vp)
 {
@@ -973,17 +973,17 @@ bool
 XrayWrapper<Base>::hasOwn(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
 {
     // Skip our Base if it isn't already ProxyHandler.
     return ProxyHandler::hasOwn(cx, wrapper, id, bp);
 }
 
 template <typename Base>
 bool
-XrayWrapper<Base>::keys(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props)
+XrayWrapper<Base>::keys(JSContext *cx, JSObject *wrapper, JS::AutoIdVector &props)
 {
     // Skip our Base if it isn't already ProxyHandler.
     return ProxyHandler::keys(cx, wrapper, props);
 }
 
 template <typename Base>
 bool
 XrayWrapper<Base>::iterate(JSContext *cx, JSObject *wrapper, uintN flags, js::Value *vp)
@@ -1253,17 +1253,17 @@ XrayProxy::defineProperty(JSContext *cx,
     if (existing_desc.obj && (existing_desc.attrs & JSPROP_PERMANENT))
         return true; // silently ignore attempt to overwrite native property
 
     return JS_DefinePropertyById(cx, holder, id, desc->value, desc->getter, desc->setter,
                                  desc->attrs);
 }
 
 static bool
-EnumerateProxyNames(JSContext *cx, JSObject *wrapper, uintN flags, js::AutoIdVector &props)
+EnumerateProxyNames(JSContext *cx, JSObject *wrapper, uintN flags, JS::AutoIdVector &props)
 {
     JSObject *obj = &js::GetProxyPrivate(wrapper).toObject();
 
     // Redirect access straight to the wrapper if we should be transparent.
     if (XrayUtils::IsTransparent(cx, wrapper)) {
         JSAutoEnterCompartment ac;
         if (!ac.enter(cx, obj))
             return false;
@@ -1278,17 +1278,17 @@ EnumerateProxyNames(JSContext *cx, JSObj
 
     if (flags & (JSITER_OWNONLY | JSITER_HIDDEN))
         return js::GetProxyHandler(obj)->getOwnPropertyNames(cx, wrapper, props);
 
     return js::GetProxyHandler(obj)->enumerate(cx, wrapper, props);
 }
 
 bool
-XrayProxy::getOwnPropertyNames(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props)
+XrayProxy::getOwnPropertyNames(JSContext *cx, JSObject *wrapper, JS::AutoIdVector &props)
 {
     return EnumerateProxyNames(cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN, props);
 }
 
 bool
 XrayProxy::delete_(JSContext *cx, JSObject *wrapper, jsid id, bool *bp)
 {
     JSObject *obj = &js::GetProxyPrivate(wrapper).toObject();
@@ -1313,17 +1313,17 @@ XrayProxy::delete_(JSContext *cx, JSObje
     JSObject *holder;
     if (*bp && (holder = GetHolderObject(cx, wrapper, false)))
         JS_DeletePropertyById(cx, holder, id);
 
     return true;
 }
 
 bool
-XrayProxy::enumerate(JSContext *cx, JSObject *wrapper, js::AutoIdVector &props)
+XrayProxy::enumerate(JSContext *cx, JSObject *wrapper, JS::AutoIdVector &props)
 {
     return EnumerateProxyNames(cx, wrapper, 0, props);
 }
 
 XrayProxy
 XrayProxy::singleton(0);