This source file includes following definitions.
- m_paused
- init
- injectedScriptForEval
- muteConsole
- unmuteConsole
- run
- willEvaluateWorkerScript
#include "config.h"
#include "core/inspector/WorkerRuntimeAgent.h"
#include "bindings/v8/ScriptState.h"
#include "core/inspector/InjectedScript.h"
#include "core/inspector/InstrumentingAgents.h"
#include "core/inspector/WorkerDebuggerAgent.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerRunLoop.h"
#include "core/workers/WorkerThread.h"
namespace WebCore {
WorkerRuntimeAgent::WorkerRuntimeAgent(InjectedScriptManager* injectedScriptManager, ScriptDebugServer* scriptDebugServer, WorkerGlobalScope* workerGlobalScope)
: InspectorRuntimeAgent(injectedScriptManager, scriptDebugServer)
, m_workerGlobalScope(workerGlobalScope)
, m_paused(false)
{
}
WorkerRuntimeAgent::~WorkerRuntimeAgent()
{
m_instrumentingAgents->setWorkerRuntimeAgent(0);
}
void WorkerRuntimeAgent::init()
{
m_instrumentingAgents->setWorkerRuntimeAgent(this);
}
InjectedScript WorkerRuntimeAgent::injectedScriptForEval(ErrorString* error, const int* executionContextId)
{
if (executionContextId) {
*error = "Execution context id is not supported for workers as there is only one execution context.";
return InjectedScript();
}
ScriptState* scriptState = scriptStateFromWorkerGlobalScope(m_workerGlobalScope);
return injectedScriptManager()->injectedScriptFor(scriptState);
}
void WorkerRuntimeAgent::muteConsole()
{
}
void WorkerRuntimeAgent::unmuteConsole()
{
}
void WorkerRuntimeAgent::run(ErrorString*)
{
m_paused = false;
}
void WorkerRuntimeAgent::willEvaluateWorkerScript(WorkerGlobalScope* context, int workerThreadStartMode)
{
if (workerThreadStartMode != PauseWorkerGlobalScopeOnStart)
return;
m_paused = true;
MessageQueueWaitResult result;
do {
result = context->thread()->runLoop().runDebuggerTask();
} while (result == MessageQueueMessageReceived && m_paused);
}
}