Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (192060 => 192061)
--- trunk/Source/_javascript_Core/ChangeLog 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-11-05 19:22:42 UTC (rev 192061)
@@ -1,3 +1,74 @@
+2015-11-05 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Put ScriptDebugServer into InspectorEnvironment and cleanup duplicate references
+ https://bugs.webkit.org/show_bug.cgi?id=150869
+
+ Reviewed by Brian Burg.
+
+ ScriptDebugServer (JSC::Debugger) is being used by more and more agents
+ for instrumentation into _javascript_Core. Currently the ScriptDebugServer
+ is owned by DebuggerAgent subclasses that make their own ScriptDebugServer
+ subclass. As more agents want to use it there was added boilerplate.
+ Instead, put the ScriptDebugServer in the InspectorEnvironment (Controllers).
+ Then each agent can access it during construction through the environment.
+
+ Do the same clean up for RuntimeAgent::globalVM, which is now just a
+ duplication of InspectorEnvironment::vm.
+
+ * inspector/InspectorEnvironment.h:
+ Add scriptDebugServer().
+
+ * inspector/JSGlobalObjectInspectorController.h:
+ * inspector/JSGlobalObjectInspectorController.cpp:
+ (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+ (Inspector::JSGlobalObjectInspectorController::scriptDebugServer):
+ Own the JSGlobalObjectScriptDebugServer.
+
+ * inspector/agents/InspectorDebuggerAgent.h:
+ * inspector/agents/InspectorDebuggerAgent.cpp:
+ (Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
+ (Inspector::InspectorDebuggerAgent::enable):
+ (Inspector::InspectorDebuggerAgent::disable):
+ (Inspector::InspectorDebuggerAgent::setBreakpointsActive):
+ (Inspector::InspectorDebuggerAgent::isPaused):
+ (Inspector::InspectorDebuggerAgent::setSuppressAllPauses):
+ (Inspector::InspectorDebuggerAgent::handleConsoleAssert):
+ (Inspector::InspectorDebuggerAgent::removeBreakpoint):
+ (Inspector::InspectorDebuggerAgent::continueToLocation):
+ (Inspector::InspectorDebuggerAgent::resolveBreakpoint):
+ (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement):
+ (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement):
+ (Inspector::InspectorDebuggerAgent::resume):
+ (Inspector::InspectorDebuggerAgent::stepOver):
+ (Inspector::InspectorDebuggerAgent::stepInto):
+ (Inspector::InspectorDebuggerAgent::stepOut):
+ (Inspector::InspectorDebuggerAgent::setPauseOnExceptions):
+ (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame):
+ (Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP):
+ (Inspector::InspectorDebuggerAgent::didPause):
+ (Inspector::InspectorDebuggerAgent::breakProgram):
+ (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState):
+ * inspector/agents/InspectorRuntimeAgent.h:
+ * inspector/agents/InspectorRuntimeAgent.cpp:
+ (Inspector::InspectorRuntimeAgent::InspectorRuntimeAgent):
+ (Inspector::setPauseOnExceptionsState):
+ (Inspector::InspectorRuntimeAgent::parse):
+ (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
+ (Inspector::InspectorRuntimeAgent::setTypeProfilerEnabledState):
+ (Inspector::InspectorRuntimeAgent::getBasicBlocks):
+ Use VM and ScriptDebugServer passed during construction.
+
+ * inspector/agents/JSGlobalObjectDebuggerAgent.h:
+ * inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
+ (Inspector::JSGlobalObjectDebuggerAgent::injectedScriptForEval):
+ (Inspector::JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent): Deleted.
+ One special case needed by this subclass as a convenience to access the global object.
+
+ * inspector/agents/JSGlobalObjectRuntimeAgent.h:
+ * inspector/agents/JSGlobalObjectRuntimeAgent.cpp:
+ (Inspector::JSGlobalObjectRuntimeAgent::globalVM): Deleted.
+ This virtual method is no longer needed, the base class has everything now.
+
2015-11-05 Xabier Rodriguez Calvar <[email protected]>
[Streams API] Shield implementation from user mangling Promise.reject and resolve methods
Modified: trunk/Source/_javascript_Core/inspector/InspectorEnvironment.h (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/InspectorEnvironment.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/InspectorEnvironment.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -40,6 +40,7 @@
namespace Inspector {
+class ScriptDebugServer;
typedef JSC::JSValue (*InspectorFunctionCallHandler)(JSC::ExecState* exec, JSC::JSValue functionObject, JSC::CallType callType, const JSC::CallData& callData, JSC::JSValue thisValue, const JSC::ArgList& args, NakedPtr<JSC::Exception>& returnedException);
typedef JSC::JSValue (*InspectorEvaluateHandler)(JSC::ExecState*, const JSC::SourceCode&, JSC::JSValue thisValue, NakedPtr<JSC::Exception>& returnedException);
@@ -54,6 +55,7 @@
virtual void didCallInjectedScriptFunction(JSC::ExecState*) = 0;
virtual void frontendInitialized() = 0;
virtual Ref<WTF::Stopwatch> executionStopwatch() = 0;
+ virtual ScriptDebugServer& scriptDebugServer() = 0;
virtual JSC::VM& vm() = 0;
};
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -66,6 +66,7 @@
: m_globalObject(globalObject)
, m_injectedScriptManager(std::make_unique<InjectedScriptManager>(*this, InjectedScriptHost::create()))
, m_executionStopwatch(Stopwatch::create())
+ , m_scriptDebugServer(globalObject)
, m_frontendRouter(FrontendRouter::create())
, m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
{
@@ -85,21 +86,17 @@
auto runtimeAgent = std::make_unique<JSGlobalObjectRuntimeAgent>(context);
auto consoleAgent = std::make_unique<JSGlobalObjectConsoleAgent>(context);
auto debuggerAgent = std::make_unique<JSGlobalObjectDebuggerAgent>(context, consoleAgent.get());
- auto heapAgent = std::make_unique<InspectorHeapAgent>(context);
m_inspectorAgent = inspectorAgent.get();
m_debuggerAgent = debuggerAgent.get();
- m_heapAgent = heapAgent.get();
m_consoleAgent = consoleAgent.get();
m_consoleClient = std::make_unique<JSGlobalObjectConsoleClient>(m_consoleAgent);
- runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
-
m_agents.append(WTF::move(inspectorAgent));
m_agents.append(WTF::move(runtimeAgent));
m_agents.append(WTF::move(consoleAgent));
m_agents.append(WTF::move(debuggerAgent));
- m_agents.append(WTF::move(heapAgent));
+ m_agents.append(std::make_unique<InspectorHeapAgent>(context));
m_executionStopwatch->start();
}
@@ -285,6 +282,11 @@
return m_executionStopwatch.copyRef();
}
+JSGlobalObjectScriptDebugServer& JSGlobalObjectInspectorController::scriptDebugServer()
+{
+ return m_scriptDebugServer;
+}
+
VM& JSGlobalObjectInspectorController::vm()
{
return m_globalObject.vm();
Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectInspectorController.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -29,6 +29,7 @@
#include "InspectorAgentRegistry.h"
#include "InspectorEnvironment.h"
#include "InspectorFrontendRouter.h"
+#include "JSGlobalObjectScriptDebugServer.h"
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/text/WTFString.h>
@@ -37,10 +38,6 @@
#include "AugmentableInspectorController.h"
#endif
-namespace WTF {
-class Stopwatch;
-}
-
namespace JSC {
class ConsoleClient;
class Exception;
@@ -97,6 +94,7 @@
virtual void didCallInjectedScriptFunction(JSC::ExecState*) override { }
virtual void frontendInitialized() override;
virtual Ref<WTF::Stopwatch> executionStopwatch() override;
+ virtual JSGlobalObjectScriptDebugServer& scriptDebugServer() override;
virtual JSC::VM& vm() override;
#if ENABLE(INSPECTOR_ALTERNATE_DISPATCHERS)
@@ -115,12 +113,12 @@
std::unique_ptr<InjectedScriptManager> m_injectedScriptManager;
std::unique_ptr<JSGlobalObjectConsoleClient> m_consoleClient;
Ref<WTF::Stopwatch> m_executionStopwatch;
+ JSGlobalObjectScriptDebugServer m_scriptDebugServer;
AgentRegistry m_agents;
InspectorAgent* m_inspectorAgent { nullptr };
InspectorConsoleAgent* m_consoleAgent { nullptr };
InspectorDebuggerAgent* m_debuggerAgent { nullptr };
- InspectorHeapAgent* m_heapAgent { nullptr };
Ref<FrontendRouter> m_frontendRouter;
Ref<BackendDispatcher> m_backendDispatcher;
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -61,6 +61,7 @@
, m_injectedScriptManager(context.injectedScriptManager)
, m_frontendDispatcher(std::make_unique<DebuggerFrontendDispatcher>(context.frontendRouter))
, m_backendDispatcher(DebuggerBackendDispatcher::create(context.backendDispatcher, this))
+ , m_scriptDebugServer(context.environment.scriptDebugServer())
, m_continueToLocationBreakpointID(JSC::noBreakpointID)
{
// FIXME: make breakReason optional so that there was no need to init it with "other".
@@ -86,8 +87,8 @@
if (m_enabled)
return;
- scriptDebugServer().setBreakpointsActivated(true);
- scriptDebugServer().addListener(this);
+ m_scriptDebugServer.setBreakpointsActivated(true);
+ m_scriptDebugServer.addListener(this);
if (m_listener)
m_listener->debuggerWasEnabled();
@@ -100,7 +101,7 @@
if (!m_enabled)
return;
- scriptDebugServer().removeListener(this, isBeingDestroyed);
+ m_scriptDebugServer.removeListener(this, isBeingDestroyed);
clearInspectorBreakpointState();
ASSERT(m_javaScriptBreakpoints.isEmpty());
@@ -124,19 +125,19 @@
void InspectorDebuggerAgent::setBreakpointsActive(ErrorString&, bool active)
{
if (active)
- scriptDebugServer().activateBreakpoints();
+ m_scriptDebugServer.activateBreakpoints();
else
- scriptDebugServer().deactivateBreakpoints();
+ m_scriptDebugServer.deactivateBreakpoints();
}
bool InspectorDebuggerAgent::isPaused()
{
- return scriptDebugServer().isPaused();
+ return m_scriptDebugServer.isPaused();
}
void InspectorDebuggerAgent::setSuppressAllPauses(bool suppress)
{
- scriptDebugServer().setSuppressAllPauses(suppress);
+ m_scriptDebugServer.setSuppressAllPauses(suppress);
}
static RefPtr<InspectorObject> buildAssertPauseReason(const String& message)
@@ -183,7 +184,7 @@
void InspectorDebuggerAgent::handleConsoleAssert(const String& message)
{
- if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
+ if (m_scriptDebugServer.pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
breakProgram(DebuggerFrontendDispatcher::Reason::Assert, buildAssertPauseReason(message));
}
@@ -388,18 +389,18 @@
for (JSC::BreakpointID breakpointID : m_breakpointIdentifierToDebugServerBreakpointIDs.take(breakpointIdentifier)) {
m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.remove(breakpointID);
- const BreakpointActions& breakpointActions = scriptDebugServer().getActionsForBreakpoint(breakpointID);
+ const BreakpointActions& breakpointActions = m_scriptDebugServer.getActionsForBreakpoint(breakpointID);
for (auto& action : breakpointActions)
m_injectedScriptManager.releaseObjectGroup(objectGroupForBreakpointAction(action));
- scriptDebugServer().removeBreakpoint(breakpointID);
+ m_scriptDebugServer.removeBreakpoint(breakpointID);
}
}
void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const InspectorObject& location)
{
if (m_continueToLocationBreakpointID != JSC::noBreakpointID) {
- scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointID);
+ m_scriptDebugServer.removeBreakpoint(m_continueToLocationBreakpointID);
m_continueToLocationBreakpointID = JSC::noBreakpointID;
}
@@ -410,7 +411,7 @@
return;
ScriptBreakpoint breakpoint(lineNumber, columnNumber, "", false, 0);
- m_continueToLocationBreakpointID = scriptDebugServer().setBreakpoint(sourceID, breakpoint, &lineNumber, &columnNumber);
+ m_continueToLocationBreakpointID = m_scriptDebugServer.setBreakpoint(sourceID, breakpoint, &lineNumber, &columnNumber);
resume(errorString);
}
@@ -425,7 +426,7 @@
unsigned actualLineNumber;
unsigned actualColumnNumber;
- JSC::BreakpointID debugServerBreakpointID = scriptDebugServer().setBreakpoint(sourceID, breakpoint, &actualLineNumber, &actualColumnNumber);
+ JSC::BreakpointID debugServerBreakpointID = m_scriptDebugServer.setBreakpoint(sourceID, breakpoint, &actualLineNumber, &actualColumnNumber);
if (debugServerBreakpointID == JSC::noBreakpointID)
return nullptr;
@@ -486,7 +487,7 @@
m_breakReason = breakReason;
m_breakAuxData = WTF::move(data);
- scriptDebugServer().setPauseOnNextStatement(true);
+ m_scriptDebugServer.setPauseOnNextStatement(true);
}
void InspectorDebuggerAgent::cancelPauseOnNextStatement()
@@ -495,7 +496,7 @@
return;
clearBreakDetails();
- scriptDebugServer().setPauseOnNextStatement(false);
+ m_scriptDebugServer.setPauseOnNextStatement(false);
}
void InspectorDebuggerAgent::pause(ErrorString&)
@@ -510,7 +511,7 @@
if (!assertPaused(errorString))
return;
- scriptDebugServer().continueProgram();
+ m_scriptDebugServer.continueProgram();
}
void InspectorDebuggerAgent::stepOver(ErrorString& errorString)
@@ -518,7 +519,7 @@
if (!assertPaused(errorString))
return;
- scriptDebugServer().stepOverStatement();
+ m_scriptDebugServer.stepOverStatement();
}
void InspectorDebuggerAgent::stepInto(ErrorString& errorString)
@@ -526,7 +527,7 @@
if (!assertPaused(errorString))
return;
- scriptDebugServer().stepIntoStatement();
+ m_scriptDebugServer.stepIntoStatement();
if (m_listener)
m_listener->stepInto();
@@ -537,7 +538,7 @@
if (!assertPaused(errorString))
return;
- scriptDebugServer().stepOutOfFunction();
+ m_scriptDebugServer.stepOutOfFunction();
}
void InspectorDebuggerAgent::setPauseOnExceptions(ErrorString& errorString, const String& stringPauseState)
@@ -554,8 +555,8 @@
return;
}
- scriptDebugServer().setPauseOnExceptionsState(static_cast<JSC::Debugger::PauseOnExceptionsState>(pauseState));
- if (scriptDebugServer().pauseOnExceptionsState() != pauseState)
+ m_scriptDebugServer.setPauseOnExceptionsState(static_cast<JSC::Debugger::PauseOnExceptionsState>(pauseState));
+ if (m_scriptDebugServer.pauseOnExceptionsState() != pauseState)
errorString = ASCIILiteral("Internal error. Could not change pause on exceptions state");
}
@@ -567,10 +568,10 @@
return;
}
- JSC::Debugger::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState();
+ JSC::Debugger::PauseOnExceptionsState previousPauseOnExceptionsState = m_scriptDebugServer.pauseOnExceptionsState();
if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
if (previousPauseOnExceptionsState != JSC::Debugger::DontPauseOnExceptions)
- scriptDebugServer().setPauseOnExceptionsState(JSC::Debugger::DontPauseOnExceptions);
+ m_scriptDebugServer.setPauseOnExceptionsState(JSC::Debugger::DontPauseOnExceptions);
muteConsole();
}
@@ -578,8 +579,8 @@
if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
unmuteConsole();
- if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExceptionsState)
- scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsState);
+ if (m_scriptDebugServer.pauseOnExceptionsState() != previousPauseOnExceptionsState)
+ m_scriptDebugServer.setPauseOnExceptionsState(previousPauseOnExceptionsState);
}
}
@@ -589,7 +590,7 @@
void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directiveText)
{
- if (scriptDebugServer().pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
+ if (m_scriptDebugServer.pauseOnExceptionsState() != JSC::Debugger::DontPauseOnExceptions)
breakProgram(DebuggerFrontendDispatcher::Reason::CSPViolation, buildCSPViolationPauseReason(directiveText));
}
@@ -670,9 +671,9 @@
// If a high level pause pause reason is not already set, try to infer a reason from the debugger.
if (m_breakReason == DebuggerFrontendDispatcher::Reason::Other) {
- switch (scriptDebugServer().reasonForPause()) {
+ switch (m_scriptDebugServer.reasonForPause()) {
case JSC::Debugger::PausedForBreakpoint: {
- JSC::BreakpointID debuggerBreakpointId = scriptDebugServer().pausingBreakpointID();
+ JSC::BreakpointID debuggerBreakpointId = m_scriptDebugServer.pausingBreakpointID();
if (debuggerBreakpointId != m_continueToLocationBreakpointID) {
m_breakReason = DebuggerFrontendDispatcher::Reason::Breakpoint;
m_breakAuxData = buildBreakpointPauseReason(debuggerBreakpointId);
@@ -710,7 +711,7 @@
m_javaScriptPauseScheduled = false;
if (m_continueToLocationBreakpointID != JSC::noBreakpointID) {
- scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointID);
+ m_scriptDebugServer.removeBreakpoint(m_continueToLocationBreakpointID);
m_continueToLocationBreakpointID = JSC::noBreakpointID;
}
@@ -764,7 +765,7 @@
{
m_breakReason = breakReason;
m_breakAuxData = WTF::move(data);
- scriptDebugServer().breakProgram();
+ m_scriptDebugServer.breakProgram();
}
void InspectorDebuggerAgent::clearInspectorBreakpointState()
@@ -782,7 +783,7 @@
void InspectorDebuggerAgent::clearDebuggerBreakpointState()
{
- scriptDebugServer().clearBreakpoints();
+ m_scriptDebugServer.clearBreakpoints();
m_pausedScriptState = nullptr;
m_currentCallStack = Deprecated::ScriptValue();
@@ -794,7 +795,7 @@
m_javaScriptPauseScheduled = false;
m_hasExceptionValue = false;
- scriptDebugServer().continueProgram();
+ m_scriptDebugServer.continueProgram();
}
void InspectorDebuggerAgent::didClearGlobalObject()
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -43,10 +43,6 @@
#include <wtf/Vector.h>
#include <wtf/text/StringHash.h>
-namespace WTF {
-class Stopwatch;
-}
-
namespace Inspector {
class InjectedScript;
@@ -108,14 +104,14 @@
};
void setListener(Listener* listener) { m_listener = listener; }
- virtual ScriptDebugServer& scriptDebugServer() = 0;
-
protected:
InspectorDebuggerAgent(AgentContext&);
InjectedScriptManager& injectedScriptManager() const { return m_injectedScriptManager; }
virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
+ ScriptDebugServer& scriptDebugServer() { return m_scriptDebugServer; }
+
virtual void muteConsole() = 0;
virtual void unmuteConsole() = 0;
@@ -157,6 +153,7 @@
InjectedScriptManager& m_injectedScriptManager;
std::unique_ptr<DebuggerFrontendDispatcher> m_frontendDispatcher;
RefPtr<DebuggerBackendDispatcher> m_backendDispatcher;
+ ScriptDebugServer& m_scriptDebugServer;
Listener* m_listener { nullptr };
JSC::ExecState* m_pausedScriptState { nullptr };
Deprecated::ScriptValue m_currentCallStack;
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -60,6 +60,8 @@
InspectorRuntimeAgent::InspectorRuntimeAgent(AgentContext& context)
: InspectorAgentBase(ASCIILiteral("Runtime"))
, m_injectedScriptManager(context.injectedScriptManager)
+ , m_scriptDebugServer(context.environment.scriptDebugServer())
+ , m_vm(context.environment.vm())
{
}
@@ -67,12 +69,11 @@
{
}
-static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer* scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState)
+static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer& scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState)
{
- ASSERT(scriptDebugServer);
- ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer->pauseOnExceptionsState();
+ ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer.pauseOnExceptionsState();
if (presentState != newState)
- scriptDebugServer->setPauseOnExceptionsState(newState);
+ scriptDebugServer.setPauseOnExceptionsState(newState);
return presentState;
}
@@ -86,11 +87,10 @@
void InspectorRuntimeAgent::parse(ErrorString&, const String& _expression_, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range)
{
- VM& vm = globalVM();
- JSLockHolder lock(vm);
+ JSLockHolder lock(m_vm);
ParserError error;
- checkSyntax(vm, JSC::makeSource(_expression_), error);
+ checkSyntax(m_vm, JSC::makeSource(_expression_), error);
switch (error.syntaxErrorType()) {
case ParserError::SyntaxErrorNone:
@@ -249,15 +249,15 @@
void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const Inspector::InspectorArray& locations, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)
{
static const bool verbose = false;
- VM& vm = globalVM();
+
typeDescriptions = Inspector::Protocol::Array<Inspector::Protocol::Runtime::TypeDescription>::create();
- if (!vm.typeProfiler()) {
+ if (!m_vm.typeProfiler()) {
errorString = ASCIILiteral("The VM does not currently have Type Information.");
return;
}
double start = currentTimeMS();
- vm.typeProfilerLog()->processLogEntries(ASCIILiteral("User Query"));
+ m_vm.typeProfilerLog()->processLogEntries(ASCIILiteral("User Query"));
for (size_t i = 0; i < locations.length(); i++) {
RefPtr<Inspector::InspectorValue> value = locations.get(i);
@@ -275,7 +275,7 @@
location->getInteger(ASCIILiteral("divot"), divot);
bool okay;
- TypeLocation* typeLocation = vm.typeProfiler()->findLocation(divot, sourceIDAsString.toIntPtrStrict(&okay), static_cast<TypeProfilerSearchDescriptor>(descriptor), vm);
+ TypeLocation* typeLocation = m_vm.typeProfiler()->findLocation(divot, sourceIDAsString.toIntPtrStrict(&okay), static_cast<TypeProfilerSearchDescriptor>(descriptor), m_vm);
ASSERT(okay);
RefPtr<TypeSet> typeSet;
@@ -328,7 +328,7 @@
return;
m_isTypeProfilingEnabled = isTypeProfilingEnabled;
- VM& vm = globalVM();
+ VM& vm = m_vm;
vm.whenIdle([&vm, isTypeProfilingEnabled] () {
bool shouldRecompileFromTypeProfiler = (isTypeProfilingEnabled ? vm.enableTypeProfiler() : vm.disableTypeProfiler());
bool shouldRecompileFromControlFlowProfiler = (isTypeProfilingEnabled ? vm.enableControlFlowProfiler() : vm.disableControlFlowProfiler());
@@ -341,8 +341,7 @@
void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks)
{
- VM& vm = globalVM();
- if (!vm.controlFlowProfiler()) {
+ if (!m_vm.controlFlowProfiler()) {
errorString = ASCIILiteral("The VM does not currently have a Control Flow Profiler.");
return;
}
@@ -350,7 +349,7 @@
bool okay;
intptr_t sourceID = sourceIDAsString.toIntPtrStrict(&okay);
ASSERT(okay);
- const Vector<BasicBlockRange>& basicBlockRanges = vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, vm);
+ const Vector<BasicBlockRange>& basicBlockRanges = m_vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, m_vm);
basicBlocks = Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>::create();
for (const BasicBlockRange& block : basicBlockRanges) {
Ref<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -73,8 +73,6 @@
virtual void enableTypeProfiler(ErrorString&) override;
virtual void disableTypeProfiler(ErrorString&) override;
virtual void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
-
- void setScriptDebugServer(ScriptDebugServer* scriptDebugServer) { m_scriptDebugServer = scriptDebugServer; }
bool enabled() const { return m_enabled; }
@@ -83,7 +81,6 @@
InjectedScriptManager& injectedScriptManager() { return m_injectedScriptManager; }
- virtual JSC::VM& globalVM() = 0;
virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) = 0;
virtual void muteConsole() = 0;
@@ -93,9 +90,10 @@
void setTypeProfilerEnabledState(bool);
InjectedScriptManager& m_injectedScriptManager;
- ScriptDebugServer* m_scriptDebugServer { nullptr };
- bool m_enabled { false };
- bool m_isTypeProfilingEnabled { false };
+ ScriptDebugServer& m_scriptDebugServer;
+ JSC::VM& m_vm;
+ bool m_enabled {false};
+ bool m_isTypeProfilingEnabled {false};
};
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectDebuggerAgent.cpp (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectDebuggerAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectDebuggerAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -40,7 +40,6 @@
JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent(JSAgentContext& context, InspectorConsoleAgent* consoleAgent)
: InspectorDebuggerAgent(context)
- , m_scriptDebugServer(context.inspectedGlobalObject)
, m_consoleAgent(consoleAgent)
{
}
@@ -52,7 +51,7 @@
return InjectedScript();
}
- ExecState* exec = m_scriptDebugServer.globalObject().globalExec();
+ ExecState* exec = static_cast<JSGlobalObjectScriptDebugServer&>(scriptDebugServer()).globalObject().globalExec();
return injectedScriptManager().injectedScriptFor(exec);
}
Modified: trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectDebuggerAgent.h (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectDebuggerAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectDebuggerAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -40,8 +40,6 @@
JSGlobalObjectDebuggerAgent(JSAgentContext&, InspectorConsoleAgent*);
virtual ~JSGlobalObjectDebuggerAgent() { }
- virtual JSGlobalObjectScriptDebugServer& scriptDebugServer() override { return m_scriptDebugServer; }
-
virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
virtual void breakpointActionLog(JSC::ExecState*, const String&) override;
@@ -52,7 +50,6 @@
virtual void unmuteConsole() override { }
private:
- JSGlobalObjectScriptDebugServer m_scriptDebugServer;
InspectorConsoleAgent* m_consoleAgent { nullptr };
};
Modified: trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectRuntimeAgent.cpp (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectRuntimeAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectRuntimeAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -46,11 +46,6 @@
{
}
-VM& JSGlobalObjectRuntimeAgent::globalVM()
-{
- return m_globalObject.vm();
-}
-
InjectedScript JSGlobalObjectRuntimeAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
{
ASSERT_UNUSED(executionContextId, !executionContextId);
Modified: trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectRuntimeAgent.h (192060 => 192061)
--- trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectRuntimeAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/_javascript_Core/inspector/agents/JSGlobalObjectRuntimeAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -40,7 +40,6 @@
virtual void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
- virtual JSC::VM& globalVM() override;
virtual InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
// NOTE: _javascript_ inspector does not yet need to mute a console because no messages
Modified: trunk/Source/WebCore/ChangeLog (192060 => 192061)
--- trunk/Source/WebCore/ChangeLog 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/ChangeLog 2015-11-05 19:22:42 UTC (rev 192061)
@@ -1,3 +1,72 @@
+2015-11-05 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Put ScriptDebugServer into InspectorEnvironment and cleanup duplicate references
+ https://bugs.webkit.org/show_bug.cgi?id=150869
+
+ Reviewed by Brian Burg.
+
+ Refactoring covered by existing tests.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Privately export PageScriptDebuggerAgent.h due to InspectorController.h needing it.
+
+ * inspector/InspectorController.h:
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ (WebCore::InspectorController::scriptDebugServer):
+ Own the PageScriptDebugServer.
+
+ * inspector/WorkerInspectorController.h:
+ * inspector/WorkerInspectorController.cpp:
+ (WebCore::WorkerInspectorController::WorkerInspectorController):
+ (WebCore::WorkerInspectorController::scriptDebugServer):
+ Own the WorkerScriptDebugServer.
+
+ (WebCore::WorkerInspectorController::vm):
+ Use the VM accessed through the worker global object.
+
+ * inspector/InspectorWebAgentBase.h:
+ (WebCore::InspectorAgentBase::InspectorAgentBase):
+ Given Web agents a m_environment convenience to access the InspectorEnvironment.
+
+ * inspector/InspectorNetworkAgent.cpp:
+ (WebCore::InspectorNetworkAgent::timestamp):
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::timestamp):
+ (WebCore::InspectorPageAgent::enable):
+ (WebCore::InspectorPageAgent::frameStartedLoading):
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::didCreateFrontendAndBackend):
+ (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
+ (WebCore::InspectorTimelineAgent::internalStart):
+ (WebCore::InspectorTimelineAgent::internalStop):
+ (WebCore::InspectorTimelineAgent::timestamp):
+ (WebCore::InspectorTimelineAgent::startFromConsole):
+ (WebCore::InspectorTimelineAgent::willCallFunction):
+ (WebCore::InspectorTimelineAgent::willEvaluateScript):
+ (WebCore::InspectorTimelineAgent::setPageScriptDebugServer): Deleted.
+ * inspector/InspectorTimelineAgent.h:
+ Use the InspectorEnvironment for VM / ScriptDebugServer.
+
+ * inspector/PageDebuggerAgent.cpp:
+ (WebCore::PageDebuggerAgent::PageDebuggerAgent): Deleted.
+ (WebCore::PageDebuggerAgent::scriptDebugServer): Deleted.
+ * inspector/PageDebuggerAgent.h:
+ * inspector/PageRuntimeAgent.cpp:
+ (WebCore::PageRuntimeAgent::globalVM): Deleted.
+ * inspector/PageRuntimeAgent.h:
+ * inspector/WorkerDebuggerAgent.h:
+ * inspector/WorkerRuntimeAgent.cpp:
+ (WebCore::WorkerRuntimeAgent::globalVM): Deleted.
+ * inspector/WorkerRuntimeAgent.h:
+ * inspector/WorkerDebuggerAgent.cpp:
+ (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): Deleted.
+ (WebCore::WorkerDebuggerAgent::scriptDebugServer): Deleted.
+ Remove now unnecessary subclass code.
+
+ (WebCore::WorkerDebuggerAgent::interruptAndDispatchInspectorCommands):
+ One more special case for accessing Worker properties from the ScriptDebugServer.
+
2015-11-05 Xabier Rodriguez Calvar <[email protected]>
[Streams API] Shield implementation from user mangling Promise.reject and resolve methods
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (192060 => 192061)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-11-05 19:22:42 UTC (rev 192061)
@@ -4124,7 +4124,7 @@
A5E616731894581F009ADF50 /* WebDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5E616711894581F009ADF50 /* WebDebuggerAgent.cpp */; };
A5E616741894581F009ADF50 /* WebDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E616721894581F009ADF50 /* WebDebuggerAgent.h */; };
A5F36D3A18F758720054C024 /* PageScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F36D3818F758720054C024 /* PageScriptDebugServer.cpp */; };
- A5F36D3B18F758720054C024 /* PageScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A5F36D3918F758720054C024 /* PageScriptDebugServer.h */; };
+ A5F36D3B18F758720054C024 /* PageScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A5F36D3918F758720054C024 /* PageScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */; };
A6148A6212E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A6112E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h */; };
A6148A6712E41D940044A784 /* DOMHTMLKeygenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A6512E41D940044A784 /* DOMHTMLKeygenElement.h */; };
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -91,6 +91,7 @@
, m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
, m_overlay(std::make_unique<InspectorOverlay>(page, inspectorClient))
, m_executionStopwatch(Stopwatch::create())
+ , m_scriptDebugServer(page)
, m_page(page)
, m_inspectorClient(inspectorClient)
{
@@ -180,9 +181,6 @@
, databaseAgent
);
}
-
- runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
- m_timelineAgent->setPageScriptDebugServer(&debuggerAgent->scriptDebugServer());
}
InspectorController::~InspectorController()
@@ -471,6 +469,11 @@
return m_executionStopwatch.copyRef();
}
+PageScriptDebugServer& InspectorController::scriptDebugServer()
+{
+ return m_scriptDebugServer;
+}
+
JSC::VM& InspectorController::vm()
{
return JSDOMWindowBase::commonVM();
Modified: trunk/Source/WebCore/inspector/InspectorController.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorController.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -33,6 +33,7 @@
#define InspectorController_h
#include "InspectorOverlay.h"
+#include "PageScriptDebugServer.h"
#include <inspector/InspectorAgentRegistry.h>
#include <inspector/InspectorEnvironment.h>
#include <wtf/Forward.h>
@@ -124,6 +125,7 @@
virtual void didCallInjectedScriptFunction(JSC::ExecState*) override;
virtual void frontendInitialized() override;
virtual Ref<WTF::Stopwatch> executionStopwatch() override;
+ virtual PageScriptDebugServer& scriptDebugServer() override;
virtual JSC::VM& vm() override;
WEBCORE_EXPORT void didComposite(Frame&);
@@ -137,6 +139,7 @@
Ref<Inspector::BackendDispatcher> m_backendDispatcher;
std::unique_ptr<InspectorOverlay> m_overlay;
Ref<WTF::Stopwatch> m_executionStopwatch;
+ PageScriptDebugServer m_scriptDebugServer;
Inspector::AgentRegistry m_agents;
Page& m_page;
Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -266,7 +266,7 @@
double InspectorNetworkAgent::timestamp()
{
- return m_instrumentingAgents.inspectorEnvironment().executionStopwatch()->elapsedTime();
+ return m_environment.executionStopwatch()->elapsedTime();
}
void InspectorNetworkAgent::willSendRequest(unsigned long identifier, DocumentLoader& loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -351,7 +351,7 @@
double InspectorPageAgent::timestamp()
{
- return m_instrumentingAgents.inspectorEnvironment().executionStopwatch()->elapsedTime();
+ return m_environment.executionStopwatch()->elapsedTime();
}
void InspectorPageAgent::enable(ErrorString&)
@@ -359,7 +359,7 @@
m_enabled = true;
m_instrumentingAgents.setInspectorPageAgent(this);
- auto stopwatch = m_instrumentingAgents.inspectorEnvironment().executionStopwatch();
+ auto stopwatch = m_environment.executionStopwatch();
stopwatch->reset();
stopwatch->start();
@@ -804,7 +804,7 @@
void InspectorPageAgent::frameStartedLoading(Frame& frame)
{
if (frame.isMainFrame()) {
- auto stopwatch = m_instrumentingAgents.inspectorEnvironment().executionStopwatch();
+ auto stopwatch = m_environment.executionStopwatch();
stopwatch->reset();
stopwatch->start();
}
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -85,18 +85,17 @@
{
m_instrumentingAgents.setPersistentInspectorTimelineAgent(this);
- if (m_scriptDebugServer)
- m_scriptDebugServer->recompileAllJSFunctions();
+ // Recompile to include profiling information.
+ // FIXME: This doesn't seem like the most appropriate place.
+ m_environment.scriptDebugServer().recompileAllJSFunctions();
}
void InspectorTimelineAgent::willDestroyFrontendAndBackend(Inspector::DisconnectReason reason)
{
m_instrumentingAgents.setPersistentInspectorTimelineAgent(nullptr);
- if (reason != Inspector::DisconnectReason::InspectedTargetDestroyed) {
- if (m_scriptDebugServer)
- m_scriptDebugServer->recompileAllJSFunctions();
- }
+ if (reason != Inspector::DisconnectReason::InspectedTargetDestroyed)
+ m_environment.scriptDebugServer().recompileAllJSFunctions();
ErrorString unused;
stop(unused);
@@ -128,8 +127,7 @@
m_instrumentingAgents.setInspectorTimelineAgent(this);
- if (m_scriptDebugServer)
- m_scriptDebugServer->addListener(this);
+ m_environment.scriptDebugServer().addListener(this);
m_enabled = true;
@@ -137,7 +135,7 @@
#if PLATFORM(COCOA)
m_frameStartObserver = RunLoopObserver::create(0, [this]() {
- if (!m_enabled || m_scriptDebugServer->isPaused())
+ if (!m_enabled || m_environment.scriptDebugServer().isPaused())
return;
if (!m_runLoopNestingLevel)
@@ -146,7 +144,7 @@
});
m_frameStopObserver = RunLoopObserver::create(frameStopRunLoopOrder, [this]() {
- if (!m_enabled || m_scriptDebugServer->isPaused())
+ if (!m_enabled || m_environment.scriptDebugServer().isPaused())
return;
ASSERT(m_runLoopNestingLevel > 0);
@@ -180,8 +178,7 @@
m_instrumentingAgents.setInspectorTimelineAgent(nullptr);
- if (m_scriptDebugServer)
- m_scriptDebugServer->removeListener(this, true);
+ m_environment.scriptDebugServer().removeListener(this, true);
#if PLATFORM(COCOA)
m_frameStartObserver = nullptr;
@@ -203,17 +200,9 @@
double InspectorTimelineAgent::timestamp()
{
- return m_instrumentingAgents.inspectorEnvironment().executionStopwatch()->elapsedTime();
+ return m_environment.executionStopwatch()->elapsedTime();
}
-void InspectorTimelineAgent::setPageScriptDebugServer(PageScriptDebugServer* scriptDebugServer)
-{
- ASSERT(!m_enabled);
- ASSERT(!m_scriptDebugServer);
-
- m_scriptDebugServer = scriptDebugServer;
-}
-
static inline void startProfiling(JSC::ExecState* exec, const String& title, RefPtr<Stopwatch>&& stopwatch)
{
JSC::LegacyProfiler::profiler()->startProfiling(exec, title, WTF::move(stopwatch));
@@ -250,7 +239,7 @@
if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
internalStart();
- startProfiling(exec, title, m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
+ startProfiling(exec, title, m_environment.executionStopwatch());
m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
}
@@ -289,7 +278,7 @@
pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);
if (frame && !m_callStackDepth)
- startProfiling(frame, ASCIILiteral("Timeline FunctionCall"), m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
+ startProfiling(frame, ASCIILiteral("Timeline FunctionCall"), m_environment.executionStopwatch());
++m_callStackDepth;
}
@@ -421,7 +410,7 @@
if (!m_callStackDepth) {
++m_callStackDepth;
- startProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"), m_instrumentingAgents.inspectorEnvironment().executionStopwatch());
+ startProfiling(&frame, ASCIILiteral("Timeline EvaluateScript"), m_environment.executionStopwatch());
}
}
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -51,7 +51,6 @@
class FloatQuad;
class Frame;
class InspectorPageAgent;
-class PageScriptDebugServer;
class RenderObject;
class RunLoopObserver;
@@ -106,8 +105,6 @@
int id() const { return m_id; }
- void setPageScriptDebugServer(PageScriptDebugServer*);
-
void didCommitLoad();
// Methods called from WebCore.
@@ -199,8 +196,6 @@
RefPtr<Inspector::TimelineBackendDispatcher> m_backendDispatcher;
InspectorPageAgent* m_pageAgent;
- PageScriptDebugServer* m_scriptDebugServer { nullptr };
-
Vector<TimelineRecordEntry> m_recordStack;
int m_id { 1 };
int m_callStackDepth { 0 };
Modified: trunk/Source/WebCore/inspector/InspectorWebAgentBase.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/InspectorWebAgentBase.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/InspectorWebAgentBase.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -72,10 +72,12 @@
InspectorAgentBase(const String& name, WebAgentContext& context)
: Inspector::InspectorAgentBase(name)
, m_instrumentingAgents(context.instrumentingAgents)
+ , m_environment(context.environment)
{
}
InstrumentingAgents& m_instrumentingAgents;
+ Inspector::InspectorEnvironment& m_environment;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -56,7 +56,6 @@
, m_page(context.inspectedPage)
, m_pageAgent(pageAgent)
, m_overlay(overlay)
- , m_scriptDebugServer(m_page)
{
}
@@ -93,11 +92,6 @@
return InspectorDebuggerAgent::sourceMapURLForScript(script);
}
-PageScriptDebugServer& PageDebuggerAgent::scriptDebugServer()
-{
- return m_scriptDebugServer;
-}
-
void PageDebuggerAgent::muteConsole()
{
PageConsoleClient::mute();
Modified: trunk/Source/WebCore/inspector/PageDebuggerAgent.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/PageDebuggerAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/PageDebuggerAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -32,7 +32,6 @@
#ifndef PageDebuggerAgent_h
#define PageDebuggerAgent_h
-#include "PageScriptDebugServer.h"
#include "WebDebuggerAgent.h"
namespace WebCore {
@@ -40,7 +39,6 @@
class InspectorOverlay;
class InspectorPageAgent;
class Page;
-class PageScriptDebugServer;
class PageDebuggerAgent final : public WebDebuggerAgent {
WTF_MAKE_NONCOPYABLE(PageDebuggerAgent);
@@ -55,8 +53,6 @@
void mainFrameStoppedLoading();
void mainFrameNavigated();
- virtual PageScriptDebugServer& scriptDebugServer() override;
-
protected:
virtual void enable() override;
virtual void disable(bool isBeingDestroyed) override;
@@ -76,7 +72,6 @@
InspectorPageAgent* m_pageAgent;
InspectorOverlay* m_overlay { nullptr };
- PageScriptDebugServer m_scriptDebugServer;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -108,11 +108,6 @@
notifyContextCreated(frameId, scriptState, nullptr, true);
}
-JSC::VM& PageRuntimeAgent::globalVM()
-{
- return JSDOMWindowBase::commonVM();
-}
-
InjectedScript PageRuntimeAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
{
if (!executionContextId) {
Modified: trunk/Source/WebCore/inspector/PageRuntimeAgent.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/PageRuntimeAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/PageRuntimeAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -67,7 +67,6 @@
void didCreateMainWorldContext(Frame&);
private:
- virtual JSC::VM& globalVM() override;
virtual Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
virtual void muteConsole() override;
virtual void unmuteConsole() override;
Modified: trunk/Source/WebCore/inspector/WorkerDebuggerAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/WorkerDebuggerAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/WorkerDebuggerAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -33,6 +33,7 @@
#include "WorkerDebuggerAgent.h"
#include "WorkerGlobalScope.h"
+#include "WorkerScriptDebugServer.h"
#include "WorkerThread.h"
#include <inspector/InjectedScript.h>
#include <inspector/InjectedScriptManager.h>
@@ -83,7 +84,6 @@
WorkerDebuggerAgent::WorkerDebuggerAgent(WorkerAgentContext& context)
: WebDebuggerAgent(context)
- , m_scriptDebugServer(context.workerGlobalScope, WorkerDebuggerAgent::debuggerTaskMode)
, m_inspectedWorkerGlobalScope(context.workerGlobalScope)
{
std::lock_guard<StaticLock> lock(workerDebuggerAgentsMutex);
@@ -102,8 +102,10 @@
{
std::lock_guard<StaticLock> lock(workerDebuggerAgentsMutex);
- if (WorkerDebuggerAgent* agent = workerDebuggerAgents().get(thread))
- agent->m_scriptDebugServer.interruptAndRunTask(std::make_unique<RunInspectorCommandsTask>(thread, &agent->m_inspectedWorkerGlobalScope));
+ if (WorkerDebuggerAgent* agent = workerDebuggerAgents().get(thread)) {
+ WorkerScriptDebugServer& workerScriptDebugServer = static_cast<WorkerScriptDebugServer&>(agent->scriptDebugServer());
+ workerScriptDebugServer.interruptAndRunTask(std::make_unique<RunInspectorCommandsTask>(thread, &agent->m_inspectedWorkerGlobalScope));
+ }
}
void WorkerDebuggerAgent::breakpointActionLog(JSC::ExecState*, const String& message)
@@ -111,11 +113,6 @@
m_inspectedWorkerGlobalScope.addConsoleMessage(MessageSource::JS, MessageLevel::Log, message);
}
-WorkerScriptDebugServer& WorkerDebuggerAgent::scriptDebugServer()
-{
- return m_scriptDebugServer;
-}
-
InjectedScript WorkerDebuggerAgent::injectedScriptForEval(ErrorString& error, const int* executionContextId)
{
if (executionContextId) {
Modified: trunk/Source/WebCore/inspector/WorkerDebuggerAgent.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/WorkerDebuggerAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/WorkerDebuggerAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -33,7 +33,6 @@
#define WorkerDebuggerAgent_h
#include "WebDebuggerAgent.h"
-#include "WorkerScriptDebugServer.h"
namespace WebCore {
@@ -50,7 +49,6 @@
static const char* debuggerTaskMode;
static void interruptAndDispatchInspectorCommands(WorkerThread*);
- virtual WorkerScriptDebugServer& scriptDebugServer() override;
virtual Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
virtual void muteConsole() override;
virtual void unmuteConsole() override;
@@ -58,7 +56,6 @@
virtual void breakpointActionLog(JSC::ExecState*, const String&) override;
private:
- WorkerScriptDebugServer m_scriptDebugServer;
WorkerGlobalScope& m_inspectedWorkerGlobalScope;
};
Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/WorkerInspectorController.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -83,6 +83,7 @@
, m_instrumentingAgents(InstrumentingAgents::create(*this))
, m_injectedScriptManager(std::make_unique<WebInjectedScriptManager>(*this, WebInjectedScriptHost::create()))
, m_executionStopwatch(Stopwatch::create())
+ , m_scriptDebugServer(workerGlobalScope, WorkerDebuggerAgent::debuggerTaskMode)
, m_frontendRouter(FrontendRouter::create())
, m_backendDispatcher(BackendDispatcher::create(m_frontendRouter.copyRef()))
{
@@ -112,7 +113,6 @@
m_instrumentingAgents->setWebConsoleAgent(consoleAgent.get());
auto debuggerAgent = std::make_unique<WorkerDebuggerAgent>(workerContext);
- m_runtimeAgent->setScriptDebugServer(&debuggerAgent->scriptDebugServer());
m_agents.append(WTF::move(debuggerAgent));
m_agents.append(std::make_unique<InspectorTimelineAgent>(workerContext, nullptr, InspectorTimelineAgent::WorkerInspector));
@@ -197,9 +197,14 @@
return m_executionStopwatch.copyRef();
}
+WorkerScriptDebugServer& WorkerInspectorController::scriptDebugServer()
+{
+ return m_scriptDebugServer;
+}
+
VM& WorkerInspectorController::vm()
{
- return JSDOMWindowBase::commonVM();
+ return m_workerGlobalScope.vm();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/WorkerInspectorController.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -34,12 +34,11 @@
#include "InspectorInstrumentationCookie.h"
#include "InspectorWebAgentBase.h"
+#include "WorkerScriptDebugServer.h"
#include <inspector/InspectorAgentRegistry.h>
#include <inspector/InspectorEnvironment.h>
-#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
-#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace Inspector {
@@ -75,6 +74,7 @@
virtual void didCallInjectedScriptFunction(JSC::ExecState*) override;
virtual void frontendInitialized() override { }
virtual Ref<WTF::Stopwatch> executionStopwatch() override;
+ virtual WorkerScriptDebugServer& scriptDebugServer() override;
virtual JSC::VM& vm() override;
private:
@@ -87,6 +87,7 @@
Inspector::AgentRegistry m_agents;
std::unique_ptr<Inspector::FrontendChannel> m_forwardingChannel;
Ref<WTF::Stopwatch> m_executionStopwatch;
+ WorkerScriptDebugServer m_scriptDebugServer;
Ref<Inspector::FrontendRouter> m_frontendRouter;
Ref<Inspector::BackendDispatcher> m_backendDispatcher;
Vector<InspectorInstrumentationCookie, 2> m_injectedScriptInstrumentationCookies;
Modified: trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp (192060 => 192061)
--- trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/WorkerRuntimeAgent.cpp 2015-11-05 19:22:42 UTC (rev 192061)
@@ -89,11 +89,6 @@
m_paused = false;
}
-JSC::VM& WorkerRuntimeAgent::globalVM()
-{
- return JSDOMWindowBase::commonVM();
-}
-
void WorkerRuntimeAgent::pauseWorkerGlobalScope(WorkerGlobalScope* context)
{
m_paused = true;
Modified: trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h (192060 => 192061)
--- trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h 2015-11-05 18:30:51 UTC (rev 192060)
+++ trunk/Source/WebCore/inspector/WorkerRuntimeAgent.h 2015-11-05 19:22:42 UTC (rev 192061)
@@ -53,7 +53,6 @@
void pauseWorkerGlobalScope(WorkerGlobalScope*);
private:
- virtual JSC::VM& globalVM() override;
virtual Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
virtual void muteConsole() override;
virtual void unmuteConsole() override;