Commit efdc8ace authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] migrate Debugger to new style

BUG=none
R=dgozman@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://codereview.chromium.org/2471583003
Cr-Commit-Position: refs/heads/master@{#40782}
parent 3019b497
This diff is collapsed.
......@@ -24,8 +24,8 @@ class V8InspectorSessionImpl;
class V8Regex;
class V8StackTraceImpl;
using protocol::ErrorString;
using protocol::Maybe;
using protocol::Response;
class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
public:
......@@ -49,67 +49,64 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
void restore();
// Part of the protocol.
void enable(ErrorString*) override;
void disable(ErrorString*) override;
void setBreakpointsActive(ErrorString*, bool active) override;
void setSkipAllPauses(ErrorString*, bool skip) override;
void setBreakpointByUrl(
ErrorString*, int lineNumber, const Maybe<String16>& optionalURL,
const Maybe<String16>& optionalURLRegex,
const Maybe<int>& optionalColumnNumber,
const Maybe<String16>& optionalCondition, String16*,
Response enable() override;
Response disable() override;
Response setBreakpointsActive(bool active) override;
Response setSkipAllPauses(bool skip) override;
Response setBreakpointByUrl(
int lineNumber, Maybe<String16> optionalURL,
Maybe<String16> optionalURLRegex, Maybe<int> optionalColumnNumber,
Maybe<String16> optionalCondition, String16*,
std::unique_ptr<protocol::Array<protocol::Debugger::Location>>* locations)
override;
void setBreakpoint(
ErrorString*, std::unique_ptr<protocol::Debugger::Location>,
const Maybe<String16>& optionalCondition, String16*,
Response setBreakpoint(
std::unique_ptr<protocol::Debugger::Location>,
Maybe<String16> optionalCondition, String16*,
std::unique_ptr<protocol::Debugger::Location>* actualLocation) override;
void removeBreakpoint(ErrorString*, const String16& breakpointId) override;
void continueToLocation(
ErrorString*, std::unique_ptr<protocol::Debugger::Location>) override;
void searchInContent(
ErrorString*, const String16& scriptId, const String16& query,
const Maybe<bool>& optionalCaseSensitive,
const Maybe<bool>& optionalIsRegex,
Response removeBreakpoint(const String16& breakpointId) override;
Response continueToLocation(
std::unique_ptr<protocol::Debugger::Location>) override;
Response searchInContent(
const String16& scriptId, const String16& query,
Maybe<bool> optionalCaseSensitive, Maybe<bool> optionalIsRegex,
std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>>*)
override;
void setScriptSource(
ErrorString*, const String16& inScriptId, const String16& inScriptSource,
const Maybe<bool>& dryRun,
Response setScriptSource(
const String16& inScriptId, const String16& inScriptSource,
Maybe<bool> dryRun,
Maybe<protocol::Array<protocol::Debugger::CallFrame>>* optOutCallFrames,
Maybe<bool>* optOutStackChanged,
Maybe<protocol::Runtime::StackTrace>* optOutAsyncStackTrace,
Maybe<protocol::Runtime::ExceptionDetails>* optOutCompileError) override;
void restartFrame(
ErrorString*, const String16& callFrameId,
Response restartFrame(
const String16& callFrameId,
std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*
newCallFrames,
Maybe<protocol::Runtime::StackTrace>* asyncStackTrace) override;
void getScriptSource(ErrorString*, const String16& scriptId,
String16* scriptSource) override;
void pause(ErrorString*) override;
void resume(ErrorString*) override;
void stepOver(ErrorString*) override;
void stepInto(ErrorString*) override;
void stepOut(ErrorString*) override;
void setPauseOnExceptions(ErrorString*, const String16& pauseState) override;
void evaluateOnCallFrame(
ErrorString*, const String16& callFrameId, const String16& expression,
const Maybe<String16>& objectGroup,
const Maybe<bool>& includeCommandLineAPI, const Maybe<bool>& silent,
const Maybe<bool>& returnByValue, const Maybe<bool>& generatePreview,
Response getScriptSource(const String16& scriptId,
String16* scriptSource) override;
Response pause() override;
Response resume() override;
Response stepOver() override;
Response stepInto() override;
Response stepOut() override;
Response setPauseOnExceptions(const String16& pauseState) override;
Response evaluateOnCallFrame(
const String16& callFrameId, const String16& expression,
Maybe<String16> objectGroup, Maybe<bool> includeCommandLineAPI,
Maybe<bool> silent, Maybe<bool> returnByValue,
Maybe<bool> generatePreview,
std::unique_ptr<protocol::Runtime::RemoteObject>* result,
Maybe<protocol::Runtime::ExceptionDetails>*) override;
void setVariableValue(
ErrorString*, int scopeNumber, const String16& variableName,
Response setVariableValue(
int scopeNumber, const String16& variableName,
std::unique_ptr<protocol::Runtime::CallArgument> newValue,
const String16& callFrame) override;
void setAsyncCallStackDepth(ErrorString*, int depth) override;
void setBlackboxPatterns(
ErrorString*,
Response setAsyncCallStackDepth(int depth) override;
Response setBlackboxPatterns(
std::unique_ptr<protocol::Array<String16>> patterns) override;
void setBlackboxedRanges(
ErrorString*, const String16& scriptId,
Response setBlackboxedRanges(
const String16& scriptId,
std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>>
positions) override;
......@@ -144,16 +141,15 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
v8::Isolate* isolate() { return m_isolate; }
private:
bool checkEnabled(ErrorString*);
void enable();
void enableImpl();
SkipPauseRequest shouldSkipExceptionPause(JavaScriptCallFrame* topCallFrame);
SkipPauseRequest shouldSkipStepPause(JavaScriptCallFrame* topCallFrame);
void schedulePauseOnNextStatementIfSteppingInto();
std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>
currentCallFrames(ErrorString*);
Response currentCallFrames(
std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>>*);
std::unique_ptr<protocol::Runtime::StackTrace> currentAsyncStackTrace();
void changeJavaScriptRecursionLevel(int step);
......@@ -163,8 +159,7 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
std::unique_ptr<protocol::Debugger::Location> resolveBreakpoint(
const String16& breakpointId, const String16& scriptId,
const ScriptBreakpoint&, BreakpointSource);
void removeBreakpoint(const String16& breakpointId);
bool assertPaused(ErrorString*);
void removeBreakpointImpl(const String16& breakpointId);
void clearBreakDetails();
bool isCurrentCallStackEmptyOrBlackboxed();
......@@ -174,7 +169,7 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend {
void internalSetAsyncCallStackDepth(int);
void increaseCachedSkipStackGeneration();
bool setBlackboxPattern(ErrorString*, const String16& pattern);
Response setBlackboxPattern(const String16& pattern);
using ScriptsMap =
protocol::HashMap<String16, std::unique_ptr<V8DebuggerScript>>;
......
......@@ -329,11 +329,11 @@ void V8Debugger::clearStepping() {
v8::DebugInterface::ClearStepping(m_isolate);
}
bool V8Debugger::setScriptSource(
Response V8Debugger::setScriptSource(
const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun,
ErrorString* error,
Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails,
JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged) {
JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged,
bool* compileError) {
class EnableLiveEditScope {
public:
explicit EnableLiveEditScope(v8::Isolate* isolate) : m_isolate(isolate) {
......@@ -349,6 +349,7 @@ bool V8Debugger::setScriptSource(
v8::Isolate* m_isolate;
};
*compileError = false;
DCHECK(enabled());
v8::HandleScope scope(m_isolate);
......@@ -369,10 +370,9 @@ bool V8Debugger::setScriptSource(
if (tryCatch.HasCaught()) {
v8::Local<v8::Message> message = tryCatch.Message();
if (!message.IsEmpty())
*error = toProtocolStringWithTypeCheck(message->Get());
return Response::Error(toProtocolStringWithTypeCheck(message->Get()));
else
*error = "Unknown error.";
return false;
return Response::InternalError();
}
v8result = maybeResult.ToLocalChecked();
}
......@@ -397,7 +397,7 @@ bool V8Debugger::setScriptSource(
JavaScriptCallFrames frames = currentCallFrames();
newCallFrames->swap(frames);
}
return true;
return Response::OK();
}
// Compile error.
case 1: {
......@@ -419,11 +419,11 @@ bool V8Debugger::setScriptSource(
->Value()) -
1)
.build();
return false;
*compileError = true;
return Response::OK();
}
}
*error = "Unknown error.";
return false;
return Response::InternalError();
}
JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) {
......
......@@ -23,7 +23,7 @@ class V8DebuggerAgentImpl;
class V8InspectorImpl;
class V8StackTraceImpl;
using protocol::ErrorString;
using protocol::Response;
class V8Debugger {
public:
......@@ -53,12 +53,11 @@ class V8Debugger {
void stepOutOfFunction();
void clearStepping();
bool setScriptSource(const String16& sourceID,
v8::Local<v8::String> newSource, bool dryRun,
ErrorString*,
protocol::Maybe<protocol::Runtime::ExceptionDetails>*,
JavaScriptCallFrames* newCallFrames,
protocol::Maybe<bool>* stackChanged);
Response setScriptSource(
const String16& sourceID, v8::Local<v8::String> newSource, bool dryRun,
protocol::Maybe<protocol::Runtime::ExceptionDetails>*,
JavaScriptCallFrames* newCallFrames, protocol::Maybe<bool>* stackChanged,
bool* compileError);
JavaScriptCallFrames currentCallFrames(int limit = 0);
// Each script inherits debug data from v8::Context where it has been
......
......@@ -104,11 +104,10 @@ V8InspectorSessionImpl::V8InspectorSessionImpl(V8InspectorImpl* inspector,
}
V8InspectorSessionImpl::~V8InspectorSessionImpl() {
protocol::ErrorString errorString;
m_consoleAgent->disable();
m_profilerAgent->disable();
m_heapProfilerAgent->disable();
m_debuggerAgent->disable(&errorString);
m_debuggerAgent->disable();
m_runtimeAgent->disable();
discardInjectedScripts();
......@@ -382,19 +381,12 @@ void V8InspectorSessionImpl::breakProgram(const StringView& breakReason,
}
void V8InspectorSessionImpl::setSkipAllPauses(bool skip) {
protocol::ErrorString errorString;
m_debuggerAgent->setSkipAllPauses(&errorString, skip);
m_debuggerAgent->setSkipAllPauses(skip);
}
void V8InspectorSessionImpl::resume() {
protocol::ErrorString errorString;
m_debuggerAgent->resume(&errorString);
}
void V8InspectorSessionImpl::resume() { m_debuggerAgent->resume(); }
void V8InspectorSessionImpl::stepOver() {
protocol::ErrorString errorString;
m_debuggerAgent->stepOver(&errorString);
}
void V8InspectorSessionImpl::stepOver() { m_debuggerAgent->stepOver(); }
std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>>
V8InspectorSessionImpl::searchInTextByLines(const StringView& text,
......
......@@ -330,8 +330,7 @@ def resolve_type(protocol, prop):
def new_style(domain):
domains = [ "Schema", "Console", "Profiler", "HeapProfiler", "Runtime" ]
return domain["domain"] in domains
return True
def join_arrays(dict, keys):
......
......@@ -14,5 +14,4 @@ description.
Local modifications:
- This only includes the lib/ and templates/ directories, scripts, build
and the LICENSE files.
- New style domains [ "Schema", "Console", "Profiler", "HeapProfiler",
"Runtime" ] are added in CodeGenerator.py.
\ No newline at end of file
- Used new style for all domains d in CodeGenerator.py.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment