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

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

Issue 1769273004: Remove V8RecrusionScope, cleanup call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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 82093747a904d02bdfde8497b4e064f30d477013..32856de0f91046d11a1dbca22e41cffe71da5ea1 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -36,6 +36,7 @@
#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"
@@ -115,12 +116,11 @@ 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, V8DebuggerClient* client, PassOwnPtr<InjectedScriptNative> injectedScriptNative, int contextId)
+InjectedScript::InjectedScript(InjectedScriptManager* manager, v8::Local<v8::Context> context, v8::Local<v8::Object> object, 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_client, context(), v8Value(), "evaluate");
+ V8FunctionCall function(m_manager->debugger(), 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_client, context(), v8Value(), "callFunctionOn");
+ V8FunctionCall function(m_manager->debugger(), 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_client, context(), v8Value(), "evaluateOnCallFrame");
+ V8FunctionCall function(m_manager->debugger(), 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::getFunctionDetails(ErrorString* errorString, const String16& functionId, OwnPtr<FunctionDetails>* result)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_client, context(), v8Value(), "getFunctionDetails");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getFunctionDetails");
function.appendArgument(functionId);
OwnPtr<protocol::Value> resultValue = makeCall(function);
protocol::ErrorSupport errors(errorString);
@@ -182,7 +182,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_client, context(), v8Value(), "getCollectionEntries");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getCollectionEntries");
function.appendArgument(objectId);
OwnPtr<protocol::Value> resultValue = makeCall(function);
protocol::ErrorSupport errors(errorString);
@@ -192,7 +192,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_client, context(), v8Value(), "getProperties");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getProperties");
function.appendArgument(objectId);
function.appendArgument(ownProperties);
function.appendArgument(accessorPropertiesOnly);
@@ -211,7 +211,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_client, context(), v8Value(), "getInternalProperties");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "getInternalProperties");
function.appendArgument(objectId);
OwnPtr<protocol::Value> result = makeCallWithExceptionDetails(function, exceptionDetails);
@@ -242,14 +242,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_client, context(), v8Value(), "commandLineAPI");
+ V8FunctionCall function(m_manager->debugger(), 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_client->runCompiledScript(context(), script);
+ v8::MaybeLocal<v8::Value> maybeValue = m_manager->debugger()->runCompiledScript(context(), script);
if (includeCommandLineAPI)
global->Delete(context(), commandLineAPISymbolValue);
@@ -259,7 +259,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_client, context(), v8Value(), "wrapCallFrames");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapCallFrames");
function.appendArgument(callFrames);
bool hadException = false;
v8::Local<v8::Value> callFramesValue = callFunctionWithEvalEnabled(function, hadException);
@@ -274,7 +274,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_client, context(), v8Value(), "wrapObject");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject");
v8::Local<v8::Value> wrappedObject;
ErrorString errorString;
if (!wrapValue(&errorString, value, groupName, generatePreview).ToLocal(&wrappedObject))
@@ -303,7 +303,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_client, context(), v8Value(), "wrapObject");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapObject");
function.appendArgument(value);
function.appendArgument(groupName);
function.appendArgument(canAccessInspectedWindow());
@@ -320,7 +320,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_client, context(), v8Value(), "wrapTable");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "wrapTable");
function.appendArgument(canAccessInspectedWindow());
function.appendArgument(table);
if (columns.IsEmpty())
@@ -350,7 +350,7 @@ void InjectedScript::releaseObjectGroup(const String16& objectGroup)
v8::HandleScope handles(m_isolate);
m_native->releaseObjectGroup(objectGroup);
if (objectGroup == "console") {
- V8FunctionCall function(m_client, context(), v8Value(), "clearLastEvaluationResult");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "clearLastEvaluationResult");
bool hadException = false;
callFunctionWithEvalEnabled(function, hadException);
ASSERT(!hadException);
@@ -360,7 +360,7 @@ void InjectedScript::releaseObjectGroup(const String16& objectGroup)
void InjectedScript::setCustomObjectFormatterEnabled(bool enabled)
{
v8::HandleScope handles(m_isolate);
- V8FunctionCall function(m_client, context(), v8Value(), "setCustomObjectFormatterEnabled");
+ V8FunctionCall function(m_manager->debugger(), context(), v8Value(), "setCustomObjectFormatterEnabled");
function.appendArgument(enabled);
makeCall(function);
}
@@ -370,7 +370,7 @@ bool InjectedScript::canAccessInspectedWindow() const
v8::Local<v8::Context> callingContext = m_isolate->GetCallingContext();
if (callingContext.IsEmpty())
return true;
- return m_client->callingContextCanAccessContext(callingContext, context());
+ return m_manager->debugger()->client()->callingContextCanAccessContext(callingContext, context());
}
v8::Local<v8::Context> InjectedScript::context() const
@@ -498,7 +498,7 @@ v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument(ErrorString* error
if (callArgument->getType(String16()) == "number")
value = "Number(" + value + ")";
v8::Local<v8::Value> object;
- if (!m_client->compileAndRunInternalScript(toV8String(m_isolate, value)).ToLocal(&object)) {
+ if (!m_manager->debugger()->compileAndRunInternalScript(context(), toV8String(m_isolate, value)).ToLocal(&object)) {
*errorString = "Couldn't parse value object in call argument";
return v8::MaybeLocal<v8::Value>();
}

Powered by Google App Engine
This is Rietveld 408576698