Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: Source/core/inspector/V8Debugger.cpp

Issue 1224553008: [DevTools] Move Script and enums from ScriptDebugListener to V8Debugger. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/V8Debugger.cpp
diff --git a/Source/core/inspector/V8Debugger.cpp b/Source/core/inspector/V8Debugger.cpp
index 548294997ab679d3b13a5829ec2dd2c930c584bd..40e884d6a13094fc383abe687c2a1d7e810a68c0 100644
--- a/Source/core/inspector/V8Debugger.cpp
+++ b/Source/core/inspector/V8Debugger.cpp
@@ -48,6 +48,100 @@ namespace blink {
namespace {
const char stepIntoV8MethodName[] = "stepIntoStatement";
const char stepOutV8MethodName[] = "stepOutOfFunction";
+static const unsigned kBlackboxUnknown = 0;
+}
+
+V8Debugger::Script::Script()
+ : m_startLine(0)
+ , m_startColumn(0)
+ , m_endLine(0)
+ , m_endColumn(0)
+ , m_isContentScript(false)
+ , m_isBlackboxedURL(false)
+ , m_blackboxGeneration(kBlackboxUnknown)
+{
+}
+
+String V8Debugger::Script::sourceURL() const
+{
+ return m_sourceURL.isEmpty() ? m_url : m_sourceURL;
+}
+
+bool V8Debugger::Script::getBlackboxedState(unsigned blackboxGeneration, bool* isBlackboxed) const
+{
+ if (m_blackboxGeneration == kBlackboxUnknown || m_blackboxGeneration != blackboxGeneration)
+ return false;
+ *isBlackboxed = m_isBlackboxedURL;
+ return true;
+}
+
+void V8Debugger::Script::setBlackboxedState(unsigned blackboxGeneration, bool isBlackboxed)
+{
+ ASSERT(blackboxGeneration);
+ m_isBlackboxedURL = isBlackboxed;
+ m_blackboxGeneration = blackboxGeneration;
+}
+
+V8Debugger::Script& V8Debugger::Script::setURL(const String& url)
+{
+ m_url = url;
+ m_blackboxGeneration = kBlackboxUnknown;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setSourceURL(const String& sourceURL)
+{
+ m_sourceURL = sourceURL;
+ m_blackboxGeneration = kBlackboxUnknown;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setSourceMappingURL(const String& sourceMappingURL)
+{
+ m_sourceMappingURL = sourceMappingURL;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setSource(const String& source)
+{
+ m_source = source;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setStartLine(int startLine)
+{
+ m_startLine = startLine;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setStartColumn(int startColumn)
+{
+ m_startColumn = startColumn;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setEndLine(int endLine)
+{
+ m_endLine = endLine;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setEndColumn(int endColumn)
+{
+ m_endColumn = endColumn;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setIsContentScript(bool isContentScript)
+{
+ m_isContentScript = isContentScript;
+ return *this;
+}
+
+V8Debugger::Script& V8Debugger::Script::setIsInternalScript(bool isInternalScript)
+{
+ m_isInternalScript = isInternalScript;
+ return *this;
}
v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod(const char* functionName, int argc, v8::Local<v8::Value> argv[])
@@ -106,7 +200,7 @@ void V8Debugger::setContextDebugData(v8::Local<v8::Context> context, const Strin
context->SetEmbedderData(static_cast<int>(gin::kDebugIdIndex), v8String(context->GetIsolate(), contextDebugData));
}
-void V8Debugger::getCompiledScripts(const String& contextDebugDataSubstring, Vector<ScriptDebugListener::ParsedScript>& result)
+void V8Debugger::getCompiledScripts(const String& contextDebugDataSubstring, Vector<ParsedScript>& result)
{
v8::HandleScope scope(m_isolate);
v8::Context::Scope contextScope(debuggerContext());
@@ -502,8 +596,8 @@ void V8Debugger::handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8
m_pausedScriptState = pausedScriptState;
m_executionState = executionState;
- ScriptDebugListener::SkipPauseRequest result = listener->didPause(pausedScriptState, currentCallFrames(), ScriptValue(pausedScriptState, exception), breakpointIds, isPromiseRejection);
- if (result == ScriptDebugListener::NoSkip) {
+ SkipPauseRequest result = listener->didPause(pausedScriptState, currentCallFrames(), ScriptValue(pausedScriptState, exception), breakpointIds, isPromiseRejection);
+ if (result == NoSkip) {
m_runningNestedMessageLoop = true;
m_client->runMessageLoopOnPause(pausedScriptState->context());
m_runningNestedMessageLoop = false;
@@ -511,13 +605,13 @@ void V8Debugger::handleProgramBreak(ScriptState* pausedScriptState, v8::Local<v8
m_pausedScriptState.clear();
m_executionState.Clear();
- if (result == ScriptDebugListener::StepFrame) {
+ if (result == StepFrame) {
v8::Local<v8::Value> argv[] = { executionState };
callDebuggerMethod("stepFrameStatement", 1, argv);
- } else if (result == ScriptDebugListener::StepInto) {
+ } else if (result == StepInto) {
v8::Local<v8::Value> argv[] = { executionState };
callDebuggerMethod(stepIntoV8MethodName, 1, argv);
- } else if (result == ScriptDebugListener::StepOut) {
+ } else if (result == StepOut) {
v8::Local<v8::Value> argv[] = { executionState };
callDebuggerMethod(stepOutV8MethodName, 1, argv);
}
@@ -608,12 +702,12 @@ void V8Debugger::handleV8PromiseEvent(ScriptDebugListener* listener, ScriptState
m_executionState.Clear();
}
-ScriptDebugListener::ParsedScript V8Debugger::createParsedScript(v8::Local<v8::Object> object, CompileResult compileResult)
+V8Debugger::ParsedScript V8Debugger::createParsedScript(v8::Local<v8::Object> object, CompileResult compileResult)
{
v8::Local<v8::Value> id = object->Get(v8InternalizedString("id"));
ASSERT(!id.IsEmpty() && id->IsInt32());
- ScriptDebugListener::ParsedScript parsedScript;
+ ParsedScript parsedScript;
parsedScript.scriptId = String::number(id->Int32Value());
parsedScript.script.setURL(toCoreStringWithUndefinedOrNullCheck(object->Get(v8InternalizedString("name"))))
.setSourceURL(toCoreStringWithUndefinedOrNullCheck(object->Get(v8InternalizedString("sourceURL"))))

Powered by Google App Engine
This is Rietveld 408576698