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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp

Issue 1838683002: [DevTools] Debugger::currentCallFrames returns array instead linked list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wrap-with-corrrect-injected-script
Patch Set: Created 4 years, 9 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: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
index feb0f4e2ea2656d08e824d5e444b5b3073237b82..7f18e92a942b0452da9a2f3d3abdd7c885ffe451 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
@@ -396,7 +396,7 @@ void V8DebuggerImpl::clearStepping()
callDebuggerMethod("clearStepping", 0, argv);
}
-bool V8DebuggerImpl::setScriptSource(const String16& sourceID, const String16& newContent, bool preview, ErrorString* error, Maybe<protocol::Debugger::SetScriptSourceError>* errorData, OwnPtr<JavaScriptCallFrame>* newCallFrames, Maybe<bool>* stackChanged)
+bool V8DebuggerImpl::setScriptSource(const String16& sourceID, const String16& newContent, bool preview, ErrorString* error, Maybe<protocol::Debugger::SetScriptSourceError>* errorData, Vector<OwnPtr<JavaScriptCallFrame>>* newCallFrames, Maybe<bool>* stackChanged)
{
class EnableLiveEditScope {
public:
@@ -465,53 +465,33 @@ bool V8DebuggerImpl::setScriptSource(const String16& sourceID, const String16& n
return false;
}
-int V8DebuggerImpl::frameCount()
-{
- ASSERT(isPaused());
- ASSERT(!m_executionState.IsEmpty());
- v8::Local<v8::Value> argv[] = { m_executionState };
- v8::Local<v8::Value> result = callDebuggerMethod("frameCount", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
- if (result->IsInt32())
- return result->Int32Value();
- return 0;
-}
-
-PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::currentCallFrames()
+Vector<OwnPtr<JavaScriptCallFrame>> V8DebuggerImpl::currentCallFrames()
{
+ Vector<OwnPtr<JavaScriptCallFrame>> callFrames;
if (!m_isolate->InContext())
- return nullptr;
- v8::Local<v8::Value> currentCallFrameV8;
+ return callFrames;
dgozman 2016/03/26 00:49:21 Let's be explicit.
kozy 2016/03/26 01:11:17 Done.
+ v8::Local<v8::Value> currentCallFramesV8;
if (m_executionState.IsEmpty()) {
- v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallFrame")));
- currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrameFunction).ToLocalChecked();
+ v8::Local<v8::Function> currentCallFramesFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallFrames")));
+ currentCallFramesV8 = v8::Debug::Call(debuggerContext(), currentCallFramesFunction).ToLocalChecked();
} else {
v8::Local<v8::Value> argv[] = { m_executionState };
- currentCallFrameV8 = callDebuggerMethod("currentCallFrame", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
+ currentCallFramesV8 = callDebuggerMethod("currentCallFrames", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
}
- ASSERT(!currentCallFrameV8.IsEmpty());
- if (!currentCallFrameV8->IsObject())
- return nullptr;
- return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
-}
-
-PassOwnPtr<JavaScriptCallFrame> V8DebuggerImpl::callFrame(int index)
-{
- if (!m_isolate->InContext())
- return nullptr;
- v8::HandleScope handleScope(m_isolate);
-
- v8::Local<v8::Value> currentCallFrameV8;
- if (m_executionState.IsEmpty()) {
- v8::Local<v8::Function> currentCallFrameFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.Get(m_isolate)->Get(v8InternalizedString("currentCallFrameByIndex")));
- currentCallFrameV8 = v8::Debug::Call(debuggerContext(), currentCallFrameFunction, v8::Integer::New(m_isolate, index)).ToLocalChecked();
- } else {
- v8::Local<v8::Value> argv[] = { m_executionState, v8::Integer::New(m_isolate, index) };
- currentCallFrameV8 = callDebuggerMethod("currentCallFrameByIndex", WTF_ARRAY_LENGTH(argv), argv).ToLocalChecked();
+ ASSERT(!currentCallFramesV8.IsEmpty());
+ if (!currentCallFramesV8->IsArray())
+ return callFrames;
dgozman 2016/03/26 00:49:21 Let's be explicit.
kozy 2016/03/26 01:11:17 Done.
+ v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>();
+ for (size_t i = 0; i < callFramesArray->Length(); ++i) {
+ v8::Local<v8::Value> callFrameValue;
+ if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue))
+ return Vector<OwnPtr<JavaScriptCallFrame>>();
+ if (!callFrameValue->IsObject())
+ return Vector<OwnPtr<JavaScriptCallFrame>>();
+ v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>();
+ callFrames.append(JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject)));
}
- ASSERT(!currentCallFrameV8.IsEmpty());
- if (!currentCallFrameV8->IsObject())
- return nullptr;
- return JavaScriptCallFrame::create(debuggerContext(), v8::Local<v8::Object>::Cast(currentCallFrameV8));
+ return callFrames;
}
static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data)

Powered by Google App Engine
This is Rietveld 408576698