Rename add/removeDebuggee -> add/removeDebuggeeGlobal, ahead of landing Debug.prototype.add/removeDebuggee.
authorJason Orendorff <jorendorff@mozilla.com>
Mon, 23 May 2011 14:27:10 -0500
changeset 74439 ce60250dbf2941870b24c330e7bbb087867481e7
parent 74438 b68e8118939f6b2acbe410e038d9d14dada44b06
child 74440 0c0dfc86796d2ea947f1caa8905fe0462deb0cd0
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone6.0a1
Rename add/removeDebuggee -> add/removeDebuggeeGlobal, ahead of landing Debug.prototype.add/removeDebuggee.
js/src/jsdbg.cpp
js/src/jsdbg.h
--- a/js/src/jsdbg.cpp
+++ b/js/src/jsdbg.cpp
@@ -149,17 +149,17 @@ Debug::Debug(JSObject *dbg, JSObject *ho
 Debug::~Debug()
 {
     JS_ASSERT(object->compartment()->rt->gcRunning);
     if (!debuggees.empty()) {
         // This happens only during per-compartment GC. See comment in
         // Debug::sweepAll.
         JS_ASSERT(object->compartment()->rt->gcCurrentCompartment == object->compartment());
         for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront())
-            removeDebuggee(e.front(), NULL, &e);
+            removeDebuggeeGlobal(e.front(), NULL, &e);
     }
 
     // This always happens in the GC thread, so no locking is required.
     JS_REMOVE_LINK(&link);
 }
 
 bool
 Debug::init(JSContext *cx)
@@ -225,17 +225,17 @@ Debug::getScriptFrame(JSContext *cx, Sta
 
 void
 Debug::slowPathLeaveStackFrame(JSContext *cx)
 {
     StackFrame *fp = cx->fp();
     GlobalObject *global = fp->scopeChain().getGlobal();
 
     // FIXME This notifies only current debuggers, so it relies on a hack in
-    // Debug::removeDebuggee to make sure only current debuggers have
+    // Debug::removeDebuggeeGlobal to make sure only current debuggers have
     // Frame objects with .live === true.
     if (GlobalObject::DebugVector *debuggers = global->getDebuggers()) {
         for (Debug **p = debuggers->begin(); p != debuggers->end(); p++) {
             Debug *dbg = *p;
             if (FrameMap::Ptr p = dbg->frames.lookup(fp)) {
                 JSObject *frameobj = p->value;
                 frameobj->setPrivate(NULL);
                 dbg->frames.remove(p);
@@ -613,17 +613,17 @@ Debug::sweepAll(JSRuntime *rt)
         // If this Debug is being GC'd, detach it from its debuggees.  In the
         // case of runtime-wide GC, the debuggee might be GC'd too. Since
         // detaching requires access to both objects, this must be done before
         // finalize time. However, in a per-compartment GC, it is impossible
         // for both objects to be GC'd (since they are in different
         // compartments), so in that case we just wait for Debug::finalize.
         if (!dbg->object->isMarked()) {
             for (GlobalObjectSet::Enum e(dbg->debuggees); !e.empty(); e.popFront())
-                dbg->removeDebuggee(e.front(), NULL, &e);
+                dbg->removeDebuggeeGlobal(e.front(), NULL, &e);
         }
 
         // Sweep ObjectMap entries for referents being collected.
         for (ObjectMap::Enum e(dbg->objects); !e.empty(); e.popFront()) {
             JS_ASSERT(e.front().key->isMarked() == e.front().value->isMarked());
             if (!e.front().value->isMarked())
                 e.removeFront();
         }
@@ -634,17 +634,17 @@ Debug::sweepAll(JSRuntime *rt)
 }
 
 void
 Debug::detachAllDebuggersFromGlobal(GlobalObject *global, GlobalObjectSet::Enum *compartmentEnum)
 {
     const GlobalObject::DebugVector *debuggers = global->getDebuggers();
     JS_ASSERT(!debuggers->empty());
     while (!debuggers->empty())
-        debuggers->back()->removeDebuggee(global, compartmentEnum, NULL);
+        debuggers->back()->removeDebuggeeGlobal(global, compartmentEnum, NULL);
 }
 
 void
 Debug::sweepCompartment(JSCompartment *compartment)
 {
     // For each debuggee being GC'd, detach it from all its debuggers.
     GlobalObjectSet &debuggees = compartment->getDebuggees();
     for (GlobalObjectSet::Enum e(debuggees); !e.empty(); e.popFront()) {
@@ -811,26 +811,26 @@ Debug::construct(JSContext *cx, uintN ar
     JSObject *hooks = NewBuiltinClassInstance(cx, &js_ObjectClass);
     if (!hooks)
         return false;
 
     Debug *dbg = cx->new_<Debug>(obj, hooks);
     if (!dbg)
         return false;
     obj->setPrivate(dbg);
-    if (!dbg->init(cx) || !dbg->addDebuggee(cx, debuggee)) {
+    if (!dbg->init(cx) || !dbg->addDebuggeeGlobal(cx, debuggee)) {
         cx->delete_(dbg);
         return false;
     }
     vp->setObject(*obj);
     return true;
 }
 
 bool
-Debug::addDebuggee(JSContext *cx, GlobalObject *obj)
+Debug::addDebuggeeGlobal(JSContext *cx, GlobalObject *obj)
 {
     // Each debugger-debuggee relation must be stored in up to three places.
     GlobalObject::DebugVector *v = obj->getOrCreateDebuggers(cx);
     if (!v || !v->append(this))
         goto fail1;
     if (!debuggees.put(obj))
         goto fail2;
     if (obj->getDebuggers()->length() == 1 && !obj->compartment()->addDebuggee(obj))
@@ -844,18 +844,18 @@ fail2:
     JS_ASSERT(v->back() == this);
     v->popBack();
 fail1:
     js_ReportOutOfMemory(cx);
     return false;
 }
 
 void
-Debug::removeDebuggee(GlobalObject *global, GlobalObjectSet::Enum *compartmentEnum,
-                      GlobalObjectSet::Enum *debugEnum)
+Debug::removeDebuggeeGlobal(GlobalObject *global, GlobalObjectSet::Enum *compartmentEnum,
+                            GlobalObjectSet::Enum *debugEnum)
 {
     // Each debuggee is in two HashSets: one for its compartment and one for
     // its debugger (this). The caller might be enumerating either set; if so,
     // use HashSet::Enum::removeFront rather than HashSet::remove below, to
     // avoid invalidating the live enumerator.
     JS_ASSERT(global->compartment()->getDebuggees().has(global));
     JS_ASSERT_IF(compartmentEnum, compartmentEnum->front() == global);
     JS_ASSERT(debuggees.has(global));
--- a/js/src/jsdbg.h
+++ b/js/src/jsdbg.h
@@ -76,19 +76,19 @@ class Debug {
 
     // Keys are referents, values are Debug.Object objects. The combination of
     // the a key being live and this Debug being live keeps the corresponding
     // Debug.Object alive.
     typedef HashMap<JSObject *, JSObject *, DefaultHasher<JSObject *>, SystemAllocPolicy>
         ObjectMap;
     ObjectMap objects;
 
-    bool addDebuggee(JSContext *cx, GlobalObject *obj);
-    void removeDebuggee(GlobalObject *global, GlobalObjectSet::Enum *compartmentEnum,
-                        GlobalObjectSet::Enum *debugEnum);
+    bool addDebuggeeGlobal(JSContext *cx, GlobalObject *obj);
+    void removeDebuggeeGlobal(GlobalObject *global, GlobalObjectSet::Enum *compartmentEnum,
+                              GlobalObjectSet::Enum *debugEnum);
 
     JSTrapStatus handleUncaughtException(AutoCompartment &ac, Value *vp, bool callHook);
     JSTrapStatus parseResumptionValue(AutoCompartment &ac, bool ok, const Value &rv, Value *vp,
                                       bool callHook = true);
 
     static void trace(JSTracer *trc, JSObject *obj);
     static void finalize(JSContext *cx, JSObject *obj);