#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8ScriptRunner.h"
#include "bindings/v8/V8WindowShell.h"
+#include "core/frame/FrameConsole.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
-#include "core/frame/PageConsole.h"
#include "core/frame/UseCounter.h"
#include "core/inspector/InspectorInstrumentation.h"
+#include "core/inspector/InspectorTraceEvents.h"
#include "core/inspector/ScriptDebugListener.h"
#include "core/page/Page.h"
#include "wtf/OwnPtr.h"
return server;
}
+v8::Isolate* PageScriptDebugServer::s_mainThreadIsolate = 0;
+
+void PageScriptDebugServer::setMainThreadIsolate(v8::Isolate* isolate)
+{
+ s_mainThreadIsolate = isolate;
+}
+
PageScriptDebugServer::PageScriptDebugServer()
- : ScriptDebugServer(v8::Isolate::GetCurrent())
+ : ScriptDebugServer(s_mainThreadIsolate)
, m_pausedPage(0)
{
}
+PageScriptDebugServer::~PageScriptDebugServer()
+{
+}
+
void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page)
{
ScriptController& scriptController = page->mainFrame()->script();
// FIXME: Remove all breakpoints set by the agent.
}
+void PageScriptDebugServer::interruptAndRun(PassOwnPtr<Task> task)
+{
+ ScriptDebugServer::interruptAndRun(task, s_mainThreadIsolate);
+}
+
void PageScriptDebugServer::setClientMessageLoop(PassOwnPtr<ClientMessageLoop> clientMessageLoop)
{
m_clientMessageLoop = clientMessageLoop;
}
-void PageScriptDebugServer::compileScript(ScriptState* state, const String& expression, const String& sourceURL, String* scriptId, String* exceptionMessage)
+void PageScriptDebugServer::compileScript(ScriptState* scriptState, const String& expression, const String& sourceURL, String* scriptId, String* exceptionMessage)
{
- ExecutionContext* executionContext = state->executionContext();
+ ExecutionContext* executionContext = scriptState->executionContext();
RefPtr<LocalFrame> protect = toDocument(executionContext)->frame();
- ScriptDebugServer::compileScript(state, expression, sourceURL, scriptId, exceptionMessage);
+ ScriptDebugServer::compileScript(scriptState, expression, sourceURL, scriptId, exceptionMessage);
if (!scriptId->isNull())
m_compiledScriptURLs.set(*scriptId, sourceURL);
}
m_compiledScriptURLs.clear();
}
-void PageScriptDebugServer::runScript(ScriptState* state, const String& scriptId, ScriptValue* result, bool* wasThrown, String* exceptionMessage)
+void PageScriptDebugServer::runScript(ScriptState* scriptState, const String& scriptId, ScriptValue* result, bool* wasThrown, String* exceptionMessage)
{
String sourceURL = m_compiledScriptURLs.take(scriptId);
- ExecutionContext* executionContext = state->executionContext();
+ ExecutionContext* executionContext = scriptState->executionContext();
LocalFrame* frame = toDocument(executionContext)->frame();
+ TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript", "data", InspectorEvaluateScriptEvent::data(frame, sourceURL, TextPosition::minimumPosition().m_line.oneBasedInt()));
+ TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "CallStack", "stack", InspectorCallStackEvent::currentCallStack());
+ // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
InspectorInstrumentationCookie cookie;
if (frame)
cookie = InspectorInstrumentation::willEvaluateScript(frame, sourceURL, TextPosition::minimumPosition().m_line.oneBasedInt());
RefPtr<LocalFrame> protect = frame;
- ScriptDebugServer::runScript(state, scriptId, result, wasThrown, exceptionMessage);
+ ScriptDebugServer::runScript(scriptState, scriptId, result, wasThrown, exceptionMessage);
if (frame)
InspectorInstrumentation::didEvaluateScript(cookie);
+ TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", "data", InspectorUpdateCountersEvent::data());
}
ScriptDebugListener* PageScriptDebugServer::getDebugListenerForContext(v8::Handle<v8::Context> context)
void PageScriptDebugServer::muteWarningsAndDeprecations()
{
- PageConsole::mute();
+ FrameConsole::mute();
UseCounter::muteForInspector();
}
void PageScriptDebugServer::unmuteWarningsAndDeprecations()
{
- PageConsole::unmute();
+ FrameConsole::unmute();
UseCounter::unmuteForInspector();
}