本文整理汇总了C++中ActiveDOMObject::hasPendingActivity方法的典型用法代码示例。如果您正苦于以下问题:C++ ActiveDOMObject::hasPendingActivity方法的具体用法?C++ ActiveDOMObject::hasPendingActivity怎么用?C++ ActiveDOMObject::hasPendingActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveDOMObject
的用法示例。
在下文中一共展示了ActiveDOMObject::hasPendingActivity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitDOMWrapper
void visitDOMWrapper(DOMDataStore* store, T* object, v8::Persistent<v8::Object> wrapper)
{
WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
if (!S::process(object, wrapper, typeInfo)) {
ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
if (activeDOMObject && activeDOMObject->hasPendingActivity())
wrapper.ClearWeak();
}
}
示例2: VisitPersistentHandle
virtual void VisitPersistentHandle(v8::Persistent<v8::Value>* value, uint16_t classId) override
{
// A minor DOM GC can collect only Nodes.
if (classId != WrapperTypeInfo::NodeClassId)
return;
// To make minor GC cycle time bounded, we limit the number of wrappers handled
// by each minor GC cycle to 10000. This value was selected so that the minor
// GC cycle time is bounded to 20 ms in a case where the new space size
// is 16 MB and it is full of wrappers (which is almost the worst case).
// Practically speaking, as far as I crawled real web applications,
// the number of wrappers handled by each minor GC cycle is at most 3000.
// So this limit is mainly for pathological micro benchmarks.
const unsigned wrappersHandledByEachMinorGC = 10000;
if (m_nodesInNewSpace.size() >= wrappersHandledByEachMinorGC)
return;
// Casting to a Handle is safe here, since the Persistent doesn't get GCd
// during the GC prologue.
ASSERT((*reinterpret_cast<v8::Handle<v8::Value>*>(value))->IsObject());
v8::Handle<v8::Object>* wrapper = reinterpret_cast<v8::Handle<v8::Object>*>(value);
ASSERT(V8DOMWrapper::isDOMWrapper(*wrapper));
ASSERT(V8Node::hasInstance(*wrapper, m_isolate));
Node* node = V8Node::toImpl(*wrapper);
// A minor DOM GC can handle only node wrappers in the main world.
// Note that node->wrapper().IsEmpty() returns true for nodes that
// do not have wrappers in the main world.
if (node->containsWrapper()) {
const WrapperTypeInfo* type = toWrapperTypeInfo(*wrapper);
ActiveDOMObject* activeDOMObject = type->toActiveDOMObject(*wrapper);
if (activeDOMObject && activeDOMObject->hasPendingActivity())
return;
// FIXME: Remove the special handling for image elements.
// The same special handling is in V8GCController::opaqueRootForGC().
// Maybe should image elements be active DOM nodes?
// See https://code.google.com/p/chromium/issues/detail?id=164882
if (isHTMLImageElement(*node) && toHTMLImageElement(*node).hasPendingActivity())
return;
// FIXME: Remove the special handling for SVG elements.
// We currently can't collect SVG Elements from minor gc, as we have
// strong references from SVG property tear-offs keeping context SVG element alive.
if (node->isSVGElement())
return;
m_nodesInNewSpace.append(node);
node->markV8CollectableDuringMinorGC();
}
}
示例3: visitDOMWrapper
void visitDOMWrapper(DOMDataStore* store, void* object, v8::Persistent<v8::Object> wrapper)
{
WrapperTypeInfo* typeInfo = V8DOMWrapper::domWrapperType(wrapper);
// Additional handling of message port ensuring that entangled ports also
// have their wrappers entangled. This should ideally be handled when the
// ports are actually entangled in MessagePort::entangle, but to avoid
// forking MessagePort.* this is postponed to GC time. Having this postponed
// has the drawback that the wrappers are "entangled/unentangled" for each
// GC even though their entaglement most likely is still the same.
if (V8MessagePort::info.equals(typeInfo)) {
// Mark each port as in-use if it's entangled. For simplicity's sake, we assume all ports are remotely entangled,
// since the Chromium port implementation can't tell the difference.
MessagePort* port1 = static_cast<MessagePort*>(object);
if (port1->isEntangled() || port1->hasPendingActivity())
wrapper.ClearWeak();
} else {
ActiveDOMObject* activeDOMObject = typeInfo->toActiveDOMObject(wrapper);
if (activeDOMObject && activeDOMObject->hasPendingActivity())
wrapper.ClearWeak();
}
}