#ifndef InspectorDebuggerAgent_h
#define InspectorDebuggerAgent_h
-#include "InspectorFrontend.h"
-#include "bindings/v8/ScriptState.h"
+#include "bindings/core/v8/ScriptState.h"
+#include "core/InspectorFrontend.h"
#include "core/frame/ConsoleTypes.h"
#include "core/inspector/AsyncCallStackTracker.h"
#include "core/inspector/ConsoleAPITypes.h"
#include "wtf/Vector.h"
#include "wtf/text/StringHash.h"
-namespace WebCore {
+namespace blink {
class Document;
+class Event;
class EventListener;
class EventTarget;
class ExecutionContextTask;
class InjectedScriptManager;
class InspectorFrontend;
class InstrumentingAgents;
+class JavaScriptCallFrame;
class JSONObject;
class KURL;
class MutationObserver;
class ScriptArguments;
+class ScriptAsyncCallStack;
class ScriptCallStack;
class ScriptDebugServer;
class ScriptRegexp;
typedef String ErrorString;
class InspectorDebuggerAgent : public InspectorBaseAgent<InspectorDebuggerAgent>, public ScriptDebugListener, public InspectorBackendDispatcher::DebuggerCommandHandler {
- WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent);
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
enum BreakpointSource {
UserBreakpointSource,
static const char backtraceObjectGroup[];
virtual ~InspectorDebuggerAgent();
+ virtual void trace(Visitor*);
virtual void canSetScriptSource(ErrorString*, bool* result) OVERRIDE FINAL { *result = true; }
bool isPaused();
bool runningNestedMessageLoop();
- void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, PassRefPtr<ScriptCallStack>, unsigned long);
- void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String&, ScriptState*, PassRefPtr<ScriptArguments>, unsigned long);
+ void addConsoleAPIMessageToConsole(MessageType, MessageLevel, const String&, ScriptState*, PassRefPtrWillBeRawPtr<ScriptArguments>, unsigned long);
- String preprocessEventListener(Frame*, const String& source, const String& url, const String& functionName);
- PassOwnPtr<ScriptSourceCode> preprocess(Frame*, const ScriptSourceCode&);
+ String preprocessEventListener(LocalFrame*, const String& source, const String& url, const String& functionName);
+ PassOwnPtr<ScriptSourceCode> preprocess(LocalFrame*, const ScriptSourceCode&);
// Part of the protocol.
virtual void enable(ErrorString*) OVERRIDE FINAL;
virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>&) OVERRIDE FINAL;
virtual void pause(ErrorString*) OVERRIDE FINAL;
virtual void resume(ErrorString*) OVERRIDE FINAL;
- virtual void stepOver(ErrorString*, const String* callFrameId) OVERRIDE FINAL;
+ virtual void stepOver(ErrorString*) OVERRIDE FINAL;
virtual void stepInto(ErrorString*) OVERRIDE FINAL;
- virtual void stepOut(ErrorString*, const String* callFrameId) OVERRIDE FINAL;
+ virtual void stepOut(ErrorString*) OVERRIDE FINAL;
virtual void setPauseOnExceptions(ErrorString*, const String& pauseState) OVERRIDE FINAL;
virtual void evaluateOnCallFrame(ErrorString*,
const String& callFrameId,
const bool* returnByValue,
const bool* generatePreview,
RefPtr<TypeBuilder::Runtime::RemoteObject>& result,
- TypeBuilder::OptOutput<bool>* wasThrown) OVERRIDE FINAL;
- virtual void compileScript(ErrorString*, const String& expression, const String& sourceURL, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>*, TypeBuilder::OptOutput<String>* syntaxErrorMessage) OVERRIDE;
- virtual void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) OVERRIDE;
+ TypeBuilder::OptOutput<bool>* wasThrown,
+ RefPtr<TypeBuilder::Debugger::ExceptionDetails>&) OVERRIDE FINAL;
+ virtual void compileScript(ErrorString*, const String& expression, const String& sourceURL, const int* executionContextId, TypeBuilder::OptOutput<TypeBuilder::Debugger::ScriptId>*, RefPtr<TypeBuilder::Debugger::ExceptionDetails>&) OVERRIDE;
+ virtual void runScript(ErrorString*, const TypeBuilder::Debugger::ScriptId&, const int* executionContextId, const String* objectGroup, const bool* doNotPauseOnExceptionsAndMuteConsole, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, RefPtr<TypeBuilder::Debugger::ExceptionDetails>&) OVERRIDE;
virtual void setOverlayMessage(ErrorString*, const String*) OVERRIDE;
virtual void setVariableValue(ErrorString*, int in_scopeNumber, const String& in_variableName, const RefPtr<JSONObject>& in_newValue, const String* in_callFrame, const String* in_functionObjectId) OVERRIDE FINAL;
virtual void skipStackFrames(ErrorString*, const String* pattern) OVERRIDE FINAL;
void didCancelAnimationFrame(Document*, int callbackId);
bool willFireAnimationFrame(Document*, int callbackId);
void didFireAnimationFrame();
- void didAddEventListener(EventTarget*, const AtomicString& eventType, EventListener*, bool useCapture);
- void didRemoveEventListener(EventTarget*, const AtomicString& eventType, EventListener*, bool useCapture);
- void didRemoveAllEventListeners(EventTarget*);
- void willHandleEvent(EventTarget*, const AtomicString& eventType, EventListener*, bool useCapture);
+ void didEnqueueEvent(EventTarget*, Event*);
+ void didRemoveEvent(EventTarget*, Event*);
+ void willHandleEvent(EventTarget*, Event*, EventListener*, bool useCapture);
void didHandleEvent();
- void willLoadXHR(XMLHttpRequest*, ThreadableLoaderClient*, const AtomicString& method, const KURL&, bool async, PassRefPtr<FormData> body, const HTTPHeaderMap& headers, bool includeCrendentials);
+ void willLoadXHR(XMLHttpRequest*, ThreadableLoaderClient*, const AtomicString& method, const KURL&, bool async, FormData* body, const HTTPHeaderMap& headers, bool includeCrendentials);
+ void didDispatchXHRLoadendEvent(XMLHttpRequest*);
void didEnqueueMutationRecord(ExecutionContext*, MutationObserver*);
void didClearAllMutationRecords(ExecutionContext*, MutationObserver*);
void willDeliverMutationRecords(ExecutionContext*, MutationObserver*);
void didDeliverMutationRecords();
- void didPostPromiseTask(ExecutionContext*, ExecutionContextTask*, bool isResolved);
- void willPerformPromiseTask(ExecutionContext*, ExecutionContextTask*);
- void didPerformPromiseTask();
+ void didPostExecutionContextTask(ExecutionContext*, ExecutionContextTask*);
+ void didKillAllExecutionContextTasks(ExecutionContext*);
+ void willPerformExecutionContextTask(ExecutionContext*, ExecutionContextTask*);
+ void didPerformExecutionContextTask();
+ int traceAsyncOperationStarting(ExecutionContext*, const String& operationName, int prevOperationId = 0);
+ void traceAsyncOperationCompleted(ExecutionContext*, int operationId);
+ void traceAsyncOperationCompletedCallbackStarting(ExecutionContext*, int operationId);
+ void traceAsyncCallbackStarting(ExecutionContext*, int operationId);
+ void traceAsyncCallbackCompleted();
bool canBreakProgram();
void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<JSONObject> data);
void scriptExecutionBlockedByCSP(const String& directiveText);
- class Listener {
+ class Listener : public WillBeGarbageCollectedMixin {
public:
virtual ~Listener() { }
virtual void debuggerWasEnabled() = 0;
};
void setListener(Listener* listener) { m_listener = listener; }
+ bool enabled();
+
virtual ScriptDebugServer& scriptDebugServer() = 0;
void setBreakpoint(const String& scriptId, int lineNumber, int columnNumber, BreakpointSource, const String& condition = String());
void removeBreakpoint(const String& scriptId, int lineNumber, int columnNumber, BreakpointSource);
- virtual SkipPauseRequest shouldSkipExceptionPause(RefPtr<JavaScriptCallFrame>& topFrame) OVERRIDE FINAL;
- virtual SkipPauseRequest shouldSkipBreakpointPause(RefPtr<JavaScriptCallFrame>& topFrame) OVERRIDE FINAL;
- virtual SkipPauseRequest shouldSkipStepPause(RefPtr<JavaScriptCallFrame>& topFrame) OVERRIDE FINAL;
+ PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> currentAsyncStackTraceForConsole();
protected:
explicit InspectorDebuggerAgent(InjectedScriptManager*);
virtual void enable();
virtual void disable();
- virtual void didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints) OVERRIDE FINAL;
+ virtual SkipPauseRequest didPause(ScriptState*, const ScriptValue& callFrames, const ScriptValue& exception, const Vector<String>& hitBreakpoints) OVERRIDE FINAL;
virtual void didContinue() OVERRIDE FINAL;
void reset();
void pageDidCommitLoad();
private:
+ SkipPauseRequest shouldSkipExceptionPause();
+ SkipPauseRequest shouldSkipStepPause();
+ bool isTopCallFrameInFramework();
+
void cancelPauseOnNextStatement();
void addMessageToConsole(MessageSource, MessageType);
- bool enabled();
-
PassRefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> > currentCallFrames();
PassRefPtr<TypeBuilder::Debugger::StackTrace> currentAsyncStackTrace();
- virtual void didParseSource(const String& scriptId, const Script&) OVERRIDE FINAL;
- virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) OVERRIDE FINAL;
+ virtual void didParseSource(const String& scriptId, const Script&, CompileResult) OVERRIDE FINAL;
+ virtual void didReceiveV8AsyncTaskEvent(ExecutionContext*, const String& eventType, const String& eventName, int id) OVERRIDE FINAL;
void setPauseOnExceptionsImpl(ErrorString*, int);
bool assertPaused(ErrorString*);
void clearBreakDetails();
- String sourceMapURLForScript(const Script&);
+ String sourceMapURLForScript(const Script&, CompileResult);
+ PassRefPtrWillBeRawPtr<JavaScriptCallFrame> topCallFrameSkipUnknownSources();
String scriptURL(JavaScriptCallFrame*);
-
- ScriptValue resolveCallFrame(ErrorString*, const String* callFrameId);
+ AsyncCallStackTracker& asyncCallStackTracker() { return *m_asyncCallStackTracker; };
typedef HashMap<String, Script> ScriptsMap;
typedef HashMap<String, Vector<String> > BreakpointIdToDebugServerBreakpointIdsMap;
typedef HashMap<String, std::pair<String, BreakpointSource> > DebugServerBreakpointToBreakpointIdAndSourceMap;
- InjectedScriptManager* m_injectedScriptManager;
+ RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager;
InspectorFrontend::Debugger* m_frontend;
- ScriptState* m_pausedScriptState;
+ RefPtr<ScriptState> m_pausedScriptState;
ScriptValue m_currentCallStack;
ScriptsMap m_scripts;
BreakpointIdToDebugServerBreakpointIdsMap m_breakpointIdToDebugServerBreakpointIds;
InspectorFrontend::Debugger::Reason::Enum m_breakReason;
RefPtr<JSONObject> m_breakAuxData;
bool m_javaScriptPauseScheduled;
- Listener* m_listener;
+ bool m_debuggerStepScheduled;
+ bool m_steppingFromFramework;
+ bool m_pausingOnNativeEvent;
+ RawPtrWillBeMember<Listener> m_listener;
- int m_skipStepInCount;
+ int m_skippedStepInCount;
+ int m_minFrameCountForSkip;
bool m_skipAllPauses;
OwnPtr<ScriptRegexp> m_cachedSkipStackRegExp;
- AsyncCallStackTracker m_asyncCallStackTracker;
+ OwnPtrWillBeMember<AsyncCallStackTracker> m_asyncCallStackTracker;
};
-} // namespace WebCore
+} // namespace blink
#endif // !defined(InspectorDebuggerAgent_h)