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

Unified Diff: sky/engine/v8_inspector/InspectorDebuggerAgent.cpp

Issue 772563003: Move many of v8_inspector dependencies out of core/ (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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: sky/engine/v8_inspector/InspectorDebuggerAgent.cpp
diff --git a/sky/engine/core/inspector/InspectorDebuggerAgent.cpp b/sky/engine/v8_inspector/InspectorDebuggerAgent.cpp
similarity index 96%
rename from sky/engine/core/inspector/InspectorDebuggerAgent.cpp
rename to sky/engine/v8_inspector/InspectorDebuggerAgent.cpp
index 8861a968a1dabe399bc5705052cc5d60e650cb62..b9923fa1602ad244860188102ebf4cd27c10556c 100644
--- a/sky/engine/core/inspector/InspectorDebuggerAgent.cpp
+++ b/sky/engine/v8_inspector/InspectorDebuggerAgent.cpp
@@ -28,24 +28,23 @@
*/
#include "sky/engine/config.h"
-#include "sky/engine/core/inspector/InspectorDebuggerAgent.h"
+#include "sky/engine/v8_inspector/InspectorDebuggerAgent.h"
-#include "sky/engine/bindings/core/v8/ScriptDebugServer.h"
-#include "sky/engine/bindings/core/v8/ScriptRegexp.h"
#include "sky/engine/bindings/core/v8/ScriptSourceCode.h"
#include "sky/engine/bindings/core/v8/ScriptValue.h"
#include "sky/engine/core/dom/Document.h"
-#include "sky/engine/core/fetch/Resource.h"
#include "sky/engine/core/inspector/ConsoleMessage.h"
-#include "sky/engine/core/inspector/ContentSearchUtils.h"
-#include "sky/engine/core/inspector/InjectedScriptManager.h"
-#include "sky/engine/core/inspector/InspectorState.h"
#include "sky/engine/core/inspector/JavaScriptCallFrame.h"
#include "sky/engine/core/inspector/ScriptArguments.h"
#include "sky/engine/core/inspector/ScriptAsyncCallStack.h"
#include "sky/engine/core/inspector/ScriptCallFrame.h"
#include "sky/engine/core/inspector/ScriptCallStack.h"
#include "sky/engine/platform/JSONValues.h"
+#include "sky/engine/v8_inspector/ContentSearchUtils.h"
+#include "sky/engine/v8_inspector/InjectedScriptManager.h"
+#include "sky/engine/v8_inspector/InspectorState.h"
+#include "sky/engine/v8_inspector/ScriptDebugServer.h"
+#include "sky/engine/v8_inspector/ScriptRegexp.h"
#include "sky/engine/wtf/text/StringBuilder.h"
#include "sky/engine/wtf/text/WTFString.h"
@@ -1004,6 +1003,29 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
}
}
+namespace {
+
+PassRefPtr<TypeBuilder::Console::CallFrame> buildInspectorObject(const ScriptCallFrame& frame)
+{
+ return TypeBuilder::Console::CallFrame::create()
+ .setFunctionName(frame.functionName())
+ .setScriptId(frame.scriptId())
+ .setUrl(frame.sourceURL())
+ .setLineNumber(frame.lineNumber())
+ .setColumnNumber(frame.columnNumber())
+ .release();
+}
+
+PassRefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > buildInspectorArray(const RefPtr<ScriptCallStack>& stack)
+{
+ RefPtr<TypeBuilder::Array<TypeBuilder::Console::CallFrame> > frames = TypeBuilder::Array<TypeBuilder::Console::CallFrame>::create();
+ for (size_t i = 0; i < stack->size(); i++)
+ frames->addItem(buildInspectorObject(stack->at(i)));
+ return frames;
+}
+
+} // namespace
+
void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const String& expression, const String& sourceURL, const int* executionContextId, TypeBuilder::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDetails)
{
InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
@@ -1030,7 +1052,7 @@ void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin
exceptionDetails->setLine(lineNumberValue);
exceptionDetails->setColumn(columnNumberValue);
if (stackTraceValue && stackTraceValue->size() > 0)
- exceptionDetails->setStackTrace(stackTraceValue->buildInspectorArray());
+ exceptionDetails->setStackTrace(buildInspectorArray(stackTraceValue));
}
void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId& scriptId, const int* executionContextId, const String* const objectGroup, const bool* const doNotPauseOnExceptionsAndMuteConsole, RefPtr<RemoteObject>& result, RefPtr<ExceptionDetails>& exceptionDetails)
@@ -1065,7 +1087,7 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
exceptionDetails->setLine(lineNumberValue);
exceptionDetails->setColumn(columnNumberValue);
if (stackTraceValue && stackTraceValue->size() > 0)
- exceptionDetails->setStackTrace(stackTraceValue->buildInspectorArray());
+ exceptionDetails->setStackTrace(buildInspectorArray(stackTraceValue));
}
if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
@@ -1180,41 +1202,6 @@ PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace()
return result.release();
}
-static PassRefPtr<ScriptCallStack> toScriptCallStack(JavaScriptCallFrame* callFrame)
-{
- Vector<ScriptCallFrame> frames;
- for (; callFrame; callFrame = callFrame->caller()) {
- StringBuilder stringBuilder;
- stringBuilder.appendNumber(callFrame->sourceID());
- String scriptId = stringBuilder.toString();
- // FIXME(WK62725): Debugger line/column are 0-based, while console ones are 1-based.
- int line = callFrame->line() + 1;
- int column = callFrame->column() + 1;
- frames.append(ScriptCallFrame(callFrame->functionName(), scriptId, callFrame->scriptName(), line, column));
- }
- return ScriptCallStack::create(frames);
-}
-
-PassRefPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyncStackTraceForConsole()
-{
- if (!asyncCallStackTracker().isEnabled())
- return nullptr;
- const AsyncCallStackTracker::AsyncCallChain* chain = asyncCallStackTracker().currentAsyncCallChain();
- if (!chain)
- return nullptr;
- const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callStacks();
- if (callStacks.isEmpty())
- return nullptr;
- RefPtr<ScriptAsyncCallStack> result = nullptr;
- for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin(); it != callStacks.rend(); ++it) {
- RefPtr<JavaScriptCallFrame> callFrame = ScriptDebugServer::toJavaScriptCallFrameUnsafe((*it)->callFrames());
- if (!callFrame)
- break;
- result = ScriptAsyncCallStack::create((*it)->description(), toScriptCallStack(callFrame.get()), result.release());
- }
- return result.release();
-}
-
String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script, CompileResult compileResult)
{
bool hasSyntaxError = compileResult != CompileSuccess;
« no previous file with comments | « sky/engine/v8_inspector/InspectorDebuggerAgent.h ('k') | sky/engine/v8_inspector/InspectorFrontendChannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698