本文整理汇总了C++中InjectedScript::previewValue方法的典型用法代码示例。如果您正苦于以下问题:C++ InjectedScript::previewValue方法的具体用法?C++ InjectedScript::previewValue怎么用?C++ InjectedScript::previewValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InjectedScript
的用法示例。
在下文中一共展示了InjectedScript::previewValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPreview
void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview)
{
// Prevent the cell from getting collected as we look it up.
VM& vm = m_environment.vm();
JSLockHolder lock(vm);
DeferGC deferGC(vm.heap);
unsigned heapObjectIdentifier = static_cast<unsigned>(heapObjectId);
const Optional<HeapSnapshotNode> optionalNode = nodeForHeapObjectIdentifier(errorString, heapObjectIdentifier);
if (!optionalNode)
return;
// String preview.
JSCell* cell = optionalNode->cell;
if (cell->isString()) {
*resultString = cell->getString(nullptr);
return;
}
// FIXME: Provide preview information for Internal Objects? CodeBlock, Executable, etc.
Structure* structure = cell->structure(m_environment.vm());
if (!structure) {
errorString = ASCIILiteral("Unable to get object details - Structure");
return;
}
JSGlobalObject* globalObject = structure->globalObject();
if (!globalObject) {
errorString = ASCIILiteral("Unable to get object details - GlobalObject");
return;
}
InjectedScript injectedScript = m_injectedScriptManager.injectedScriptFor(globalObject->globalExec());
if (injectedScript.hasNoValue()) {
errorString = ASCIILiteral("Unable to get object details - InjectedScript");
return;
}
// Function preview.
if (cell->inherits(JSFunction::info())) {
Deprecated::ScriptValue functionScriptValue(m_environment.vm(), JSValue(cell));
injectedScript.functionDetails(errorString, functionScriptValue, &functionDetails);
return;
}
// Object preview.
Deprecated::ScriptValue cellScriptValue(m_environment.vm(), JSValue(cell));
objectPreview = injectedScript.previewValue(cellScriptValue);
}