WorkerConsoleClient.cpp [plain text]
#include "config.h"
#include "WorkerConsoleClient.h"
#include "InspectorInstrumentation.h"
#include <inspector/ConsoleMessage.h>
#include <inspector/ScriptArguments.h>
#include <inspector/ScriptCallStack.h>
#include <inspector/ScriptCallStackFactory.h>
using namespace Inspector;
namespace WebCore {
WorkerConsoleClient::WorkerConsoleClient(WorkerGlobalScope& workerGlobalScope)
: m_workerGlobalScope(workerGlobalScope)
{
}
WorkerConsoleClient::~WorkerConsoleClient()
{
}
void WorkerConsoleClient::messageWithTypeAndLevel(MessageType type, MessageLevel level, JSC::ExecState* exec, RefPtr<Inspector::ScriptArguments>&& arguments)
{
String messageText;
arguments->getFirstArgumentAsString(messageText);
auto message = std::make_unique<Inspector::ConsoleMessage>(MessageSource::ConsoleAPI, type, level, messageText, WTFMove(arguments), exec);
m_workerGlobalScope.addConsoleMessage(WTFMove(message));
}
void WorkerConsoleClient::count(JSC::ExecState* exec, RefPtr<ScriptArguments>&& arguments)
{
InspectorInstrumentation::consoleCount(m_workerGlobalScope, exec, WTFMove(arguments));
}
void WorkerConsoleClient::time(JSC::ExecState*, const String& title)
{
InspectorInstrumentation::startConsoleTiming(m_workerGlobalScope, title);
}
void WorkerConsoleClient::timeEnd(JSC::ExecState* exec, const String& title)
{
RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(exec, 1));
InspectorInstrumentation::stopConsoleTiming(m_workerGlobalScope, title, WTFMove(callStack));
}
void WorkerConsoleClient::profile(JSC::ExecState*, const String&) { }
void WorkerConsoleClient::profileEnd(JSC::ExecState*, const String&) { }
void WorkerConsoleClient::takeHeapSnapshot(JSC::ExecState*, const String&) { }
void WorkerConsoleClient::timeStamp(JSC::ExecState*, RefPtr<ScriptArguments>&&) { }
}