本文整理汇总了C++中ProxyObject类的典型用法代码示例。如果您正苦于以下问题:C++ ProxyObject类的具体用法?C++ ProxyObject怎么用?C++ ProxyObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProxyObject类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: performProxyRevoke
static EncodedJSValue JSC_HOST_CALL performProxyRevoke(ExecState* exec)
{
ProxyRevoke* proxyRevoke = jsCast<ProxyRevoke*>(exec->jsCallee());
JSValue proxyValue = proxyRevoke->proxy();
if (proxyValue.isNull())
return JSValue::encode(jsUndefined());
ProxyObject* proxy = jsCast<ProxyObject*>(proxyValue);
VM& vm = exec->vm();
proxy->revoke(vm);
proxyRevoke->setProxyToNull(vm);
return JSValue::encode(jsUndefined());
}
示例2: Add
void CustomStatusesManager::Add (const CustomState& state, int after)
{
ProxyObject proxy;
QList<QStandardItem*> row;
row << new QStandardItem (state.Name_);
row << new QStandardItem (Core::Instance ().GetIconForState (state.State_),
proxy.StateToString (state.State_));
row << new QStandardItem (state.Text_);
row.at (1)->setData (static_cast<int> (state.State_));
if (after == -1)
Model_->appendRow (row);
else
Model_->insertRow (after, row);
}
示例3: MOZ_ASSERT
/*
* This method marks pointers that cross compartment boundaries. It is called in
* per-zone GCs (since full GCs naturally follow pointers across compartments)
* and when compacting to update cross-compartment pointers.
*/
void
JSCompartment::markCrossCompartmentWrappers(JSTracer *trc)
{
MOZ_ASSERT(!zone()->isCollecting() || trc->runtime()->isHeapCompacting());
for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) {
Value v = e.front().value();
if (e.front().key().kind == CrossCompartmentKey::ObjectWrapper) {
ProxyObject *wrapper = &v.toObject().as<ProxyObject>();
/*
* We have a cross-compartment wrapper. Its private pointer may
* point into the compartment being collected, so we should mark it.
*/
MarkValue(trc, wrapper->slotOfPrivate(), "cross-compartment wrapper");
}
}
}
示例4: MOZ_ASSERT
void
JSCompartment::traceOutgoingCrossCompartmentWrappers(JSTracer* trc)
{
MOZ_ASSERT(trc->runtime()->isHeapMajorCollecting());
MOZ_ASSERT(!zone()->isCollecting() || trc->runtime()->gc.isHeapCompacting());
for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) {
Value v = e.front().value().unbarrieredGet();
if (e.front().key().is<JSObject*>()) {
ProxyObject* wrapper = &v.toObject().as<ProxyObject>();
/*
* We have a cross-compartment wrapper. Its private pointer may
* point into the compartment being collected, so we should mark it.
*/
TraceEdge(trc, wrapper->slotOfPrivate(), "cross-compartment wrapper");
}
}
}
示例5: JS_ASSERT
/*
* This method marks pointers that cross compartment boundaries. It should be
* called only for per-compartment GCs, since full GCs naturally follow pointers
* across compartments.
*/
void
JSCompartment::markCrossCompartmentWrappers(JSTracer *trc)
{
JS_ASSERT(!zone()->isCollecting());
for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) {
Value v = e.front().value();
if (e.front().key().kind == CrossCompartmentKey::ObjectWrapper) {
ProxyObject *wrapper = &v.toObject().as<ProxyObject>();
/*
* We have a cross-compartment wrapper. Its private pointer may
* point into the compartment being collected, so we should mark it.
*/
Value referent = wrapper->private_();
MarkValueRoot(trc, &referent, "cross-compartment wrapper");
JS_ASSERT(referent == wrapper->private_());
}
}
}
示例6: TraceEdge
/* static */ void
ProxyObject::trace(JSTracer* trc, JSObject* obj)
{
ProxyObject* proxy = &obj->as<ProxyObject>();
TraceEdge(trc, proxy->shapePtr(), "ProxyObject_shape");
#ifdef DEBUG
if (TlsContext.get()->isStrictProxyCheckingEnabled() && proxy->is<WrapperObject>()) {
JSObject* referent = MaybeForwarded(proxy->target());
if (referent->compartment() != proxy->compartment()) {
/*
* Assert that this proxy is tracked in the wrapper map. We maintain
* the invariant that the wrapped object is the key in the wrapper map.
*/
Value key = ObjectValue(*referent);
WrapperMap::Ptr p = proxy->compartment()->lookupWrapper(key);
MOZ_ASSERT(p);
MOZ_ASSERT(*p->value().unsafeGet() == ObjectValue(*proxy));
}
}
#endif
// Note: If you add new slots here, make sure to change
// nuke() to cope.
traceEdgeToTarget(trc, proxy);
size_t nreserved = proxy->numReservedSlots();
for (size_t i = 0; i < nreserved; i++) {
/*
* The GC can use the second reserved slot to link the cross compartment
* wrappers into a linked list, in which case we don't want to trace it.
*/
if (proxy->is<CrossCompartmentWrapperObject>() &&
i == CrossCompartmentWrapperObject::GrayLinkReservedSlot)
{
continue;
}
TraceEdge(trc, proxy->reservedSlotPtr(i), "proxy_reserved");
}
Proxy::trace(trc, obj);
}