Chromium Code Reviews| Index: Source/core/inspector/InjectedScript.cpp |
| diff --git a/Source/core/inspector/InjectedScript.cpp b/Source/core/inspector/InjectedScript.cpp |
| index 4005d2a9d3c5a8e99877e16b3257f23fee4d3fd0..58a6077a90cbd42a8ba6a64bd381d7dde103c6be 100644 |
| --- a/Source/core/inspector/InjectedScript.cpp |
| +++ b/Source/core/inspector/InjectedScript.cpp |
| @@ -34,10 +34,13 @@ |
| #include "core/inspector/InjectedScript.h" |
| #include "bindings/v8/ScriptFunctionCall.h" |
| +#include "bindings/v8/V8PerIsolateData.h" |
| #include "core/inspector/InjectedScriptHost.h" |
| #include "platform/JSONValues.h" |
| #include "wtf/text/WTFString.h" |
| +#include <v8-debug.h> |
| + |
| using WebCore::TypeBuilder::Array; |
| using WebCore::TypeBuilder::Debugger::CallFrame; |
| using WebCore::TypeBuilder::Runtime::PropertyDescriptor; |
| @@ -81,11 +84,13 @@ void V8InjectedScript::callFunctionOn(ErrorString* errorString, const String& ob |
| void V8InjectedScript::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) |
| { |
| + v8::Context::Scope contextScope(v8::Debug::GetDebugContext()); |
| + |
| ScriptFunctionCall function(injectedScriptObject(), "evaluateOnCallFrame"); |
| function.appendArgument(callFrames.asJavaScript()); |
| Vector<ScriptValue> asyncCallStacksJavaScript; |
| for (size_t i = 0; i < asyncCallStacks.size(); i++) { |
| - if (asyncCallStacks[i].isJavaScript()) |
| + if (asyncCallStacks[i].hasJavaScript()) |
| asyncCallStacksJavaScript.append(asyncCallStacks[i].asJavaScript()); |
| } |
| function.appendArgument(asyncCallStacksJavaScript); |
| @@ -104,7 +109,7 @@ void V8InjectedScript::getCompletionsOnCallFrame(ErrorString* errorString, const |
| function.appendArgument(callFrames.asJavaScript()); |
| Vector<ScriptValue> asyncCallStacksJavaScript; |
| for (size_t i = 0; i < asyncCallStacks.size(); i++) { |
| - if (asyncCallStacks[i].isJavaScript()) |
| + if (asyncCallStacks[i].hasJavaScript()) |
| asyncCallStacksJavaScript.append(asyncCallStacks[i].asJavaScript()); |
| } |
| function.appendArgument(asyncCallStacksJavaScript); |
| @@ -290,8 +295,18 @@ PassRefPtr<Array<CallFrame> > V8InjectedScript::wrapCallFrames(const StackTrace& |
| ScriptValue callFramesValue = callFunctionWithEvalEnabled(function, hadException); |
| ASSERT(!hadException); |
| RefPtr<JSONValue> result = callFramesValue.toJSONValue(scriptState()); |
| - if (result && result->type() == JSONValue::TypeArray) |
| + if (result && result->type() == JSONValue::TypeArray) { |
| + // FIXMEDART: set timestamps for async callstacks as well. |
| + if (asyncOrdinal < 1) { |
| + // Bread the CallFrame JSON with timestamps. |
|
vsm
2014/08/29 08:42:08
Bread?
Jacob
2014/09/05 23:35:56
This code has been removed.
|
| + StackTraceTimestampTracker* tracker = V8PerIsolateData::from(v8::Isolate::GetCurrent())->stackTraceTimestampTracker(); |
| + RefPtr<JSONArray> arr; |
| + result->asArray(&arr); |
| + for (size_t i = 0, length = arr->length(); i < length; i++) |
| + CallFrame::runtimeCast(arr->get(i))->setTimestamp(tracker->getTimestamp(length - i - 1)); |
| + } |
| return Array<CallFrame>::runtimeCast(result); |
| + } |
| return Array<CallFrame>::create(); |
| } |