| Index: Source/bindings/dart/DartInjectedScript.cpp
|
| diff --git a/Source/bindings/dart/DartInjectedScript.cpp b/Source/bindings/dart/DartInjectedScript.cpp
|
| index 1db544cb97232e05f7bd4c0a257ad3cfecb849ef..349ecccb59a7006a05d30ead53bb7da281d88224 100644
|
| --- a/Source/bindings/dart/DartInjectedScript.cpp
|
| +++ b/Source/bindings/dart/DartInjectedScript.cpp
|
| @@ -709,7 +709,7 @@ fail:
|
|
|
| void DartInjectedScript::evaluateOnCallFrame(ErrorString* errorString, const StackTrace& callFrames, const Vector<StackTrace>& asyncCallStacks, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown)
|
| {
|
| - ASSERT(!callFrames.isJavaScript());
|
| + ASSERT(callFrames.hasDart());
|
| if (!m_scriptState) {
|
| *errorString = "Invalid DartInjectedScript";
|
| return;
|
| @@ -737,14 +737,14 @@ void DartInjectedScript::evaluateOnCallFrame(ErrorString* errorString, const Sta
|
|
|
| void DartInjectedScript::restartFrame(ErrorString* errorString, const StackTrace& callFrames, const String& callFrameId, RefPtr<JSONObject>* result)
|
| {
|
| - ASSERT(!callFrames.isJavaScript());
|
| + ASSERT(callFrames.hasDart());
|
| *errorString = "Dart does not yet support restarting call frames";
|
| return;
|
| }
|
|
|
| void DartInjectedScript::getStepInPositions(ErrorString* errorString, const StackTrace& callFrames, const String& callFrameId, RefPtr<Array<TypeBuilder::Debugger::Location> >& positions)
|
| {
|
| - ASSERT(!callFrames.isJavaScript());
|
| + ASSERT(callFrames.hasDart());
|
| if (!m_scriptState) {
|
| *errorString = "Invalid DartInjectedScript";
|
| return;
|
| @@ -757,13 +757,13 @@ void DartInjectedScript::getStepInPositions(ErrorString* errorString, const Stac
|
|
|
| void DartInjectedScript::setVariableValue(ErrorString* errorString, const StackTrace& callFrames, const String* callFrameIdOpt, const String* functionObjectIdOpt, int scopeNumber, const String& variableName, const String& newValueStr)
|
| {
|
| + ASSERT(callFrames.hasDart());
|
| if (!m_scriptState) {
|
| *errorString = "Invalid DartInjectedScript";
|
| return;
|
| }
|
| DartIsolateScope scope(m_scriptState->isolate());
|
| DartApiScope apiScope;
|
| - ASSERT(!callFrames.isJavaScript());
|
| *errorString = "Not supported by Dart.";
|
| return;
|
| }
|
| @@ -843,7 +843,7 @@ void addCompletions(Dart_Handle completions, RefPtr<TypeBuilder::Array<String> >
|
|
|
| void DartInjectedScript::getCompletionsOnCallFrame(ErrorString* errorString, const StackTrace& callFrames, const Vector<StackTrace>& asyncCallStacks, const String& callFrameId, const String& expression, RefPtr<TypeBuilder::Array<String> >* result)
|
| {
|
| - ASSERT(!callFrames.isJavaScript());
|
| + ASSERT(callFrames.hasDart());
|
| *result = TypeBuilder::Array<String>::create();
|
| if (!m_scriptState) {
|
| *errorString = "Invalid DartInjectedScript";
|
| @@ -1194,8 +1194,8 @@ String DartInjectedScript::getCallFrameId(int ordinal, int asyncOrdinal)
|
|
|
| Dart_ActivationFrame DartInjectedScript::callFrameForId(const StackTrace& callFrames, const Vector<StackTrace>& asyncCallStacks, const String& callFrameId)
|
| {
|
| - ASSERT(!callFrames.isJavaScript());
|
| - if (callFrames.isJavaScript())
|
| + ASSERT(callFrames.hasDart());
|
| + if (!callFrames.hasDart())
|
| return 0;
|
| Dart_StackTrace trace = callFrames.asDart();
|
| Dart_ActivationFrame frame = 0;
|
| @@ -1215,8 +1215,9 @@ Dart_ActivationFrame DartInjectedScript::callFrameForId(const StackTrace& callFr
|
| if (asyncOrdinal > 0) { // 1-based index
|
| ASSERT(asyncOrdinal <= (int)asyncCallStacks.size());
|
| if (asyncOrdinal <= (int)asyncCallStacks.size()) {
|
| - ASSERT(!asyncCallStacks[asyncOrdinal-1].isJavaScript());
|
| - result = Dart_GetActivationFrame(asyncCallStacks[asyncOrdinal-1].asDart(), ordinal, &frame);
|
| + StackTrace asyncCallStack = asyncCallStacks[asyncOrdinal-1];
|
| + ASSERT(asyncCallStack.hasDart());
|
| + result = Dart_GetActivationFrame(asyncCallStack.asDart(), ordinal, &frame);
|
| } else {
|
| return 0;
|
| }
|
| @@ -1229,9 +1230,11 @@ Dart_ActivationFrame DartInjectedScript::callFrameForId(const StackTrace& callFr
|
|
|
| PassRefPtr<Array<CallFrame> > DartInjectedScript::wrapCallFrames(const StackTrace& callFrames, int asyncOrdinal)
|
| {
|
| - ASSERT(!callFrames.isJavaScript());
|
| - if (callFrames.isJavaScript())
|
| + ASSERT(callFrames.hasDart());
|
| + if (!callFrames.hasDart())
|
| return nullptr;
|
| + DartIsolateScope scope(m_scriptState->isolate());
|
| + DartApiScope apiScope;
|
| Dart_StackTrace trace = callFrames.asDart();
|
| intptr_t length = 0;
|
| Dart_Handle ALLOW_UNUSED result;
|
| @@ -1240,7 +1243,11 @@ PassRefPtr<Array<CallFrame> > DartInjectedScript::wrapCallFrames(const StackTrac
|
| ASSERT(!Dart_IsError(result));
|
| DartScriptDebugServer& debugServer = DartScriptDebugServer::shared();
|
| Dart_Handle libraries = Dart_GetLibraryIds();
|
| +
|
| + DartDOMData* domData = DartDOMData::current();
|
| + StackTraceTimestampTracker* timestampTracker = domData->stackTraceTimestampTracker();
|
| for (intptr_t i = 0; i < length; i++) {
|
| + int64_t timestamp = timestampTracker->getTimestamp(length - i - 1);
|
| Dart_ActivationFrame frame = 0;
|
| result = Dart_GetActivationFrame(trace, i, &frame);
|
| ASSERT(!Dart_IsError(result));
|
| @@ -1302,13 +1309,15 @@ PassRefPtr<Array<CallFrame> > DartInjectedScript::wrapCallFrames(const StackTrac
|
| .setObject(wrapDartHandle(libraries, DartDebuggerObject::Isolate, "backtrace", false))
|
| .release());
|
|
|
| - ret->addItem(CallFrame::create()
|
| + RefPtr<CallFrame> callFrame = CallFrame::create()
|
| .setCallFrameId(getCallFrameId(i, asyncOrdinal))
|
| .setFunctionName(DartUtilities::toString(functionName))
|
| .setLocation(locationJson)
|
| .setScopeChain(scopeChain)
|
| .setThis(thisObject)
|
| - .release());
|
| + .release();
|
| + callFrame->setTimestamp(timestamp);
|
| + ret->addItem(callFrame);
|
| }
|
| return ret;
|
| }
|
|
|