Beispiel #1
0
    bool report(Census &census, MutableHandleValue report) {
        JSContext *cx = census.cx;

        RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_));
        if (!obj)
            return false;

        for (typename Table::Range r = table.all(); !r.empty(); r.popFront()) {
            EachType &entry = r.front().value();
            RootedValue entryReport(cx);
            if (!entry.report(census, &entryReport))
                return false;

            const jschar *name = r.front().key();
            MOZ_ASSERT(name);
            JSAtom *atom = AtomizeChars(cx, name, js_strlen(name));
            if (!atom)
                return false;
            RootedId entryId(cx, AtomToId(atom));

            if (!JSObject::defineGeneric(cx, obj, entryId, entryReport))
                return false;
        }

        report.setObject(*obj);
        return true;
    }
java::lang::String* org::mpisws::p2p::transport::peerreview::replay::BasicEntryDeserializer::read(::org::mpisws::p2p::transport::peerreview::history::IndexEntry* ie, ::org::mpisws::p2p::transport::peerreview::history::SecureHistory* history) /* throws(IOException) */
{
    if(npc(ie)->getType() >= EVT_MIN_SOCKET_EVT && npc(ie)->getType() <= EVT_MAX_SOCKET_EVT) {
        return ::java::lang::StringBuilder().append(entryId(npc(ie)->getType()))->append(u" n:"_j)
            ->append(npc(ie)->getSeq())
            ->append(u" i:"_j)
            ->append(npc(ie)->getFileIndex())
            ->append(u" sock:"_j)
            ->append((new ::rice::p2p::util::rawserialization::SimpleInputBuffer(npc(history)->getEntry(ie, int32_t(4))))->readInt())->toString();
    }
    return ::java::lang::StringBuilder().append(entryId(npc(ie)->getType()))->append(u" n:"_j)
        ->append(npc(ie)->getSeq())
        ->append(u" s:"_j)
        ->append(npc(ie)->getSizeInFile())
        ->append(u" i:"_j)
        ->append(npc(ie)->getFileIndex())->toString();
}
Beispiel #3
0
    bool report(Census &census, MutableHandleValue report) {
        JSContext *cx = census.cx;

        RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_));
        if (!obj)
            return false;

        for (typename Table::Range r = table.all(); !r.empty(); r.popFront()) {
            EachClass &entry = r.front().value();
            RootedValue entryReport(cx);
            if (!entry.report(census, &entryReport))
                return false;

            const char *name = r.front().key()->name;
            MOZ_ASSERT(name);
            JSAtom *atom = Atomize(census.cx, name, strlen(name));
            if (!atom)
                return false;
            RootedId entryId(cx, AtomToId(atom));

#ifdef DEBUG
            // We have multiple js::Classes out there with the same name (for
            // example, JSObject::class_, Debugger.Object, and CollatorClass are
            // all "Object"), so let's make sure our hash table treats them all
            // as equivalent.
            bool has;
            if (!JSObject::hasProperty(cx, obj, entryId, &has))
                return false;
            if (has) {
                fprintf(stderr, "already has %s\n", name);
                MOZ_ASSERT(!has);
            }
#endif

            if (!JSObject::defineGeneric(cx, obj, entryId, entryReport))
                return false;
        }

        report.setObject(*obj);
        return true;
    }