本文整理汇总了C++中objectvaluemap::base::Range::popFront方法的典型用法代码示例。如果您正苦于以下问题:C++ Range::popFront方法的具体用法?C++ Range::popFront怎么用?C++ Range::popFront使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类objectvaluemap::base::Range
的用法示例。
在下文中一共展示了Range::popFront方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: obj
JS_NondeterministicGetWeakMapKeys(JSContext *cx, HandleObject objArg, MutableHandleObject ret)
{
RootedObject obj(cx, objArg);
obj = UncheckedUnwrap(obj);
if (!obj || !obj->is<WeakMapObject>()) {
ret.set(nullptr);
return true;
}
RootedObject arr(cx, NewDenseEmptyArray(cx));
if (!arr)
return false;
ObjectValueMap *map = obj->as<WeakMapObject>().getMap();
if (map) {
// Prevent GC from mutating the weakmap while iterating.
gc::AutoSuppressGC suppress(cx);
for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) {
RootedObject key(cx, r.front().key());
if (!cx->compartment()->wrap(cx, &key))
return false;
if (!NewbornArrayPush(cx, arr, ObjectValue(*key)))
return false;
}
}
ret.set(arr);
return true;
}
示例2: arr
JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *obj, JSObject **ret)
{
if (!obj || !obj->isWeakMap()) {
*ret = NULL;
return true;
}
RootedObject arr(cx, NewDenseEmptyArray(cx));
if (!arr)
return false;
ObjectValueMap *map = GetObjectMap(obj);
if (map) {
for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) {
if (!js_NewbornArrayPush(cx, arr, ObjectValue(*r.front().key)))
return false;
}
}
*ret = arr;
return true;
}
示例3: arr
bool
WeakCollectionObject::nondeterministicGetKeys(JSContext* cx, Handle<WeakCollectionObject*> obj,
MutableHandleObject ret)
{
RootedObject arr(cx, NewDenseEmptyArray(cx));
if (!arr)
return false;
if (ObjectValueMap* map = obj->getMap()) {
// Prevent GC from mutating the weakmap while iterating.
AutoSuppressGC suppress(cx);
for (ObjectValueMap::Base::Range r = map->all(); !r.empty(); r.popFront()) {
JS::ExposeObjectToActiveJS(r.front().key());
RootedObject key(cx, r.front().key());
if (!cx->compartment()->wrap(cx, &key))
return false;
if (!NewbornArrayPush(cx, arr, ObjectValue(*key)))
return false;
}
}
ret.set(arr);
return true;
}