当前位置: 首页>>代码示例>>C++>>正文


C++ InjectedScript::wrapForConsole方法代码示例

本文整理汇总了C++中InjectedScript::wrapForConsole方法的典型用法代码示例。如果您正苦于以下问题:C++ InjectedScript::wrapForConsole方法的具体用法?C++ InjectedScript::wrapForConsole怎么用?C++ InjectedScript::wrapForConsole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InjectedScript的用法示例。


在下文中一共展示了InjectedScript::wrapForConsole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addToFrontend

void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
{
    RefPtr<InspectorObject> jsonObj = InspectorObject::create();
    jsonObj->setNumber("source", static_cast<int>(m_source));
    jsonObj->setNumber("type", static_cast<int>(m_type));
    jsonObj->setNumber("level", static_cast<int>(m_level));
    jsonObj->setNumber("line", static_cast<int>(m_line));
    jsonObj->setString("url", m_url);
    jsonObj->setNumber("repeatCount", static_cast<int>(m_repeatCount));
    jsonObj->setString("message", m_message);
    if (m_type == NetworkErrorMessageType) 
        jsonObj->setNumber("requestId", m_requestId);
    if (m_arguments && m_arguments->argumentCount()) {
        InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_arguments->globalState());
        if (!injectedScript.hasNoValue()) {
            RefPtr<InspectorArray> jsonArgs = InspectorArray::create();
            for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
                RefPtr<InspectorValue> inspectorValue = injectedScript.wrapForConsole(m_arguments->argumentAt(i));
                if (!inspectorValue) {
                    ASSERT_NOT_REACHED();
                    return;
                }
                jsonArgs->pushValue(inspectorValue);
            }
            jsonObj->setArray("parameters", jsonArgs);
        }
    }
    if (m_callStack)
        jsonObj->setArray("stackTrace", m_callStack->buildInspectorObject());
    frontend->addConsoleMessage(jsonObj);
}
开发者ID:dslab-epfl,项目名称:warr,代码行数:31,代码来源:ConsoleMessage.cpp

示例2: addToFrontend

void ConsoleMessage::addToFrontend(InspectorFrontend* frontend, InjectedScriptHost* injectedScriptHost)
{
    ScriptObject jsonObj = frontend->newScriptObject();
    jsonObj.set("source", static_cast<int>(m_source));
    jsonObj.set("type", static_cast<int>(m_type));
    jsonObj.set("level", static_cast<int>(m_level));
    jsonObj.set("line", static_cast<int>(m_line));
    jsonObj.set("url", m_url);
    jsonObj.set("groupLevel", static_cast<int>(m_groupLevel));
    jsonObj.set("repeatCount", static_cast<int>(m_repeatCount));
    Vector<RefPtr<SerializedScriptValue> > arguments;
    if (!m_arguments.isEmpty()) {
        InjectedScript injectedScript = injectedScriptHost->injectedScriptFor(m_scriptState.get());
        for (unsigned i = 0; i < m_arguments.size(); ++i) {
            RefPtr<SerializedScriptValue> serializedValue = injectedScript.wrapForConsole(m_arguments[i]);
            arguments.append(serializedValue);
        }
    }   
    frontend->addConsoleMessage(jsonObj, m_frames, arguments,  m_message);
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:20,代码来源:ConsoleMessage.cpp

示例3: addConsoleMessage

void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const Vector<ScriptString>& frames, ScriptState* scriptState, const Vector<ScriptValue> arguments, const String& message)
{
    ScriptFunctionCall function(m_webInspector, "dispatch"); 
    function.appendArgument("addConsoleMessage");
    function.appendArgument(messageObj);
    if (!frames.isEmpty()) {
        for (unsigned i = 0; i < frames.size(); ++i)
            function.appendArgument(frames[i]);
    } else if (!arguments.isEmpty()) {
        InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState);
        for (unsigned i = 0; i < arguments.size(); ++i) {
            RefPtr<SerializedScriptValue> serializedValue = injectedScript.wrapForConsole(arguments[i]);
            ScriptValue scriptValue = ScriptValue::deserialize(this->scriptState(), serializedValue.get());
            if (scriptValue.hasNoValue()) {
                ASSERT_NOT_REACHED();
                return;
            }
            function.appendArgument(scriptValue);
        }
    } else {
        function.appendArgument(message);
    }
    function.call();
}
开发者ID:ShouqingZhang,项目名称:webkitdriver,代码行数:24,代码来源:InspectorFrontend.cpp


注:本文中的InjectedScript::wrapForConsole方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。