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

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

Issue 1806643002: Revert of Remove V8RecrusionScope, cleanup call sites. (patchset #8 id:140001 of https://codereview… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverts 1805543002 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/InjectedScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index 38a962af9bba7238d119e6af47458b904107913d..aa5e01f856bfc156e07850f4d15f4100976141e6 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -36,7 +36,6 @@
#include "platform/v8_inspector/InjectedScriptHost.h"
#include "platform/v8_inspector/InjectedScriptManager.h"
#include "platform/v8_inspector/RemoteObjectId.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
#include "platform/v8_inspector/V8FunctionCall.h"
#include "platform/v8_inspector/V8StringUtil.h"
#include "platform/v8_inspector/public/V8Debugger.h"
@@ -116,11 +115,12 @@ static void weakCallback(const v8::WeakCallbackInfo<InjectedScript>& data)
data.GetParameter()->dispose();
}
-InjectedScript::InjectedScript(InjectedScriptManager* manager, v8::Local<v8::Context> context, v8::Local<v8::Object> object, PassOwnPtr<InjectedScriptNative> injectedScriptNative, int contextId)
+InjectedScript::InjectedScript(InjectedScriptManager* manager, v8::Local<v8::Context> context, v8::Local<v8::Object> object, V8DebuggerClient* client, PassOwnPtr<InjectedScriptNative> injectedScriptNative, int contextId)
: m_manager(manager)
, m_isolate(context->GetIsolate())
, m_context(m_isolate, context)
, m_value(m_isolate, object)
+ , m_client(client)
, m_native(injectedScriptNative)
, m_contextId(contextId)
{
@@ -134,7 +134,7 @@ InjectedScript::~InjectedScript()
void InjectedScript::evaluate(ErrorString* errorString, const String16& expression, const String16& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, OwnPtr<protocol::Runtime::RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "evaluate");
+ V8FunctionCall function(m_client, context(), v8Value(), "evaluate");
function.appendArgument(expression);
function.appendArgument(objectGroup);
function.appendArgument(includeCommandLineAPI);
@@ -146,7 +146,7 @@ void InjectedScript::evaluate(ErrorString* errorString, const String16& expressi
void InjectedScript::callFunctionOn(ErrorString* errorString, const String16& objectId, const String16& expression, const String16& arguments, bool returnByValue, bool generatePreview, OwnPtr<protocol::Runtime::RemoteObject>* result, Maybe<bool>* wasThrown)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "callFunctionOn");
+ V8FunctionCall function(m_client, context(), v8Value(), "callFunctionOn");
function.appendArgument(objectId);
function.appendArgument(expression);
function.appendArgument(arguments);
@@ -158,7 +158,7 @@ void InjectedScript::callFunctionOn(ErrorString* errorString, const String16& ob
void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, v8::Local<v8::Object> callFrames, const String16& callFrameId, const String16& expression, const String16& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, OwnPtr<RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "evaluateOnCallFrame");
+ V8FunctionCall function(m_client, context(), v8Value(), "evaluateOnCallFrame");
function.appendArgument(callFrames);
function.appendArgument(callFrameId);
function.appendArgument(expression);
@@ -172,7 +172,7 @@ void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, v8::Local<v8:
void InjectedScript::restartFrame(ErrorString* errorString, v8::Local<v8::Object> callFrames, const String16& callFrameId)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "restartFrame");
+ V8FunctionCall function(m_client, context(), v8Value(), "restartFrame");
function.appendArgument(callFrames);
function.appendArgument(callFrameId);
OwnPtr<protocol::Value> resultValue = makeCall(function);
@@ -197,7 +197,7 @@ void InjectedScript::setVariableValue(ErrorString* errorString,
const String16& newValueStr)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "setVariableValue");
+ V8FunctionCall function(m_client, context(), v8Value(), "setVariableValue");
if (callFrameIdOpt.isJust()) {
function.appendArgument(callFrames);
function.appendArgument(callFrameIdOpt.fromJust());
@@ -227,7 +227,7 @@ void InjectedScript::setVariableValue(ErrorString* errorString,
void InjectedScript::getFunctionDetails(ErrorString* errorString, const String16& functionId, OwnPtr<FunctionDetails>* result)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getFunctionDetails");
+ V8FunctionCall function(m_client, context(), v8Value(), "getFunctionDetails");
function.appendArgument(functionId);
OwnPtr<protocol::Value> resultValue = makeCall(function);
protocol::ErrorSupport errors(errorString);
@@ -237,7 +237,7 @@ void InjectedScript::getFunctionDetails(ErrorString* errorString, const String16
void InjectedScript::getCollectionEntries(ErrorString* errorString, const String16& objectId, OwnPtr<Array<CollectionEntry>>* result)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getCollectionEntries");
+ V8FunctionCall function(m_client, context(), v8Value(), "getCollectionEntries");
function.appendArgument(objectId);
OwnPtr<protocol::Value> resultValue = makeCall(function);
protocol::ErrorSupport errors(errorString);
@@ -247,7 +247,7 @@ void InjectedScript::getCollectionEntries(ErrorString* errorString, const String
void InjectedScript::getProperties(ErrorString* errorString, const String16& objectId, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, OwnPtr<Array<PropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getProperties");
+ V8FunctionCall function(m_client, context(), v8Value(), "getProperties");
function.appendArgument(objectId);
function.appendArgument(ownProperties);
function.appendArgument(accessorPropertiesOnly);
@@ -266,7 +266,7 @@ void InjectedScript::getProperties(ErrorString* errorString, const String16& obj
void InjectedScript::getInternalProperties(ErrorString* errorString, const String16& objectId, Maybe<Array<InternalPropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getInternalProperties");
+ V8FunctionCall function(m_client, context(), v8Value(), "getInternalProperties");
function.appendArgument(objectId);
OwnPtr<protocol::Value> result = makeCallWithExceptionDetails(function, exceptionDetails);
@@ -297,14 +297,14 @@ v8::MaybeLocal<v8::Value> InjectedScript::runCompiledScript(v8::Local<v8::Script
v8::Local<v8::Symbol> commandLineAPISymbolValue = V8Debugger::commandLineAPISymbol(m_isolate);
v8::Local<v8::Object> global = context()->Global();
if (includeCommandLineAPI) {
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "commandLineAPI");
+ V8FunctionCall function(m_client, context(), v8Value(), "commandLineAPI");
bool hadException = false;
v8::Local<v8::Value> commandLineAPI = function.call(hadException, false);
if (!hadException)
global->Set(commandLineAPISymbolValue, commandLineAPI);
}
- v8::MaybeLocal<v8::Value> maybeValue = m_manager->debugger()->runCompiledScript(context(), script);
+ v8::MaybeLocal<v8::Value> maybeValue = m_client->runCompiledScript(context(), script);
if (includeCommandLineAPI)
global->Delete(context(), commandLineAPISymbolValue);
@@ -314,7 +314,7 @@ v8::MaybeLocal<v8::Value> InjectedScript::runCompiledScript(v8::Local<v8::Script
PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object> callFrames)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapCallFrames");
+ V8FunctionCall function(m_client, context(), v8Value(), "wrapCallFrames");
function.appendArgument(callFrames);
bool hadException = false;
v8::Local<v8::Value> callFramesValue = callFunctionWithEvalEnabled(function, hadException);
@@ -329,7 +329,7 @@ PassOwnPtr<Array<CallFrame>> InjectedScript::wrapCallFrames(v8::Local<v8::Object
PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject(v8::Local<v8::Value> value, const String16& groupName, bool generatePreview) const
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject");
+ V8FunctionCall function(m_client, context(), v8Value(), "wrapObject");
v8::Local<v8::Value> wrappedObject;
ErrorString errorString;
if (!wrapValue(&errorString, value, groupName, generatePreview).ToLocal(&wrappedObject))
@@ -358,7 +358,7 @@ bool InjectedScript::wrapObjectProperty(ErrorString* error, v8::Local<v8::Object
v8::MaybeLocal<v8::Value> InjectedScript::wrapValue(ErrorString* error, v8::Local<v8::Value> value, const String16& groupName, bool generatePreview) const
{
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject");
+ V8FunctionCall function(m_client, context(), v8Value(), "wrapObject");
function.appendArgument(value);
function.appendArgument(groupName);
function.appendArgument(canAccessInspectedWindow());
@@ -375,7 +375,7 @@ v8::MaybeLocal<v8::Value> InjectedScript::wrapValue(ErrorString* error, v8::Loca
PassOwnPtr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<v8::Value> table, v8::Local<v8::Value> columns) const
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapTable");
+ V8FunctionCall function(m_client, context(), v8Value(), "wrapTable");
function.appendArgument(canAccessInspectedWindow());
function.appendArgument(table);
if (columns.IsEmpty())
@@ -405,7 +405,7 @@ void InjectedScript::releaseObjectGroup(const String16& objectGroup)
v8::HandleScope handles(m_isolate);
m_native->releaseObjectGroup(objectGroup);
if (objectGroup == "console") {
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "clearLastEvaluationResult");
+ V8FunctionCall function(m_client, context(), v8Value(), "clearLastEvaluationResult");
bool hadException = false;
callFunctionWithEvalEnabled(function, hadException);
ASSERT(!hadException);
@@ -415,7 +415,7 @@ void InjectedScript::releaseObjectGroup(const String16& objectGroup)
void InjectedScript::setCustomObjectFormatterEnabled(bool enabled)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "setCustomObjectFormatterEnabled");
+ V8FunctionCall function(m_client, context(), v8Value(), "setCustomObjectFormatterEnabled");
function.appendArgument(enabled);
makeCall(function);
}
@@ -425,7 +425,7 @@ bool InjectedScript::canAccessInspectedWindow() const
v8::Local<v8::Context> callingContext = m_isolate->GetCallingContext();
if (callingContext.IsEmpty())
return true;
- return m_manager->debugger()->client()->callingContextCanAccessContext(callingContext, context());
+ return m_client->callingContextCanAccessContext(callingContext, context());
}
v8::Local<v8::Context> InjectedScript::context() const

Powered by Google App Engine
This is Rietveld 408576698