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

Unified Diff: Source/bindings/v8/ScriptDebugServer.cpp

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 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
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.h ('k') | Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptDebugServer.cpp
diff --git a/Source/bindings/v8/ScriptDebugServer.cpp b/Source/bindings/v8/ScriptDebugServer.cpp
index 917b5e3513933f7d1c62d6d39d4e67655b666022..1746138eb1edfa7f8c4ee3a6fe5c0aca7942c454 100644
--- a/Source/bindings/v8/ScriptDebugServer.cpp
+++ b/Source/bindings/v8/ScriptDebugServer.cpp
@@ -30,17 +30,19 @@
#include "config.h"
#include "bindings/v8/ScriptDebugServer.h"
-
#include "DebuggerScriptSource.h"
#include "V8JavaScriptCallFrame.h"
-#include "bindings/dart/DartDebugServer.h"
+#include "bindings/common/StackTrace.h"
+#include "bindings/dart/DartScriptDebugServer.h"
#include "bindings/v8/ScopedPersistent.h"
+#include "bindings/v8/ScriptCallStackFactory.h"
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/ScriptObject.h"
#include "bindings/v8/ScriptSourceCode.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8ScriptRunner.h"
#include "core/inspector/JavaScriptCallFrame.h"
+#include "core/inspector/ScriptCallFrame.h"
#include "core/inspector/ScriptDebugListener.h"
#include "platform/JSONValues.h"
#include "wtf/StdLibExtras.h"
@@ -172,10 +174,8 @@ void ScriptDebugServer::setPauseOnNextStatement(bool pause)
if (isPaused())
return;
if (pause) {
- DartDebugServer::shared().debugBreak();
v8::Debug::DebugBreak(m_isolate);
} else {
- DartDebugServer::shared().cancelDebugBreak();
v8::Debug::CancelDebugBreak(m_isolate);
}
}
@@ -243,17 +243,19 @@ void ScriptDebugServer::stepCommandWithFrame(const char* functionName, const Scr
continueProgram();
}
-void ScriptDebugServer::stepOverStatement(const ScriptValue& frame)
+void ScriptDebugServer::stepOverStatement(const ActivationFrame& frame)
{
- stepCommandWithFrame("stepOverStatement", frame);
+ ASSERT(frame.isJavaScript());
+ stepCommandWithFrame("stepOverStatement", frame.asJavaScript());
}
-void ScriptDebugServer::stepOutOfFunction(const ScriptValue& frame)
+void ScriptDebugServer::stepOutOfFunction(const ActivationFrame& frame)
{
- stepCommandWithFrame(stepOutV8MethodName, frame);
+ ASSERT(frame.isJavaScript());
+ stepCommandWithFrame(stepOutV8MethodName, frame.asJavaScript());
}
-bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>& errorData, ScriptValue* newCallFrames, RefPtr<JSONObject>* result)
+bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& newContent, bool preview, String* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>& errorData, StackTrace* newCallFrames, RefPtr<JSONObject>& result)
{
class EnableLiveEditScope {
public:
@@ -297,7 +299,7 @@ bool ScriptDebugServer::setScriptSource(const String& sourceID, const String& ne
v8::Local<v8::Value> normalResult = resultTuple->Get(1);
RefPtr<JSONValue> jsonResult = v8ToJSONValue(m_isolate, normalResult, JSONValue::maxDepth);
if (jsonResult)
- *result = jsonResult->asObject();
+ result = jsonResult->asObject();
// Call stack may have changed after if the edited function was on the stack.
if (!preview && isPaused())
*newCallFrames = currentCallFrames();
@@ -342,27 +344,27 @@ PassRefPtr<JavaScriptCallFrame> ScriptDebugServer::wrapCallFrames(v8::Handle<v8:
return JavaScriptCallFrame::create(v8::Debug::GetDebugContext(), v8::Handle<v8::Object>::Cast(currentCallFrameV8));
}
-ScriptValue ScriptDebugServer::currentCallFramesInner(ScopeInfoDetails scopeDetails)
+StackTrace ScriptDebugServer::currentCallFramesInner(ScopeInfoDetails scopeDetails)
{
v8::HandleScope scope(m_isolate);
v8::Handle<v8::Context> pausedContext = m_pausedContext.IsEmpty() ? m_isolate->GetCurrentContext() : m_pausedContext;
if (pausedContext.IsEmpty())
- return ScriptValue();
+ return StackTrace(ScriptValue());
RefPtr<JavaScriptCallFrame> currentCallFrame = wrapCallFrames(m_executionState.newLocal(m_isolate), 0, scopeDetails);
if (!currentCallFrame)
- return ScriptValue();
+ return StackTrace(ScriptValue());
v8::Context::Scope contextScope(pausedContext);
- return ScriptValue(V8ScriptState::from(pausedContext), toV8(currentCallFrame.release(), v8::Handle<v8::Object>(), pausedContext->GetIsolate()));
+ return StackTrace(ScriptValue(V8ScriptState::from(pausedContext), toV8(currentCallFrame.release(), v8::Handle<v8::Object>(), pausedContext->GetIsolate())));
}
-ScriptValue ScriptDebugServer::currentCallFrames()
+StackTrace ScriptDebugServer::currentCallFrames()
{
return currentCallFramesInner(AllScopes);
}
-ScriptValue ScriptDebugServer::currentCallFramesForAsyncStack()
+StackTrace ScriptDebugServer::currentCallFramesForAsyncStack()
{
return currentCallFramesInner(FastAsyncScopes);
}
@@ -494,8 +496,8 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
if (!currentCallFrame->IsObject())
return;
}
- RefPtr<JavaScriptCallFrame> topFrame = wrapCallFrames(eventDetails.GetExecutionState(), 1, NoScopes);
- if (executeSkipPauseRequest(listener->shouldSkipExceptionPause(topFrame), eventDetails.GetExecutionState()))
+
+ if (stackTrace->GetFrameCount() && executeSkipPauseRequest(listener->shouldSkipExceptionPause(toScriptCallFrame(stackTrace->GetFrame(0))), eventDetails.GetExecutionState()))
return;
v8::Handle<v8::Object> eventData = eventDetails.GetEventData();
v8::Handle<v8::Value> exceptionGetterValue = eventData->Get(v8AtomicString(m_isolate, "exception"));
@@ -507,12 +509,14 @@ void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD
v8::Handle<v8::Value> argv[] = { eventDetails.GetEventData() };
v8::Handle<v8::Value> hitBreakpoints = V8ScriptRunner::callInternalFunction(getBreakpointNumbersFunction, debuggerScript, WTF_ARRAY_LENGTH(argv), argv, m_isolate);
ASSERT(hitBreakpoints->IsArray());
- RefPtr<JavaScriptCallFrame> topFrame = wrapCallFrames(eventDetails.GetExecutionState(), 1, NoScopes);
+ v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(m_isolate, 1);
+ ScriptCallFrame topCallFrame = toScriptCallFrame(stackTrace->GetFrame(0));
+
ScriptDebugListener::SkipPauseRequest skipRequest;
if (v8::Handle<v8::Array>::Cast(hitBreakpoints)->Length())
- skipRequest = listener->shouldSkipBreakpointPause(topFrame);
+ skipRequest = listener->shouldSkipBreakpointPause(topCallFrame);
else
- skipRequest = listener->shouldSkipStepPause(topFrame);
+ skipRequest = listener->shouldSkipStepPause(topCallFrame);
if (executeSkipPauseRequest(skipRequest, eventDetails.GetExecutionState()))
return;
handleProgramBreak(eventDetails, v8::Handle<v8::Value>(), hitBreakpoints.As<v8::Array>());
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.h ('k') | Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698