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

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

Issue 1804043002: Revert of Remove V8RecrusionScope, cleanup call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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/JavaScriptCallFrame.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
index 299b11c8881a2ddb9868cbd61fa14f340e792db9..6222e7debd1973e95219f2a519e8fbcfb77e170c 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/JavaScriptCallFrame.cpp
@@ -31,13 +31,15 @@
#include "platform/v8_inspector/JavaScriptCallFrame.h"
#include "platform/v8_inspector/V8StringUtil.h"
+#include "platform/v8_inspector/public/V8DebuggerClient.h"
#include <v8-debug.h>
namespace blink {
-JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame)
- : m_isolate(debuggerContext->GetIsolate())
+JavaScriptCallFrame::JavaScriptCallFrame(V8DebuggerClient* client, v8::Local<v8::Context> debuggerContext, v8::Local<v8::Object> callFrame)
+ : m_client(client)
+ , m_isolate(debuggerContext->GetIsolate())
, m_debuggerContext(m_isolate, debuggerContext)
, m_callFrame(m_isolate, callFrame)
{
@@ -51,20 +53,21 @@
{
v8::HandleScope handleScope(m_isolate);
v8::Local<v8::Context> debuggerContext = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
+ v8::Context::Scope contextScope(debuggerContext);
v8::Local<v8::Value> callerFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "caller"));
if (callerFrame.IsEmpty() || !callerFrame->IsObject())
return 0;
- return JavaScriptCallFrame::create(debuggerContext, v8::Local<v8::Object>::Cast(callerFrame));
+ return JavaScriptCallFrame::create(m_client, debuggerContext, v8::Local<v8::Object>::Cast(callerFrame));
}
int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const
{
v8::HandleScope handleScope(m_isolate);
- v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
+ v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext));
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name)));
v8::Local<v8::Value> result;
- if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result) || !result->IsInt32())
+ if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&result) || !result->IsInt32())
return 0;
return result.As<v8::Int32>()->Value();
}
@@ -72,11 +75,11 @@
String16 JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const
{
v8::HandleScope handleScope(m_isolate);
- v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_debuggerContext);
+ v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext));
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name)));
v8::Local<v8::Value> result;
- if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result))
+ if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&result))
return String16();
return toProtocolStringWithTypeCheck(result);
}
@@ -120,7 +123,7 @@
{
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeChain")));
- v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
+ v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length());
for (uint32_t i = 0; i < scopeChain->Length(); i++)
result->Set(i, scopeChain->Get(i));
@@ -131,7 +134,7 @@
{
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeType")));
- v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
+ v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
return scopeType->Get(scopeIndex)->Int32Value();
}
@@ -139,7 +142,7 @@
{
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "scopeName")));
- v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
+ v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
return scopeType->Get(scopeIndex)->ToString();
}
@@ -157,7 +160,7 @@
{
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, name)));
- v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(func->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked());
+ v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocalChecked());
return locations->Get(scopeIndex);
}
@@ -174,6 +177,7 @@
bool JavaScriptCallFrame::isAtReturn() const
{
v8::HandleScope handleScope(m_isolate);
+ v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_debuggerContext));
v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInternalized(m_isolate, "isAtReturn"));
if (result.IsEmpty() || !result->IsBoolean())
return false;
@@ -196,7 +200,7 @@
v8::TryCatch tryCatch(m_isolate);
v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate);
v8::Local<v8::Value> result;
- if (evalFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&result)) {
+ if (m_client->callInternalFunction(evalFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv).ToLocal(&result)) {
wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result);
wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"), v8::Undefined(m_isolate));
} else {
@@ -211,7 +215,7 @@
v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_callFrame);
v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(callFrame->Get(toV8StringInternalized(m_isolate, "restart")));
v8::Debug::SetLiveEditEnabled(m_isolate, true);
- v8::MaybeLocal<v8::Value> result = restartFunction->Call(m_isolate->GetCurrentContext(), callFrame, 0, nullptr);
+ v8::MaybeLocal<v8::Value> result = m_client->callInternalFunction(restartFunction, callFrame, 0, nullptr);
v8::Debug::SetLiveEditEnabled(m_isolate, false);
return result;
}
@@ -225,7 +229,7 @@
variableName,
newValue
};
- return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_LENGTH(argv), argv);
+ return m_client->callInternalFunction(setVariableValueFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv);
}
v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message)

Powered by Google App Engine
This is Rietveld 408576698