本文整理汇总了C++中InjectedScript::wrapTable方法的典型用法代码示例。如果您正苦于以下问题:C++ InjectedScript::wrapTable方法的具体用法?C++ InjectedScript::wrapTable怎么用?C++ InjectedScript::wrapTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InjectedScript
的用法示例。
在下文中一共展示了InjectedScript::wrapTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addToFrontend
void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher* consoleFrontendDispatcher, InjectedScriptManager* injectedScriptManager, bool generatePreview)
{
Ref<Inspector::Protocol::Console::ConsoleMessage> jsonObj = Inspector::Protocol::Console::ConsoleMessage::create()
.setSource(messageSourceValue(m_source))
.setLevel(messageLevelValue(m_level))
.setText(m_message)
.release();
// FIXME: only send out type for ConsoleAPI source messages.
jsonObj->setType(messageTypeValue(m_type));
jsonObj->setLine(static_cast<int>(m_line));
jsonObj->setColumn(static_cast<int>(m_column));
jsonObj->setUrl(m_url);
jsonObj->setRepeatCount(static_cast<int>(m_repeatCount));
if (m_source == MessageSource::Network && !m_requestId.isEmpty())
jsonObj->setNetworkRequestId(m_requestId);
if (m_arguments && m_arguments->argumentCount()) {
InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->globalState());
if (!injectedScript.hasNoValue()) {
Ref<Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>> jsonArgs = Inspector::Protocol::Array<Inspector::Protocol::Runtime::RemoteObject>::create();
if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) {
Deprecated::ScriptValue table = m_arguments->argumentAt(0);
Deprecated::ScriptValue columns = m_arguments->argumentCount() > 1 ? m_arguments->argumentAt(1) : Deprecated::ScriptValue();
RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapTable(table, columns);
if (!inspectorValue) {
ASSERT_NOT_REACHED();
return;
}
jsonArgs->addItem(inspectorValue.copyRef());
if (m_arguments->argumentCount() > 1)
jsonArgs->addItem(injectedScript.wrapObject(columns, ASCIILiteral("console"), true));
} else {
for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), ASCIILiteral("console"), generatePreview);
if (!inspectorValue) {
ASSERT_NOT_REACHED();
return;
}
jsonArgs->addItem(inspectorValue.copyRef());
}
}
jsonObj->setParameters(WTF::move(jsonArgs));
}
}
if (m_callStack)
jsonObj->setStackTrace(m_callStack->buildInspectorArray());
consoleFrontendDispatcher->messageAdded(WTF::move(jsonObj));
}
示例2: addToFrontend
void ConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend, InjectedScriptManager* injectedScriptManager, bool generatePreview)
{
RefPtr<TypeBuilder::Console::ConsoleMessage> jsonObj = TypeBuilder::Console::ConsoleMessage::create()
.setSource(messageSourceValue(m_source))
.setLevel(messageLevelValue(m_level))
.setText(m_message)
.setTimestamp(m_timestamp);
// FIXME: only send out type for ConsoleAPI source messages.
jsonObj->setType(messageTypeValue(m_type));
jsonObj->setLine(static_cast<int>(m_line));
jsonObj->setColumn(static_cast<int>(m_column));
jsonObj->setUrl(m_url);
ScriptState* scriptState = m_scriptState.get();
if (scriptState && scriptState->executionContext()->isDocument())
jsonObj->setExecutionContextId(injectedScriptManager->injectedScriptIdFor(scriptState));
if (m_source == NetworkMessageSource && !m_requestId.isEmpty())
jsonObj->setNetworkRequestId(m_requestId);
if (m_arguments && m_arguments->argumentCount()) {
InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(m_arguments->scriptState());
if (!injectedScript.isEmpty()) {
RefPtr<TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject> > jsonArgs = TypeBuilder::Array<TypeBuilder::Runtime::RemoteObject>::create();
if (m_type == TableMessageType && generatePreview && m_arguments->argumentCount()) {
ScriptValue table = m_arguments->argumentAt(0);
ScriptValue columns = m_arguments->argumentCount() > 1 ? m_arguments->argumentAt(1) : ScriptValue();
RefPtr<TypeBuilder::Runtime::RemoteObject> inspectorValue = injectedScript.wrapTable(table, columns);
if (!inspectorValue) {
ASSERT_NOT_REACHED();
return;
}
jsonArgs->addItem(inspectorValue);
} else {
for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
RefPtr<TypeBuilder::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), "console", generatePreview);
if (!inspectorValue) {
ASSERT_NOT_REACHED();
return;
}
jsonArgs->addItem(inspectorValue);
}
}
jsonObj->setParameters(jsonArgs);
}
}
if (m_callStack)
jsonObj->setStackTrace(m_callStack->buildInspectorArray());
frontend->messageAdded(jsonObj);
frontend->flush();
}