[DevTools] Rename V8Debugger to V8Inspector.
BUG=631162
Review-Url: https://codereview.chromium.org/2199943004
Cr-Original-Commit-Position: refs/heads/master@{#409131}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: c17e5c2cbbc6afc9f0c325851a3b449396321082
diff --git a/InjectedScript.cpp b/InjectedScript.cpp
index b728a72..0ac2c29 100644
--- a/InjectedScript.cpp
+++ b/InjectedScript.cpp
@@ -39,14 +39,13 @@
#include "platform/v8_inspector/RemoteObjectId.h"
#include "platform/v8_inspector/V8Compat.h"
#include "platform/v8_inspector/V8Console.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
#include "platform/v8_inspector/V8FunctionCall.h"
#include "platform/v8_inspector/V8InjectedScriptHost.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8Debugger.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
using blink::protocol::Array;
using blink::protocol::Debugger::CallFrame;
@@ -72,7 +71,7 @@
v8::Context::Scope scope(context);
std::unique_ptr<InjectedScriptNative> injectedScriptNative(new InjectedScriptNative(isolate));
- v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::create(context, inspectedContext->debugger());
+ v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::create(context, inspectedContext->inspector());
injectedScriptNative->setOnInjectedScriptHost(scriptHostWrapper);
// Inject javascript into the context. The compiled script is supposed to evaluate into
@@ -82,7 +81,7 @@
// to create and configure InjectedScript instance that is going to be used by the inspector.
String16 injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSource_js), sizeof(InjectedScriptSource_js));
v8::Local<v8::Value> value;
- if (!inspectedContext->debugger()->compileAndRunInternalScript(context, toV8String(isolate, injectedScriptSource)).ToLocal(&value))
+ if (!inspectedContext->inspector()->compileAndRunInternalScript(context, toV8String(isolate, injectedScriptSource)).ToLocal(&value))
return nullptr;
DCHECK(value->IsFunction());
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value);
@@ -111,7 +110,7 @@
void InjectedScript::getProperties(ErrorString* errorString, v8::Local<v8::Object> object, const String16& groupName, bool ownProperties, bool accessorPropertiesOnly, bool generatePreview, std::unique_ptr<Array<PropertyDescriptor>>* properties, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails)
{
v8::HandleScope handles(m_context->isolate());
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "getProperties");
+ V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "getProperties");
function.appendArgument(object);
function.appendArgument(groupName);
function.appendArgument(ownProperties);
@@ -179,7 +178,7 @@
bool InjectedScript::wrapPropertyInArray(ErrorString* errorString, v8::Local<v8::Array> array, v8::Local<v8::String> property, const String16& groupName, bool forceValueType, bool generatePreview) const
{
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "wrapPropertyInArray");
+ V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "wrapPropertyInArray");
function.appendArgument(array);
function.appendArgument(property);
function.appendArgument(groupName);
@@ -192,7 +191,7 @@
bool InjectedScript::wrapObjectsInArray(ErrorString* errorString, v8::Local<v8::Array> array, const String16& groupName, bool forceValueType, bool generatePreview) const
{
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "wrapObjectsInArray");
+ V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "wrapObjectsInArray");
function.appendArgument(array);
function.appendArgument(groupName);
function.appendArgument(forceValueType);
@@ -204,7 +203,7 @@
v8::MaybeLocal<v8::Value> InjectedScript::wrapValue(ErrorString* errorString, v8::Local<v8::Value> value, const String16& groupName, bool forceValueType, bool generatePreview) const
{
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "wrapObject");
+ V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "wrapObject");
function.appendArgument(value);
function.appendArgument(groupName);
function.appendArgument(forceValueType);
@@ -219,7 +218,7 @@
std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(v8::Local<v8::Value> table, v8::Local<v8::Value> columns) const
{
v8::HandleScope handles(m_context->isolate());
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "wrapTable");
+ V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "wrapTable");
function.appendArgument(table);
if (columns.IsEmpty())
function.appendArgument(false);
@@ -256,7 +255,7 @@
void InjectedScript::setCustomObjectFormatterEnabled(bool enabled)
{
v8::HandleScope handles(m_context->isolate());
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "setCustomObjectFormatterEnabled");
+ V8FunctionCall function(m_context->inspector(), m_context->context(), v8Value(), "setCustomObjectFormatterEnabled");
function.appendArgument(enabled);
bool hadException = false;
function.call(hadException);
@@ -295,7 +294,7 @@
if (callArgument->getType(String16()) == "number")
value = "Number(" + value + ")";
v8::Local<v8::Value> object;
- if (!m_context->debugger()->compileAndRunInternalScript(m_context->context(), toV8String(m_context->isolate(), value)).ToLocal(&object)) {
+ if (!m_context->inspector()->compileAndRunInternalScript(m_context->context(), toV8String(m_context->isolate(), value)).ToLocal(&object)) {
*errorString = "Couldn't parse value object in call argument";
return v8::MaybeLocal<v8::Value>();
}
@@ -315,7 +314,7 @@
v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace();
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
- exceptionDetailsObject->setStackTrace(m_context->debugger()->createStackTraceImpl(stackTrace)->buildInspectorObjectImpl());
+ exceptionDetailsObject->setStackTrace(m_context->inspector()->createStackTraceImpl(stackTrace)->buildInspectorObjectImpl());
return exceptionDetailsObject;
}
@@ -353,15 +352,15 @@
return m_commandLineAPI.Get(m_context->isolate());
}
-InjectedScript::Scope::Scope(ErrorString* errorString, V8DebuggerImpl* debugger, int contextGroupId)
+InjectedScript::Scope::Scope(ErrorString* errorString, V8InspectorImpl* inspector, int contextGroupId)
: m_errorString(errorString)
- , m_debugger(debugger)
+ , m_inspector(inspector)
, m_contextGroupId(contextGroupId)
, m_injectedScript(nullptr)
- , m_handleScope(debugger->isolate())
- , m_tryCatch(debugger->isolate())
+ , m_handleScope(inspector->isolate())
+ , m_tryCatch(inspector->isolate())
, m_ignoreExceptionsAndMuteConsole(false)
- , m_previousPauseOnExceptionsState(V8DebuggerImpl::DontPauseOnExceptions)
+ , m_previousPauseOnExceptionsState(V8InspectorImpl::DontPauseOnExceptions)
, m_userGesture(false)
{
}
@@ -370,7 +369,7 @@
{
cleanup();
// TODO(dgozman): what if we reattach to the same context group during evaluate? Introduce a session id?
- V8InspectorSessionImpl* session = m_debugger->sessionForContextGroup(m_contextGroupId);
+ V8InspectorSessionImpl* session = m_inspector->sessionForContextGroup(m_contextGroupId);
if (!session) {
*m_errorString = "Internal error";
return false;
@@ -394,17 +393,17 @@
{
DCHECK(!m_ignoreExceptionsAndMuteConsole);
m_ignoreExceptionsAndMuteConsole = true;
- m_debugger->client()->muteWarningsAndDeprecations(m_contextGroupId);
- m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl::DontPauseOnExceptions);
+ m_inspector->client()->muteWarningsAndDeprecations(m_contextGroupId);
+ m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8InspectorImpl::DontPauseOnExceptions);
}
-V8DebuggerImpl::PauseOnExceptionsState InjectedScript::Scope::setPauseOnExceptionsState(V8DebuggerImpl::PauseOnExceptionsState newState)
+V8InspectorImpl::PauseOnExceptionsState InjectedScript::Scope::setPauseOnExceptionsState(V8InspectorImpl::PauseOnExceptionsState newState)
{
- if (!m_debugger->enabled())
+ if (!m_inspector->enabled())
return newState;
- V8DebuggerImpl::PauseOnExceptionsState presentState = m_debugger->getPauseOnExceptionsState();
+ V8InspectorImpl::PauseOnExceptionsState presentState = m_inspector->getPauseOnExceptionsState();
if (presentState != newState)
- m_debugger->setPauseOnExceptionsState(newState);
+ m_inspector->setPauseOnExceptionsState(newState);
return presentState;
}
@@ -412,7 +411,7 @@
{
DCHECK(!m_userGesture);
m_userGesture = true;
- m_debugger->client()->beginUserGesture();
+ m_inspector->client()->beginUserGesture();
}
void InjectedScript::Scope::cleanup()
@@ -428,15 +427,15 @@
{
if (m_ignoreExceptionsAndMuteConsole) {
setPauseOnExceptionsState(m_previousPauseOnExceptionsState);
- m_debugger->client()->unmuteWarningsAndDeprecations(m_contextGroupId);
+ m_inspector->client()->unmuteWarningsAndDeprecations(m_contextGroupId);
}
if (m_userGesture)
- m_debugger->client()->endUserGesture();
+ m_inspector->client()->endUserGesture();
cleanup();
}
-InjectedScript::ContextScope::ContextScope(ErrorString* errorString, V8DebuggerImpl* debugger, int contextGroupId, int executionContextId)
- : InjectedScript::Scope(errorString, debugger, contextGroupId)
+InjectedScript::ContextScope::ContextScope(ErrorString* errorString, V8InspectorImpl* inspector, int contextGroupId, int executionContextId)
+ : InjectedScript::Scope(errorString, inspector, contextGroupId)
, m_executionContextId(executionContextId)
{
}
@@ -450,8 +449,8 @@
m_injectedScript = session->findInjectedScript(m_errorString, m_executionContextId);
}
-InjectedScript::ObjectScope::ObjectScope(ErrorString* errorString, V8DebuggerImpl* debugger, int contextGroupId, const String16& remoteObjectId)
- : InjectedScript::Scope(errorString, debugger, contextGroupId)
+InjectedScript::ObjectScope::ObjectScope(ErrorString* errorString, V8InspectorImpl* inspector, int contextGroupId, const String16& remoteObjectId)
+ : InjectedScript::Scope(errorString, inspector, contextGroupId)
, m_remoteObjectId(remoteObjectId)
{
}
@@ -474,8 +473,8 @@
m_injectedScript = injectedScript;
}
-InjectedScript::CallFrameScope::CallFrameScope(ErrorString* errorString, V8DebuggerImpl* debugger, int contextGroupId, const String16& remoteObjectId)
- : InjectedScript::Scope(errorString, debugger, contextGroupId)
+InjectedScript::CallFrameScope::CallFrameScope(ErrorString* errorString, V8InspectorImpl* inspector, int contextGroupId, const String16& remoteObjectId)
+ : InjectedScript::Scope(errorString, inspector, contextGroupId)
, m_remoteCallFrameId(remoteObjectId)
{
}
diff --git a/InjectedScript.h b/InjectedScript.h
index ab847ee..e9b2414 100644
--- a/InjectedScript.h
+++ b/InjectedScript.h
@@ -36,7 +36,7 @@
#include "platform/v8_inspector/InjectedScriptNative.h"
#include "platform/v8_inspector/InspectedContext.h"
#include "platform/v8_inspector/V8Console.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/protocol/Runtime.h"
#include <v8.h>
@@ -99,32 +99,32 @@
const v8::TryCatch& tryCatch() const { return m_tryCatch; }
protected:
- Scope(ErrorString*, V8DebuggerImpl*, int contextGroupId);
+ Scope(ErrorString*, V8InspectorImpl*, int contextGroupId);
~Scope();
virtual void findInjectedScript(V8InspectorSessionImpl*) = 0;
ErrorString* m_errorString;
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
int m_contextGroupId;
InjectedScript* m_injectedScript;
private:
void cleanup();
- V8DebuggerImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8DebuggerImpl::PauseOnExceptionsState);
+ V8InspectorImpl::PauseOnExceptionsState setPauseOnExceptionsState(V8InspectorImpl::PauseOnExceptionsState);
v8::HandleScope m_handleScope;
v8::TryCatch m_tryCatch;
v8::Local<v8::Context> m_context;
std::unique_ptr<V8Console::CommandLineAPIScope> m_commandLineAPIScope;
bool m_ignoreExceptionsAndMuteConsole;
- V8DebuggerImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState;
+ V8InspectorImpl::PauseOnExceptionsState m_previousPauseOnExceptionsState;
bool m_userGesture;
};
class ContextScope: public Scope {
PROTOCOL_DISALLOW_COPY(ContextScope);
public:
- ContextScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, int executionContextId);
+ ContextScope(ErrorString*, V8InspectorImpl*, int contextGroupId, int executionContextId);
~ContextScope();
private:
void findInjectedScript(V8InspectorSessionImpl*) override;
@@ -134,7 +134,7 @@
class ObjectScope: public Scope {
PROTOCOL_DISALLOW_COPY(ObjectScope);
public:
- ObjectScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, const String16& remoteObjectId);
+ ObjectScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const String16& remoteObjectId);
~ObjectScope();
const String16& objectGroupName() const { return m_objectGroupName; }
v8::Local<v8::Value> object() const { return m_object; }
@@ -148,7 +148,7 @@
class CallFrameScope: public Scope {
PROTOCOL_DISALLOW_COPY(CallFrameScope);
public:
- CallFrameScope(ErrorString*, V8DebuggerImpl*, int contextGroupId, const String16& remoteCallFrameId);
+ CallFrameScope(ErrorString*, V8InspectorImpl*, int contextGroupId, const String16& remoteCallFrameId);
~CallFrameScope();
size_t frameOrdinal() const { return m_frameOrdinal; }
private:
diff --git a/InspectedContext.cpp b/InspectedContext.cpp
index bf41819..3d51e94 100644
--- a/InspectedContext.cpp
+++ b/InspectedContext.cpp
@@ -6,10 +6,10 @@
#include "platform/v8_inspector/InjectedScript.h"
#include "platform/v8_inspector/V8Console.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
#include "platform/v8_inspector/public/V8ContextInfo.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
namespace blink {
@@ -20,7 +20,7 @@
context->m_context.Reset();
data.SetSecondPassCallback(&InspectedContext::weakCallback);
} else {
- context->m_debugger->discardInspectedContext(context->m_contextGroupId, context->m_contextId);
+ context->m_inspector->discardInspectedContext(context->m_contextGroupId, context->m_contextId);
}
}
@@ -29,8 +29,8 @@
data.GetParameter()->m_console.Reset();
}
-InspectedContext::InspectedContext(V8DebuggerImpl* debugger, const V8ContextInfo& info, int contextId)
- : m_debugger(debugger)
+InspectedContext::InspectedContext(V8InspectorImpl* inspector, const V8ContextInfo& info, int contextId)
+ : m_inspector(inspector)
, m_context(info.context->GetIsolate(), info.context)
, m_contextId(contextId)
, m_contextGroupId(info.contextGroupId)
@@ -42,7 +42,7 @@
{
m_context.SetWeak(this, &InspectedContext::weakCallback, v8::WeakCallbackType::kParameter);
- v8::Isolate* isolate = m_debugger->isolate();
+ v8::Isolate* isolate = m_inspector->isolate();
v8::Local<v8::Object> global = info.context->Global();
v8::Local<v8::Object> console = V8Console::createConsole(this, info.hasMemoryOnConsole);
if (!global->Set(info.context, toV8StringInternalized(isolate, "console"), console).FromMaybe(false))
@@ -66,7 +66,7 @@
v8::Isolate* InspectedContext::isolate() const
{
- return m_debugger->isolate();
+ return m_inspector->isolate();
}
void InspectedContext::createInjectedScript()
diff --git a/InspectedContext.h b/InspectedContext.h
index ecff5e4..aadb810 100644
--- a/InspectedContext.h
+++ b/InspectedContext.h
@@ -15,7 +15,7 @@
class InjectedScript;
class InjectedScriptHost;
class V8ContextInfo;
-class V8DebuggerImpl;
+class V8InspectorImpl;
class InspectedContext {
PROTOCOL_DISALLOW_COPY(InspectedContext);
@@ -34,19 +34,19 @@
void setReported(bool reported) { m_reported = reported; }
v8::Isolate* isolate() const;
- V8DebuggerImpl* debugger() const { return m_debugger; }
+ V8InspectorImpl* inspector() const { return m_inspector; }
InjectedScript* getInjectedScript() { return m_injectedScript.get(); }
void createInjectedScript();
void discardInjectedScript();
private:
- friend class V8DebuggerImpl;
- InspectedContext(V8DebuggerImpl*, const V8ContextInfo&, int contextId);
+ friend class V8InspectorImpl;
+ InspectedContext(V8InspectorImpl*, const V8ContextInfo&, int contextId);
static void weakCallback(const v8::WeakCallbackInfo<InspectedContext>&);
static void consoleWeakCallback(const v8::WeakCallbackInfo<InspectedContext>&);
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
v8::Global<v8::Context> m_context;
int m_contextId;
int m_contextGroupId;
diff --git a/V8Console.cpp b/V8Console.cpp
index 2440748..4556d45 100644
--- a/V8Console.cpp
+++ b/V8Console.cpp
@@ -11,13 +11,13 @@
#include "platform/v8_inspector/V8Compat.h"
#include "platform/v8_inspector/V8ConsoleMessage.h"
#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8ProfilerAgentImpl.h"
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
namespace blink {
@@ -36,7 +36,7 @@
, m_isolate(info.GetIsolate())
, m_context(info.GetIsolate()->GetCurrentContext())
, m_inspectedContext(nullptr)
- , m_debuggerClient(nullptr)
+ , m_inspectorClient(nullptr)
{
}
@@ -65,15 +65,15 @@
return m_inspectedContext;
}
- V8DebuggerClient* ensureDebuggerClient()
+ V8InspectorClient* ensureDebuggerClient()
{
- if (m_debuggerClient)
- return m_debuggerClient;
+ if (m_inspectorClient)
+ return m_inspectorClient;
InspectedContext* inspectedContext = ensureInspectedContext();
if (!inspectedContext)
return nullptr;
- m_debuggerClient = inspectedContext->debugger()->client();
- return m_debuggerClient;
+ m_inspectorClient = inspectedContext->inspector()->client();
+ return m_inspectorClient;
}
void reportCall(ConsoleAPIType type)
@@ -107,9 +107,9 @@
InspectedContext* inspectedContext = ensureInspectedContext();
if (!inspectedContext)
return;
- V8DebuggerImpl* debugger = inspectedContext->debugger();
- std::unique_ptr<V8ConsoleMessage> message = V8ConsoleMessage::createForConsoleAPI(debugger->client()->currentTimeMS(), type, arguments, debugger->captureStackTraceImpl(false), inspectedContext);
- debugger->ensureConsoleMessageStorage(inspectedContext->contextGroupId())->addMessage(std::move(message));
+ V8InspectorImpl* inspector = inspectedContext->inspector();
+ std::unique_ptr<V8ConsoleMessage> message = V8ConsoleMessage::createForConsoleAPI(inspector->client()->currentTimeMS(), type, arguments, inspector->captureStackTraceImpl(false), inspectedContext);
+ inspector->ensureConsoleMessageStorage(inspectedContext->contextGroupId())->addMessage(std::move(message));
}
void reportDeprecatedCall(const char* id, const String16& message)
@@ -233,7 +233,7 @@
InspectedContext* inspectedContext = ensureInspectedContext();
if (!inspectedContext)
return nullptr;
- return inspectedContext->debugger()->sessionForContextGroup(inspectedContext->contextGroupId());
+ return inspectedContext->inspector()->sessionForContextGroup(inspectedContext->contextGroupId());
}
private:
@@ -242,7 +242,7 @@
v8::Local<v8::Context> m_context;
v8::Local<v8::Object> m_console;
InspectedContext* m_inspectedContext;
- V8DebuggerClient* m_debuggerClient;
+ V8InspectorClient* m_inspectorClient;
bool checkAndSetPrivateFlagOnConsole(const char* name, bool defaultValue)
{
@@ -413,7 +413,7 @@
static void timeFunction(const v8::FunctionCallbackInfo<v8::Value>& info, bool timelinePrefix)
{
ConsoleHelper helper(info);
- if (V8DebuggerClient* client = helper.ensureDebuggerClient()) {
+ if (V8InspectorClient* client = helper.ensureDebuggerClient()) {
String16 protocolTitle = helper.firstArgToString("default");
if (timelinePrefix)
protocolTitle = "Timeline '" + protocolTitle + "'";
@@ -429,7 +429,7 @@
static void timeEndFunction(const v8::FunctionCallbackInfo<v8::Value>& info, bool timelinePrefix)
{
ConsoleHelper helper(info);
- if (V8DebuggerClient* client = helper.ensureDebuggerClient()) {
+ if (V8InspectorClient* client = helper.ensureDebuggerClient()) {
String16 protocolTitle = helper.firstArgToString("default");
if (timelinePrefix)
protocolTitle = "Timeline '" + protocolTitle + "'";
@@ -469,13 +469,13 @@
void V8Console::timeStampCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
ConsoleHelper helper(info);
- if (V8DebuggerClient* client = helper.ensureDebuggerClient())
+ if (V8InspectorClient* client = helper.ensureDebuggerClient())
client->consoleTimeStamp(helper.firstArgToString(String16()));
}
void V8Console::memoryGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- if (V8DebuggerClient* client = ConsoleHelper(info).ensureDebuggerClient()) {
+ if (V8InspectorClient* client = ConsoleHelper(info).ensureDebuggerClient()) {
v8::Local<v8::Value> memoryValue;
if (!client->memoryInfo(info.GetIsolate(), info.GetIsolate()->GetCurrentContext()).ToLocal(&memoryValue))
return;
@@ -731,7 +731,7 @@
createBoundFunctionProperty(context, commandLineAPI, "$3", V8Console::inspectedObject3);
createBoundFunctionProperty(context, commandLineAPI, "$4", V8Console::inspectedObject4);
- inspectedContext->debugger()->client()->installAdditionalCommandLineAPI(context, commandLineAPI);
+ inspectedContext->inspector()->client()->installAdditionalCommandLineAPI(context, commandLineAPI);
commandLineAPI->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::External::New(isolate, inspectedContext));
return commandLineAPI;
diff --git a/V8ConsoleAgentImpl.cpp b/V8ConsoleAgentImpl.cpp
index ab40175..0292dbb 100644
--- a/V8ConsoleAgentImpl.cpp
+++ b/V8ConsoleAgentImpl.cpp
@@ -5,7 +5,7 @@
#include "platform/v8_inspector/V8ConsoleAgentImpl.h"
#include "platform/v8_inspector/V8ConsoleMessage.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
@@ -33,7 +33,7 @@
return;
m_state->setBoolean(ConsoleAgentState::consoleEnabled, true);
m_enabled = true;
- m_session->debugger()->enableStackCapturingIfNeeded();
+ m_session->inspector()->enableStackCapturingIfNeeded();
reportAllMessages();
}
@@ -41,7 +41,7 @@
{
if (!m_enabled)
return;
- m_session->debugger()->disableStackCapturingIfNeeded();
+ m_session->inspector()->disableStackCapturingIfNeeded();
m_state->setBoolean(ConsoleAgentState::consoleEnabled, false);
m_enabled = false;
}
@@ -71,7 +71,7 @@
void V8ConsoleAgentImpl::reportAllMessages()
{
- V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessageStorage(m_session->contextGroupId());
+ V8ConsoleMessageStorage* storage = m_session->inspector()->ensureConsoleMessageStorage(m_session->contextGroupId());
for (const auto& message : storage->messages()) {
if (message->origin() == V8MessageOrigin::kConsole)
reportMessage(message.get(), false);
diff --git a/V8ConsoleMessage.cpp b/V8ConsoleMessage.cpp
index 2baa90e..84bcc3d 100644
--- a/V8ConsoleMessage.cpp
+++ b/V8ConsoleMessage.cpp
@@ -6,12 +6,12 @@
#include "platform/v8_inspector/InspectedContext.h"
#include "platform/v8_inspector/V8ConsoleAgentImpl.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
namespace blink {
@@ -219,7 +219,7 @@
{
if (!m_arguments.size() || !m_contextId)
return nullptr;
- InspectedContext* inspectedContext = session->debugger()->getContext(session->contextGroupId(), m_contextId);
+ InspectedContext* inspectedContext = session->inspector()->getContext(session->contextGroupId(), m_contextId);
if (!inspectedContext)
return nullptr;
@@ -296,7 +296,7 @@
if (!m_arguments.size() || !m_contextId)
return nullptr;
DCHECK_EQ(1u, m_arguments.size());
- InspectedContext* inspectedContext = session->debugger()->getContext(session->contextGroupId(), m_contextId);
+ InspectedContext* inspectedContext = session->inspector()->getContext(session->contextGroupId(), m_contextId);
if (!inspectedContext)
return nullptr;
@@ -344,7 +344,7 @@
clientType = V8ConsoleAPIType::kInfo;
else if (type == ConsoleAPIType::kClear)
clientType = V8ConsoleAPIType::kClear;
- context->debugger()->client()->consoleAPIMessage(context->contextGroupId(), clientType, message->m_message, message->m_url, message->m_lineNumber, message->m_columnNumber, message->m_stackTrace.get());
+ context->inspector()->client()->consoleAPIMessage(context->contextGroupId(), clientType, message->m_message, message->m_url, message->m_lineNumber, message->m_columnNumber, message->m_stackTrace.get());
return message;
}
@@ -384,8 +384,8 @@
// ------------------------ V8ConsoleMessageStorage ----------------------------
-V8ConsoleMessageStorage::V8ConsoleMessageStorage(V8DebuggerImpl* debugger, int contextGroupId)
- : m_debugger(debugger)
+V8ConsoleMessageStorage::V8ConsoleMessageStorage(V8InspectorImpl* inspector, int contextGroupId)
+ : m_inspector(inspector)
, m_contextGroupId(contextGroupId)
, m_expiredCount(0)
{
@@ -401,7 +401,7 @@
if (message->type() == ConsoleAPIType::kClear)
clear();
- V8InspectorSessionImpl* session = m_debugger->sessionForContextGroup(m_contextGroupId);
+ V8InspectorSessionImpl* session = m_inspector->sessionForContextGroup(m_contextGroupId);
if (session) {
if (message->origin() == V8MessageOrigin::kConsole)
session->consoleAgent()->messageAdded(message.get());
@@ -420,7 +420,7 @@
{
m_messages.clear();
m_expiredCount = 0;
- if (V8InspectorSessionImpl* session = m_debugger->sessionForContextGroup(m_contextGroupId))
+ if (V8InspectorSessionImpl* session = m_inspector->sessionForContextGroup(m_contextGroupId))
session->releaseObjectGroup("console");
}
diff --git a/V8ConsoleMessage.h b/V8ConsoleMessage.h
index 373f9f7..9c26f5d 100644
--- a/V8ConsoleMessage.h
+++ b/V8ConsoleMessage.h
@@ -15,7 +15,7 @@
namespace blink {
class InspectedContext;
-class V8DebuggerImpl;
+class V8InspectorImpl;
class V8InspectorSessionImpl;
class V8StackTraceImpl;
@@ -85,7 +85,7 @@
class V8ConsoleMessageStorage {
public:
- V8ConsoleMessageStorage(V8DebuggerImpl*, int contextGroupId);
+ V8ConsoleMessageStorage(V8InspectorImpl*, int contextGroupId);
~V8ConsoleMessageStorage();
int contextGroupId() { return m_contextGroupId; }
@@ -97,7 +97,7 @@
void clear();
private:
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
int m_contextGroupId;
int m_expiredCount;
std::deque<std::unique_ptr<V8ConsoleMessage>> m_messages;
diff --git a/V8DebuggerAgentImpl.cpp b/V8DebuggerAgentImpl.cpp
index a8a677b..46c5e52 100644
--- a/V8DebuggerAgentImpl.cpp
+++ b/V8DebuggerAgentImpl.cpp
@@ -11,13 +11,13 @@
#include "platform/v8_inspector/JavaScriptCallFrame.h"
#include "platform/v8_inspector/RemoteObjectId.h"
#include "platform/v8_inspector/ScriptBreakpoint.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8Regex.h"
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8Debugger.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
#include <algorithm>
@@ -93,12 +93,12 @@
}
V8DebuggerAgentImpl::V8DebuggerAgentImpl(V8InspectorSessionImpl* session, protocol::FrontendChannel* frontendChannel, protocol::DictionaryValue* state)
- : m_debugger(session->debugger())
+ : m_inspector(session->inspector())
, m_session(session)
, m_enabled(false)
, m_state(state)
, m_frontend(frontendChannel)
- , m_isolate(m_debugger->isolate())
+ , m_isolate(m_inspector->isolate())
, m_breakReason(protocol::Debugger::Paused::ReasonEnum::Other)
, m_scheduledDebuggerStep(NoStep)
, m_skipNextDebuggerStepOut(false)
@@ -127,19 +127,19 @@
void V8DebuggerAgentImpl::enable()
{
- // debugger().addListener may result in reporting all parsed scripts to
+ // m_inspector->addListener may result in reporting all parsed scripts to
// the agent so it should already be in enabled state by then.
m_enabled = true;
m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true);
- debugger().debuggerAgentEnabled();
+ m_inspector->debuggerAgentEnabled();
std::vector<std::unique_ptr<V8DebuggerScript>> compiledScripts;
- debugger().getCompiledScripts(m_session->contextGroupId(), compiledScripts);
+ m_inspector->getCompiledScripts(m_session->contextGroupId(), compiledScripts);
for (size_t i = 0; i < compiledScripts.size(); i++)
didParseSource(std::move(compiledScripts[i]), true);
// FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends
- debugger().setBreakpointsActivated(true);
+ m_inspector->setBreakpointsActivated(true);
}
bool V8DebuggerAgentImpl::enabled()
@@ -152,7 +152,7 @@
if (enabled())
return;
- if (!m_debugger->client()->canExecuteScripts(m_session->contextGroupId())) {
+ if (!m_inspector->client()->canExecuteScripts(m_session->contextGroupId())) {
*errorString = "Script execution is prohibited";
return;
}
@@ -166,19 +166,19 @@
return;
m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::DictionaryValue::create());
- m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImpl::DontPauseOnExceptions);
+ m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, V8InspectorImpl::DontPauseOnExceptions);
m_state->setInteger(DebuggerAgentState::asyncCallStackDepth, 0);
if (!m_pausedContext.IsEmpty())
- debugger().continueProgram();
- debugger().debuggerAgentDisabled();
+ m_inspector->continueProgram();
+ m_inspector->debuggerAgentDisabled();
m_pausedContext.Reset();
JavaScriptCallFrames emptyCallFrames;
m_pausedCallFrames.swap(emptyCallFrames);
m_scripts.clear();
m_blackboxedPositions.clear();
m_breakpointIdToDebuggerBreakpointIds.clear();
- m_debugger->setAsyncCallStackDepth(this, 0);
+ m_inspector->setAsyncCallStackDepth(this, 0);
m_continueToLocationBreakpointId = String16();
clearBreakDetails();
m_scheduledDebuggerStep = NoStep;
@@ -200,13 +200,13 @@
DCHECK(!m_enabled);
if (!m_state->booleanProperty(DebuggerAgentState::debuggerEnabled, false))
return;
- if (!m_debugger->client()->canExecuteScripts(m_session->contextGroupId()))
+ if (!m_inspector->client()->canExecuteScripts(m_session->contextGroupId()))
return;
enable();
ErrorString error;
- int pauseState = V8DebuggerImpl::DontPauseOnExceptions;
+ int pauseState = V8InspectorImpl::DontPauseOnExceptions;
m_state->getInteger(DebuggerAgentState::pauseOnExceptionsState, &pauseState);
setPauseOnExceptionsImpl(&error, pauseState);
DCHECK(error.isEmpty());
@@ -215,7 +215,7 @@
int asyncCallStackDepth = 0;
m_state->getInteger(DebuggerAgentState::asyncCallStackDepth, &asyncCallStackDepth);
- m_debugger->setAsyncCallStackDepth(this, asyncCallStackDepth);
+ m_inspector->setAsyncCallStackDepth(this, asyncCallStackDepth);
String16 blackboxPattern;
if (m_state->getString(DebuggerAgentState::blackboxPattern, &blackboxPattern)) {
@@ -228,7 +228,7 @@
{
if (!checkEnabled(errorString))
return;
- debugger().setBreakpointsActivated(active);
+ m_inspector->setBreakpointsActivated(active);
}
void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skipped)
@@ -248,10 +248,10 @@
return breakpointObject;
}
-static bool matches(V8DebuggerImpl* debugger, const String16& url, const String16& pattern, bool isRegex)
+static bool matches(V8InspectorImpl* inspector, const String16& url, const String16& pattern, bool isRegex)
{
if (isRegex) {
- V8Regex regex(debugger, pattern, true);
+ V8Regex regex(inspector, pattern, true);
return regex.match(url) != -1;
}
return url == pattern;
@@ -300,7 +300,7 @@
ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition);
for (const auto& script : m_scripts) {
- if (!matches(m_debugger, script.second->sourceURL(), url, isRegex))
+ if (!matches(m_inspector, script.second->sourceURL(), url, isRegex))
continue;
std::unique_ptr<protocol::Debugger::Location> location = resolveBreakpoint(breakpointId, script.first, breakpoint, UserBreakpointSource);
if (location)
@@ -366,7 +366,7 @@
for (size_t i = 0; i < ids.size(); ++i) {
const String16& debuggerBreakpointId = ids[i];
- debugger().removeBreakpoint(debuggerBreakpointId);
+ m_inspector->removeBreakpoint(debuggerBreakpointId);
m_serverBreakpoints.erase(debuggerBreakpointId);
}
m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId);
@@ -379,7 +379,7 @@
if (!checkEnabled(errorString))
return;
if (!m_continueToLocationBreakpointId.isEmpty()) {
- debugger().removeBreakpoint(m_continueToLocationBreakpointId);
+ m_inspector->removeBreakpoint(m_continueToLocationBreakpointId);
m_continueToLocationBreakpointId = "";
}
@@ -391,7 +391,7 @@
return;
ScriptBreakpoint breakpoint(lineNumber, columnNumber, "");
- m_continueToLocationBreakpointId = debugger().setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false));
+ m_continueToLocationBreakpointId = m_inspector->setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false));
resume(errorString);
}
@@ -399,7 +399,7 @@
{
if (!assertPaused(errorString))
return;
- JavaScriptCallFrames frames = debugger().currentCallFrames();
+ JavaScriptCallFrames frames = m_inspector->currentCallFrames();
m_pausedCallFrames.swap(frames);
*callFrames = currentCallFrames(errorString);
if (!*callFrames)
@@ -410,7 +410,7 @@
bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed()
{
DCHECK(enabled());
- JavaScriptCallFrames callFrames = debugger().currentCallFrames();
+ JavaScriptCallFrames callFrames = m_inspector->currentCallFrames();
for (size_t index = 0; index < callFrames.size(); ++index) {
if (!isCallFrameWithUnknownScriptOrBlackboxed(callFrames[index].get()))
return false;
@@ -498,7 +498,7 @@
int actualLineNumber;
int actualColumnNumber;
- String16 debuggerBreakpointId = debugger().setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber, false);
+ String16 debuggerBreakpointId = m_inspector->setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber, false);
if (debuggerBreakpointId.isEmpty())
return nullptr;
@@ -541,7 +541,7 @@
v8::HandleScope handles(m_isolate);
v8::Local<v8::String> newSource = toV8String(m_isolate, newContent);
- if (!debugger().setScriptSource(scriptId, newSource, preview.fromMaybe(false), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged))
+ if (!m_inspector->setScriptSource(scriptId, newSource, preview.fromMaybe(false), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged))
return;
ScriptsMap::iterator it = m_scripts.find(scriptId);
@@ -562,7 +562,7 @@
{
if (!assertPaused(errorString))
return;
- InjectedScript::CallFrameScope scope(errorString, m_debugger, m_session->contextGroupId(), callFrameId);
+ InjectedScript::CallFrameScope scope(errorString, m_inspector, m_session->contextGroupId(), callFrameId);
if (!scope.initialize())
return;
if (scope.frameOrdinal() >= m_pausedCallFrames.size()) {
@@ -576,7 +576,7 @@
*errorString = "Internal error";
return;
}
- JavaScriptCallFrames frames = debugger().currentCallFrames();
+ JavaScriptCallFrames frames = m_inspector->currentCallFrames();
m_pausedCallFrames.swap(frames);
*newCallFrames = currentCallFrames(errorString);
@@ -600,48 +600,48 @@
void V8DebuggerAgentImpl::schedulePauseOnNextStatement(const String16& breakReason, std::unique_ptr<protocol::DictionaryValue> data)
{
- if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseScheduled || debugger().isPaused() || !debugger().breakpointsActivated())
+ if (!enabled() || m_scheduledDebuggerStep == StepInto || m_javaScriptPauseScheduled || m_inspector->isPaused() || !m_inspector->breakpointsActivated())
return;
m_breakReason = breakReason;
m_breakAuxData = std::move(data);
m_pausingOnNativeEvent = true;
m_skipNextDebuggerStepOut = false;
- debugger().setPauseOnNextStatement(true);
+ m_inspector->setPauseOnNextStatement(true);
}
void V8DebuggerAgentImpl::schedulePauseOnNextStatementIfSteppingInto()
{
DCHECK(enabled());
- if (m_scheduledDebuggerStep != StepInto || m_javaScriptPauseScheduled || debugger().isPaused())
+ if (m_scheduledDebuggerStep != StepInto || m_javaScriptPauseScheduled || m_inspector->isPaused())
return;
clearBreakDetails();
m_pausingOnNativeEvent = false;
m_skippedStepFrameCount = 0;
m_recursionLevelForStepFrame = 0;
- debugger().setPauseOnNextStatement(true);
+ m_inspector->setPauseOnNextStatement(true);
}
void V8DebuggerAgentImpl::cancelPauseOnNextStatement()
{
- if (m_javaScriptPauseScheduled || debugger().isPaused())
+ if (m_javaScriptPauseScheduled || m_inspector->isPaused())
return;
clearBreakDetails();
m_pausingOnNativeEvent = false;
- debugger().setPauseOnNextStatement(false);
+ m_inspector->setPauseOnNextStatement(false);
}
void V8DebuggerAgentImpl::pause(ErrorString* errorString)
{
if (!checkEnabled(errorString))
return;
- if (m_javaScriptPauseScheduled || debugger().isPaused())
+ if (m_javaScriptPauseScheduled || m_inspector->isPaused())
return;
clearBreakDetails();
m_javaScriptPauseScheduled = true;
m_scheduledDebuggerStep = NoStep;
m_skippedStepFrameCount = 0;
m_steppingFromFramework = false;
- debugger().setPauseOnNextStatement(true);
+ m_inspector->setPauseOnNextStatement(true);
}
void V8DebuggerAgentImpl::resume(ErrorString* errorString)
@@ -651,7 +651,7 @@
m_scheduledDebuggerStep = NoStep;
m_steppingFromFramework = false;
m_session->releaseObjectGroup(backtraceObjectGroup);
- debugger().continueProgram();
+ m_inspector->continueProgram();
}
void V8DebuggerAgentImpl::stepOver(ErrorString* errorString)
@@ -667,7 +667,7 @@
m_scheduledDebuggerStep = StepOver;
m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
m_session->releaseObjectGroup(backtraceObjectGroup);
- debugger().stepOverStatement();
+ m_inspector->stepOverStatement();
}
void V8DebuggerAgentImpl::stepInto(ErrorString* errorString)
@@ -677,7 +677,7 @@
m_scheduledDebuggerStep = StepInto;
m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
m_session->releaseObjectGroup(backtraceObjectGroup);
- debugger().stepIntoStatement();
+ m_inspector->stepIntoStatement();
}
void V8DebuggerAgentImpl::stepOut(ErrorString* errorString)
@@ -689,20 +689,20 @@
m_recursionLevelForStepOut = 1;
m_steppingFromFramework = isTopPausedCallFrameBlackboxed();
m_session->releaseObjectGroup(backtraceObjectGroup);
- debugger().stepOutOfFunction();
+ m_inspector->stepOutOfFunction();
}
void V8DebuggerAgentImpl::setPauseOnExceptions(ErrorString* errorString, const String16& stringPauseState)
{
if (!checkEnabled(errorString))
return;
- V8DebuggerImpl::PauseOnExceptionsState pauseState;
+ V8InspectorImpl::PauseOnExceptionsState pauseState;
if (stringPauseState == "none") {
- pauseState = V8DebuggerImpl::DontPauseOnExceptions;
+ pauseState = V8InspectorImpl::DontPauseOnExceptions;
} else if (stringPauseState == "all") {
- pauseState = V8DebuggerImpl::PauseOnAllExceptions;
+ pauseState = V8InspectorImpl::PauseOnAllExceptions;
} else if (stringPauseState == "uncaught") {
- pauseState = V8DebuggerImpl::PauseOnUncaughtExceptions;
+ pauseState = V8InspectorImpl::PauseOnUncaughtExceptions;
} else {
*errorString = "Unknown pause on exceptions mode: " + stringPauseState;
return;
@@ -712,8 +712,8 @@
void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(ErrorString* errorString, int pauseState)
{
- debugger().setPauseOnExceptionsState(static_cast<V8DebuggerImpl::PauseOnExceptionsState>(pauseState));
- if (debugger().getPauseOnExceptionsState() != pauseState)
+ m_inspector->setPauseOnExceptionsState(static_cast<V8InspectorImpl::PauseOnExceptionsState>(pauseState));
+ if (m_inspector->getPauseOnExceptionsState() != pauseState)
*errorString = "Internal error. Could not change pause on exceptions state";
else
m_state->setInteger(DebuggerAgentState::pauseOnExceptionsState, pauseState);
@@ -733,7 +733,7 @@
{
if (!assertPaused(errorString))
return;
- InjectedScript::CallFrameScope scope(errorString, m_debugger, m_session->contextGroupId(), callFrameId);
+ InjectedScript::CallFrameScope scope(errorString, m_inspector, m_session->contextGroupId(), callFrameId);
if (!scope.initialize())
return;
if (scope.frameOrdinal() >= m_pausedCallFrames.size()) {
@@ -772,7 +772,7 @@
return;
if (!assertPaused(errorString))
return;
- InjectedScript::CallFrameScope scope(errorString, m_debugger, m_session->contextGroupId(), callFrameId);
+ InjectedScript::CallFrameScope scope(errorString, m_inspector, m_session->contextGroupId(), callFrameId);
if (!scope.initialize())
return;
@@ -796,7 +796,7 @@
if (!checkEnabled(errorString))
return;
m_state->setInteger(DebuggerAgentState::asyncCallStackDepth, depth);
- m_debugger->setAsyncCallStackDepth(this, depth);
+ m_inspector->setAsyncCallStackDepth(this, depth);
}
void V8DebuggerAgentImpl::setBlackboxPatterns(ErrorString* errorString, std::unique_ptr<protocol::Array<String16>> patterns)
@@ -823,7 +823,7 @@
bool V8DebuggerAgentImpl::setBlackboxPattern(ErrorString* errorString, const String16& pattern)
{
- std::unique_ptr<V8Regex> regex(new V8Regex(m_debugger, pattern, true /** caseSensitive */, false /** multiline */));
+ std::unique_ptr<V8Regex> regex(new V8Regex(m_inspector, pattern, true /** caseSensitive */, false /** multiline */));
if (!regex->isValid()) {
*errorString = "Pattern parser error: " + regex->errorMessage();
return false;
@@ -888,9 +888,9 @@
void V8DebuggerAgentImpl::changeJavaScriptRecursionLevel(int step)
{
- if (m_javaScriptPauseScheduled && !m_skipAllPauses && !debugger().isPaused()) {
+ if (m_javaScriptPauseScheduled && !m_skipAllPauses && !m_inspector->isPaused()) {
// Do not ever loose user's pause request until we have actually paused.
- debugger().setPauseOnNextStatement(true);
+ m_inspector->setPauseOnNextStatement(true);
}
if (m_scheduledDebuggerStep == StepOut) {
m_recursionLevelForStepOut += step;
@@ -912,7 +912,7 @@
// from the old StepFrame.
m_skippedStepFrameCount = 0;
if (m_scheduledDebuggerStep == NoStep)
- debugger().clearStepping();
+ m_inspector->clearStepping();
else if (m_scheduledDebuggerStep == StepOut)
m_skipNextDebuggerStepOut = true;
}
@@ -984,8 +984,8 @@
{
if (m_pausedContext.IsEmpty())
return nullptr;
- V8StackTraceImpl* stackTrace = m_debugger->currentAsyncCallChain();
- return stackTrace ? stackTrace->buildInspectorObjectForTail(m_debugger) : nullptr;
+ V8StackTraceImpl* stackTrace = m_inspector->currentAsyncCallChain();
+ return stackTrace ? stackTrace->buildInspectorObjectForTail(m_inspector) : nullptr;
}
void V8DebuggerAgentImpl::didParseSource(std::unique_ptr<V8DebuggerScript> script, bool success)
@@ -1039,7 +1039,7 @@
breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex);
String16 url;
breakpointObject->getString(DebuggerAgentState::url, &url);
- if (!matches(m_debugger, scriptURL, url, isRegex))
+ if (!matches(m_inspector, scriptURL, url, isRegex))
continue;
ScriptBreakpoint breakpoint;
breakpointObject->getInteger(DebuggerAgentState::lineNumber, &breakpoint.lineNumber);
@@ -1053,7 +1053,7 @@
V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8::Context> context, v8::Local<v8::Value> exception, const std::vector<String16>& hitBreakpoints, bool isPromiseRejection)
{
- JavaScriptCallFrames callFrames = debugger().currentCallFrames(1);
+ JavaScriptCallFrames callFrames = m_inspector->currentCallFrames(1);
JavaScriptCallFrame* topCallFrame = !callFrames.empty() ? callFrames.begin()->get() : nullptr;
// Skip pause in internal scripts (e.g. InjectedScriptSource.js).
@@ -1083,14 +1083,14 @@
return RequestContinue;
DCHECK(m_pausedContext.IsEmpty());
- JavaScriptCallFrames frames = debugger().currentCallFrames();
+ JavaScriptCallFrames frames = m_inspector->currentCallFrames();
m_pausedCallFrames.swap(frames);
m_pausedContext.Reset(m_isolate, context);
v8::HandleScope handles(m_isolate);
if (!exception.IsEmpty()) {
ErrorString ignored;
- InjectedScript* injectedScript = m_session->findInjectedScript(&ignored, V8DebuggerImpl::contextId(context));
+ InjectedScript* injectedScript = m_session->findInjectedScript(&ignored, V8InspectorImpl::contextId(context));
if (injectedScript) {
m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::ReasonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception;
ErrorString errorString;
@@ -1124,7 +1124,7 @@
m_recursionLevelForStepFrame = 0;
if (!m_continueToLocationBreakpointId.isEmpty()) {
- debugger().removeBreakpoint(m_continueToLocationBreakpointId);
+ m_inspector->removeBreakpoint(m_continueToLocationBreakpointId);
m_continueToLocationBreakpointId = "";
}
return result;
@@ -1141,19 +1141,19 @@
void V8DebuggerAgentImpl::breakProgram(const String16& breakReason, std::unique_ptr<protocol::DictionaryValue> data)
{
- if (!enabled() || m_skipAllPauses || !m_pausedContext.IsEmpty() || isCurrentCallStackEmptyOrBlackboxed() || !debugger().breakpointsActivated())
+ if (!enabled() || m_skipAllPauses || !m_pausedContext.IsEmpty() || isCurrentCallStackEmptyOrBlackboxed() || !m_inspector->breakpointsActivated())
return;
m_breakReason = breakReason;
m_breakAuxData = std::move(data);
m_scheduledDebuggerStep = NoStep;
m_steppingFromFramework = false;
m_pausingOnNativeEvent = false;
- debugger().breakProgram();
+ m_inspector->breakProgram();
}
void V8DebuggerAgentImpl::breakProgramOnException(const String16& breakReason, std::unique_ptr<protocol::DictionaryValue> data)
{
- if (!enabled() || m_debugger->getPauseOnExceptionsState() == V8DebuggerImpl::DontPauseOnExceptions)
+ if (!enabled() || m_inspector->getPauseOnExceptionsState() == V8InspectorImpl::DontPauseOnExceptions)
return;
breakProgram(breakReason, std::move(data));
}
diff --git a/V8DebuggerAgentImpl.h b/V8DebuggerAgentImpl.h
index b6aea61..3d28ed6 100644
--- a/V8DebuggerAgentImpl.h
+++ b/V8DebuggerAgentImpl.h
@@ -7,7 +7,7 @@
#include "platform/inspector_protocol/Collections.h"
#include "platform/inspector_protocol/String16.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/protocol/Debugger.h"
#include <vector>
@@ -122,7 +122,6 @@
std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>> positions) override;
bool enabled();
- V8DebuggerImpl& debugger() { return *m_debugger; }
void setBreakpointAt(const String16& scriptId, int lineNumber, int columnNumber, BreakpointSource, const String16& condition = String16());
void removeBreakpointAt(const String16& scriptId, int lineNumber, int columnNumber, BreakpointSource);
@@ -133,7 +132,7 @@
void reset();
- // Interface for V8DebuggerImpl
+ // Interface for V8InspectorImpl
SkipPauseRequest didPause(v8::Local<v8::Context>, v8::Local<v8::Value> exception, const std::vector<String16>& hitBreakpoints, bool isPromiseRejection);
void didContinue();
void didParseSource(std::unique_ptr<V8DebuggerScript>, bool success);
@@ -184,7 +183,7 @@
StepOut
};
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
V8InspectorSessionImpl* m_session;
bool m_enabled;
protocol::DictionaryValue* m_state;
diff --git a/V8FunctionCall.cpp b/V8FunctionCall.cpp
index f5852b3..04a0cb8 100644
--- a/V8FunctionCall.cpp
+++ b/V8FunctionCall.cpp
@@ -32,16 +32,16 @@
#include "platform/inspector_protocol/Platform.h"
#include "platform/v8_inspector/V8Compat.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
#include <v8.h>
namespace blink {
-V8FunctionCall::V8FunctionCall(V8DebuggerImpl* debugger, v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& name)
- : m_debugger(debugger)
+V8FunctionCall::V8FunctionCall(V8InspectorImpl* inspector, v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& name)
+ : m_inspector(inspector)
, m_context(context)
, m_name(toV8String(context->GetIsolate(), name))
, m_value(value)
@@ -81,7 +81,7 @@
v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling()
{
// TODO(dgozman): get rid of this check.
- if (!m_debugger->client()->isExecutionAllowed())
+ if (!m_inspector->client()->isExecutionAllowed())
return v8::Local<v8::Value>();
v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value);
@@ -98,13 +98,13 @@
DCHECK(!info[i].IsEmpty());
}
- int contextGroupId = V8DebuggerImpl::getGroupId(m_context);
+ int contextGroupId = V8InspectorImpl::getGroupId(m_context);
if (contextGroupId)
- m_debugger->client()->muteWarningsAndDeprecations(contextGroupId);
+ m_inspector->client()->muteWarningsAndDeprecations(contextGroupId);
v8::MicrotasksScope microtasksScope(m_context->GetIsolate(), v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Value> maybeResult = function->Call(m_context, thisObject, m_arguments.size(), info.get());
if (contextGroupId)
- m_debugger->client()->unmuteWarningsAndDeprecations(contextGroupId);
+ m_inspector->client()->unmuteWarningsAndDeprecations(contextGroupId);
v8::Local<v8::Value> result;
if (!maybeResult.ToLocal(&result))
diff --git a/V8FunctionCall.h b/V8FunctionCall.h
index 0b7d9f1..acb5b5c 100644
--- a/V8FunctionCall.h
+++ b/V8FunctionCall.h
@@ -37,11 +37,11 @@
namespace blink {
-class V8DebuggerImpl;
+class V8InspectorImpl;
class V8FunctionCall {
public:
- V8FunctionCall(V8DebuggerImpl*, v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& name);
+ V8FunctionCall(V8InspectorImpl*, v8::Local<v8::Context>, v8::Local<v8::Value>, const String16& name);
void appendArgument(v8::Local<v8::Value>);
void appendArgument(const String16&);
@@ -52,7 +52,7 @@
v8::Local<v8::Value> callWithoutExceptionHandling();
protected:
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
v8::Local<v8::Context> m_context;
std::vector<v8::Local<v8::Value>> m_arguments;
v8::Local<v8::String> m_name;
diff --git a/V8HeapProfilerAgentImpl.cpp b/V8HeapProfilerAgentImpl.cpp
index 5776303..9fdf389 100644
--- a/V8HeapProfilerAgentImpl.cpp
+++ b/V8HeapProfilerAgentImpl.cpp
@@ -5,10 +5,10 @@
#include "platform/v8_inspector/V8HeapProfilerAgentImpl.h"
#include "platform/v8_inspector/InjectedScript.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
#include <v8-profiler.h>
#include <v8-version.h>
@@ -50,7 +50,7 @@
const char* GetName(v8::Local<v8::Object> object) override
{
- int contextId = V8DebuggerImpl::contextId(object->CreationContext());
+ int contextId = V8InspectorImpl::contextId(object->CreationContext());
if (!contextId)
return "";
ErrorString errorString;
@@ -149,7 +149,7 @@
V8HeapProfilerAgentImpl::V8HeapProfilerAgentImpl(V8InspectorSessionImpl* session, protocol::FrontendChannel* frontendChannel, protocol::DictionaryValue* state)
: m_session(session)
- , m_isolate(session->debugger()->isolate())
+ , m_isolate(session->inspector()->isolate())
, m_frontend(frontendChannel)
, m_state(state)
, m_hasTimer(false)
@@ -253,7 +253,7 @@
return;
}
- if (!m_session->debugger()->client()->isInspectableHeapObject(heapObject)) {
+ if (!m_session->inspector()->client()->isInspectableHeapObject(heapObject)) {
*error = "Object is not available";
return;
}
@@ -279,7 +279,7 @@
return;
}
- if (!m_session->debugger()->client()->isInspectableHeapObject(heapObject)) {
+ if (!m_session->inspector()->client()->isInspectableHeapObject(heapObject)) {
*errorString = "Object is not available";
return;
}
@@ -304,7 +304,7 @@
{
HeapStatsStream stream(&m_frontend);
v8::SnapshotObjectId lastSeenObjectId = m_isolate->GetHeapProfiler()->GetHeapStats(&stream);
- m_frontend.lastSeenObjectId(lastSeenObjectId, m_session->debugger()->client()->currentTimeMS());
+ m_frontend.lastSeenObjectId(lastSeenObjectId, m_session->inspector()->client()->currentTimeMS());
}
// static
@@ -318,14 +318,14 @@
m_isolate->GetHeapProfiler()->StartTrackingHeapObjects(trackAllocations);
if (!m_hasTimer) {
m_hasTimer = true;
- m_session->debugger()->client()->startRepeatingTimer(0.05, &V8HeapProfilerAgentImpl::onTimer, reinterpret_cast<void*>(this));
+ m_session->inspector()->client()->startRepeatingTimer(0.05, &V8HeapProfilerAgentImpl::onTimer, reinterpret_cast<void*>(this));
}
}
void V8HeapProfilerAgentImpl::stopTrackingHeapObjectsInternal()
{
if (m_hasTimer) {
- m_session->debugger()->client()->cancelTimer(reinterpret_cast<void*>(this));
+ m_session->inspector()->client()->cancelTimer(reinterpret_cast<void*>(this));
m_hasTimer = false;
}
m_isolate->GetHeapProfiler()->StopTrackingHeapObjects();
diff --git a/V8InjectedScriptHost.cpp b/V8InjectedScriptHost.cpp
index 8890209..e191ea1 100644
--- a/V8InjectedScriptHost.cpp
+++ b/V8InjectedScriptHost.cpp
@@ -7,10 +7,10 @@
#include "platform/inspector_protocol/String16.h"
#include "platform/v8_inspector/InjectedScriptNative.h"
#include "platform/v8_inspector/V8Compat.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InternalValueType.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
namespace blink {
@@ -27,22 +27,22 @@
return;
}
-V8DebuggerImpl* unwrapDebugger(const v8::FunctionCallbackInfo<v8::Value>& info)
+V8InspectorImpl* unwrapInspector(const v8::FunctionCallbackInfo<v8::Value>& info)
{
DCHECK(!info.Data().IsEmpty());
DCHECK(info.Data()->IsExternal());
- V8DebuggerImpl* debugger = static_cast<V8DebuggerImpl*>(info.Data().As<v8::External>()->Value());
- DCHECK(debugger);
- return debugger;
+ V8InspectorImpl* inspector = static_cast<V8InspectorImpl*>(info.Data().As<v8::External>()->Value());
+ DCHECK(inspector);
+ return inspector;
}
} // namespace
-v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> context, V8DebuggerImpl* debugger)
+v8::Local<v8::Object> V8InjectedScriptHost::create(v8::Local<v8::Context> context, V8InspectorImpl* inspector)
{
- v8::Isolate* isolate = debugger->isolate();
+ v8::Isolate* isolate = inspector->isolate();
v8::Local<v8::Object> injectedScriptHost = v8::Object::New(isolate);
- v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, debugger);
+ v8::Local<v8::External> debuggerExternal = v8::External::New(isolate, inspector);
setFunctionProperty(context, injectedScriptHost, "internalConstructorName", V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal);
setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsProperties", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal);
setFunctionProperty(context, injectedScriptHost, "isTypedArray", V8InjectedScriptHost::isTypedArrayCallback, debuggerExternal);
@@ -73,7 +73,7 @@
// Check that function is user-defined.
if (info[1].As<v8::Function>()->ScriptId() != v8::UnboundScript::kNoScriptId)
return;
- info.GetReturnValue().Set(unwrapDebugger(info)->client()->formatAccessorsAsProperties(info[0]));
+ info.GetReturnValue().Set(unwrapInspector(info)->client()->formatAccessorsAsProperties(info[0]));
}
void V8InjectedScriptHost::isTypedArrayCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
@@ -134,7 +134,7 @@
info.GetReturnValue().Set(toV8StringInternalized(isolate, "proxy"));
return;
}
- String16 subtype = unwrapDebugger(info)->client()->valueSubtype(value);
+ String16 subtype = unwrapInspector(info)->client()->valueSubtype(value);
if (!subtype.isEmpty()) {
info.GetReturnValue().Set(toV8String(isolate, subtype));
return;
@@ -146,7 +146,7 @@
if (info.Length() < 1)
return;
v8::Local<v8::Array> properties;
- if (unwrapDebugger(info)->internalProperties(info.GetIsolate()->GetCurrentContext(), info[0]).ToLocal(&properties))
+ if (unwrapInspector(info)->internalProperties(info.GetIsolate()->GetCurrentContext(), info[0]).ToLocal(&properties))
info.GetReturnValue().Set(properties);
}
diff --git a/V8InjectedScriptHost.h b/V8InjectedScriptHost.h
index 2b1d3ce..38c947f 100644
--- a/V8InjectedScriptHost.h
+++ b/V8InjectedScriptHost.h
@@ -9,7 +9,7 @@
namespace blink {
-class V8DebuggerImpl;
+class V8InspectorImpl;
// SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by the inspector,
// a reference to the InjectedScriptHost may be leaked to the page being inspected. Thus, the
@@ -19,8 +19,8 @@
class V8InjectedScriptHost {
public:
// We expect that debugger outlives any JS context and thus V8InjectedScriptHost (owned by JS)
- // is destroyed before debugger.
- static v8::Local<v8::Object> create(v8::Local<v8::Context>, V8DebuggerImpl*);
+ // is destroyed before inspector.
+ static v8::Local<v8::Object> create(v8::Local<v8::Context>, V8InspectorImpl*);
private:
static void internalConstructorNameCallback(const v8::FunctionCallbackInfo<v8::Value>&);
static void formatAccessorsAsProperties(const v8::FunctionCallbackInfo<v8::Value>&);
diff --git a/V8DebuggerImpl.cpp b/V8InspectorImpl.cpp
similarity index 83%
rename from V8DebuggerImpl.cpp
rename to V8InspectorImpl.cpp
index d8913f1..2a6ef83 100644
--- a/V8DebuggerImpl.cpp
+++ b/V8InspectorImpl.cpp
@@ -28,7 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/inspector_protocol/Values.h"
#include "platform/v8_inspector/Atomics.h"
@@ -45,7 +45,7 @@
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
#include <v8-profiler.h>
namespace blink {
@@ -67,7 +67,7 @@
static bool inLiveEditScope = false;
-v8::MaybeLocal<v8::Value> V8DebuggerImpl::callDebuggerMethod(const char* functionName, int argc, v8::Local<v8::Value> argv[])
+v8::MaybeLocal<v8::Value> V8InspectorImpl::callDebuggerMethod(const char* functionName, int argc, v8::Local<v8::Value> argv[])
{
v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::Object> debuggerScript = m_debuggerScript.Get(m_isolate);
@@ -76,12 +76,12 @@
return function->Call(m_isolate->GetCurrentContext(), debuggerScript, argc, argv);
}
-std::unique_ptr<V8Debugger> V8Debugger::create(v8::Isolate* isolate, V8DebuggerClient* client)
+std::unique_ptr<V8Inspector> V8Inspector::create(v8::Isolate* isolate, V8InspectorClient* client)
{
- return wrapUnique(new V8DebuggerImpl(isolate, client));
+ return wrapUnique(new V8InspectorImpl(isolate, client));
}
-V8DebuggerImpl::V8DebuggerImpl(v8::Isolate* isolate, V8DebuggerClient* client)
+V8InspectorImpl::V8InspectorImpl(v8::Isolate* isolate, V8InspectorClient* client)
: m_isolate(isolate)
, m_client(client)
, m_capturingStackTracesCount(0)
@@ -93,20 +93,20 @@
{
}
-V8DebuggerImpl::~V8DebuggerImpl()
+V8InspectorImpl::~V8InspectorImpl()
{
}
-void V8DebuggerImpl::enable()
+void V8InspectorImpl::enable()
{
DCHECK(!enabled());
v8::HandleScope scope(m_isolate);
- v8::Debug::SetDebugEventListener(m_isolate, &V8DebuggerImpl::v8DebugEventCallback, v8::External::New(m_isolate, this));
+ v8::Debug::SetDebugEventListener(m_isolate, &V8InspectorImpl::v8DebugEventCallback, v8::External::New(m_isolate, this));
m_debuggerContext.Reset(m_isolate, v8::Debug::GetDebugContext(m_isolate));
compileDebuggerScript();
}
-void V8DebuggerImpl::disable()
+void V8InspectorImpl::disable()
{
DCHECK(enabled());
clearBreakpoints();
@@ -116,13 +116,13 @@
v8::Debug::SetDebugEventListener(m_isolate, nullptr);
}
-bool V8DebuggerImpl::enabled() const
+bool V8InspectorImpl::enabled() const
{
return !m_debuggerScript.IsEmpty();
}
// static
-int V8DebuggerImpl::contextId(v8::Local<v8::Context> context)
+int V8InspectorImpl::contextId(v8::Local<v8::Context> context)
{
v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex));
if (data.IsEmpty() || !data->IsString())
@@ -140,7 +140,7 @@
}
// static
-int V8DebuggerImpl::getGroupId(v8::Local<v8::Context> context)
+int V8InspectorImpl::getGroupId(v8::Local<v8::Context> context)
{
v8::Local<v8::Value> data = context->GetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex));
if (data.IsEmpty() || !data->IsString())
@@ -154,19 +154,19 @@
return dataString.substring(0, commaPos).toInt();
}
-void V8DebuggerImpl::debuggerAgentEnabled()
+void V8InspectorImpl::debuggerAgentEnabled()
{
if (!m_enabledAgentsCount++)
enable();
}
-void V8DebuggerImpl::debuggerAgentDisabled()
+void V8InspectorImpl::debuggerAgentDisabled()
{
if (!--m_enabledAgentsCount)
disable();
}
-V8DebuggerAgentImpl* V8DebuggerImpl::findEnabledDebuggerAgent(int contextGroupId)
+V8DebuggerAgentImpl* V8InspectorImpl::findEnabledDebuggerAgent(int contextGroupId)
{
if (!contextGroupId)
return nullptr;
@@ -179,12 +179,12 @@
return agent;
}
-V8DebuggerAgentImpl* V8DebuggerImpl::findEnabledDebuggerAgent(v8::Local<v8::Context> context)
+V8DebuggerAgentImpl* V8InspectorImpl::findEnabledDebuggerAgent(v8::Local<v8::Context> context)
{
return findEnabledDebuggerAgent(getGroupId(context));
}
-void V8DebuggerImpl::getCompiledScripts(int contextGroupId, std::vector<std::unique_ptr<V8DebuggerScript>>& result)
+void V8InspectorImpl::getCompiledScripts(int contextGroupId, std::vector<std::unique_ptr<V8DebuggerScript>>& result)
{
v8::HandleScope scope(m_isolate);
v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
@@ -204,7 +204,7 @@
}
}
-String16 V8DebuggerImpl::setBreakpoint(const String16& sourceID, const ScriptBreakpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool interstatementLocation)
+String16 V8InspectorImpl::setBreakpoint(const String16& sourceID, const ScriptBreakpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool interstatementLocation)
{
v8::HandleScope scope(m_isolate);
v8::Context::Scope contextScope(debuggerContext());
@@ -225,7 +225,7 @@
return toProtocolString(breakpointId.As<v8::String>());
}
-void V8DebuggerImpl::removeBreakpoint(const String16& breakpointId)
+void V8InspectorImpl::removeBreakpoint(const String16& breakpointId)
{
v8::HandleScope scope(m_isolate);
v8::Context::Scope contextScope(debuggerContext());
@@ -237,7 +237,7 @@
v8::Debug::Call(debuggerContext(), removeBreakpointFunction, info).ToLocalChecked();
}
-void V8DebuggerImpl::clearBreakpoints()
+void V8InspectorImpl::clearBreakpoints()
{
v8::HandleScope scope(m_isolate);
v8::Context::Scope contextScope(debuggerContext());
@@ -246,7 +246,7 @@
v8::Debug::Call(debuggerContext(), clearBreakpoints).ToLocalChecked();
}
-void V8DebuggerImpl::setBreakpointsActivated(bool activated)
+void V8InspectorImpl::setBreakpointsActivated(bool activated)
{
if (!enabled()) {
NOTREACHED();
@@ -263,7 +263,7 @@
m_breakpointsActivated = activated;
}
-V8DebuggerImpl::PauseOnExceptionsState V8DebuggerImpl::getPauseOnExceptionsState()
+V8InspectorImpl::PauseOnExceptionsState V8InspectorImpl::getPauseOnExceptionsState()
{
DCHECK(enabled());
v8::HandleScope scope(m_isolate);
@@ -271,10 +271,10 @@
v8::Local<v8::Value> argv[] = { v8::Undefined(m_isolate) };
v8::Local<v8::Value> result = callDebuggerMethod("pauseOnExceptionsState", 0, argv).ToLocalChecked();
- return static_cast<V8DebuggerImpl::PauseOnExceptionsState>(result->Int32Value());
+ return static_cast<V8InspectorImpl::PauseOnExceptionsState>(result->Int32Value());
}
-void V8DebuggerImpl::setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState)
+void V8InspectorImpl::setPauseOnExceptionsState(PauseOnExceptionsState pauseOnExceptionsState)
{
DCHECK(enabled());
v8::HandleScope scope(m_isolate);
@@ -284,7 +284,7 @@
callDebuggerMethod("setPauseOnExceptionsState", 1, argv);
}
-void V8DebuggerImpl::setPauseOnNextStatement(bool pause)
+void V8InspectorImpl::setPauseOnNextStatement(bool pause)
{
if (m_runningNestedMessageLoop)
return;
@@ -294,14 +294,14 @@
v8::Debug::CancelDebugBreak(m_isolate);
}
-bool V8DebuggerImpl::canBreakProgram()
+bool V8InspectorImpl::canBreakProgram()
{
if (!m_breakpointsActivated)
return false;
return m_isolate->InContext();
}
-void V8DebuggerImpl::breakProgram()
+void V8InspectorImpl::breakProgram()
{
if (isPaused()) {
DCHECK(!m_runningNestedMessageLoop);
@@ -316,12 +316,12 @@
v8::HandleScope scope(m_isolate);
v8::Local<v8::Function> breakFunction;
- if (!v8::Function::New(m_isolate->GetCurrentContext(), &V8DebuggerImpl::breakProgramCallback, v8::External::New(m_isolate, this), 0, v8::ConstructorBehavior::kThrow).ToLocal(&breakFunction))
+ if (!v8::Function::New(m_isolate->GetCurrentContext(), &V8InspectorImpl::breakProgramCallback, v8::External::New(m_isolate, this), 0, v8::ConstructorBehavior::kThrow).ToLocal(&breakFunction))
return;
v8::Debug::Call(debuggerContext(), breakFunction).ToLocalChecked();
}
-void V8DebuggerImpl::continueProgram()
+void V8InspectorImpl::continueProgram()
{
if (isPaused())
m_client->quitMessageLoopOnPause();
@@ -329,7 +329,7 @@
m_executionState.Clear();
}
-void V8DebuggerImpl::stepIntoStatement()
+void V8InspectorImpl::stepIntoStatement()
{
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
@@ -339,7 +339,7 @@
continueProgram();
}
-void V8DebuggerImpl::stepOverStatement()
+void V8InspectorImpl::stepOverStatement()
{
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
@@ -349,7 +349,7 @@
continueProgram();
}
-void V8DebuggerImpl::stepOutOfFunction()
+void V8InspectorImpl::stepOutOfFunction()
{
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
@@ -359,7 +359,7 @@
continueProgram();
}
-void V8DebuggerImpl::clearStepping()
+void V8InspectorImpl::clearStepping()
{
DCHECK(enabled());
v8::HandleScope scope(m_isolate);
@@ -369,7 +369,7 @@
callDebuggerMethod("clearStepping", 0, argv);
}
-bool V8DebuggerImpl::setScriptSource(const String16& sourceID, v8::Local<v8::String> newSource, bool preview, ErrorString* error, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged)
+bool V8InspectorImpl::setScriptSource(const String16& sourceID, v8::Local<v8::String> newSource, bool preview, ErrorString* error, Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe<bool>* stackChanged)
{
class EnableLiveEditScope {
public:
@@ -441,7 +441,7 @@
return false;
}
-JavaScriptCallFrames V8DebuggerImpl::currentCallFrames(int limit)
+JavaScriptCallFrames V8InspectorImpl::currentCallFrames(int limit)
{
if (!m_isolate->InContext())
return JavaScriptCallFrames();
@@ -470,16 +470,16 @@
return callFrames;
}
-static V8DebuggerImpl* toV8DebuggerImpl(v8::Local<v8::Value> data)
+static V8InspectorImpl* toV8InspectorImpl(v8::Local<v8::Value> data)
{
void* p = v8::Local<v8::External>::Cast(data)->Value();
- return static_cast<V8DebuggerImpl*>(p);
+ return static_cast<V8InspectorImpl*>(p);
}
-void V8DebuggerImpl::breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
+void V8InspectorImpl::breakProgramCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
DCHECK_EQ(info.Length(), 2);
- V8DebuggerImpl* thisPtr = toV8DebuggerImpl(info.Data());
+ V8InspectorImpl* thisPtr = toV8InspectorImpl(info.Data());
if (!thisPtr->enabled())
return;
v8::Local<v8::Context> pausedContext = thisPtr->m_isolate->GetCurrentContext();
@@ -488,7 +488,7 @@
thisPtr->handleProgramBreak(pausedContext, v8::Local<v8::Object>::Cast(info[0]), exception, hitBreakpoints);
}
-void V8DebuggerImpl::handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakpointNumbers, bool isPromiseRejection)
+void V8InspectorImpl::handleProgramBreak(v8::Local<v8::Context> pausedContext, v8::Local<v8::Object> executionState, v8::Local<v8::Value> exception, v8::Local<v8::Array> hitBreakpointNumbers, bool isPromiseRejection)
{
// Don't allow nested breaks.
if (m_runningNestedMessageLoop)
@@ -537,13 +537,13 @@
}
}
-void V8DebuggerImpl::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails)
+void V8InspectorImpl::v8DebugEventCallback(const v8::Debug::EventDetails& eventDetails)
{
- V8DebuggerImpl* thisPtr = toV8DebuggerImpl(eventDetails.GetCallbackData());
+ V8InspectorImpl* thisPtr = toV8InspectorImpl(eventDetails.GetCallbackData());
thisPtr->handleV8DebugEvent(eventDetails);
}
-v8::Local<v8::Value> V8DebuggerImpl::callInternalGetterFunction(v8::Local<v8::Object> object, const char* functionName)
+v8::Local<v8::Value> V8InspectorImpl::callInternalGetterFunction(v8::Local<v8::Object> object, const char* functionName)
{
v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::Value> getterValue = object->Get(v8InternalizedString(functionName));
@@ -551,7 +551,7 @@
return v8::Local<v8::Function>::Cast(getterValue)->Call(m_isolate->GetCurrentContext(), object, 0, 0).ToLocalChecked();
}
-void V8DebuggerImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails)
+void V8InspectorImpl::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails)
{
if (!enabled())
return;
@@ -593,7 +593,7 @@
}
}
-void V8DebuggerImpl::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData)
+void V8InspectorImpl::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, v8::Local<v8::Object> executionState, v8::Local<v8::Object> eventData)
{
if (!m_maxAsyncCallStackDepth)
return;
@@ -613,14 +613,14 @@
NOTREACHED();
}
-V8StackTraceImpl* V8DebuggerImpl::currentAsyncCallChain()
+V8StackTraceImpl* V8InspectorImpl::currentAsyncCallChain()
{
if (!m_currentStacks.size())
return nullptr;
return m_currentStacks.back().get();
}
-void V8DebuggerImpl::compileDebuggerScript()
+void V8InspectorImpl::compileDebuggerScript()
{
if (!m_debuggerScript.IsEmpty()) {
NOTREACHED();
@@ -640,18 +640,18 @@
m_debuggerScript.Reset(m_isolate, value.As<v8::Object>());
}
-v8::Local<v8::Context> V8DebuggerImpl::debuggerContext() const
+v8::Local<v8::Context> V8InspectorImpl::debuggerContext() const
{
DCHECK(!m_debuggerContext.IsEmpty());
return m_debuggerContext.Get(m_isolate);
}
-v8::Local<v8::String> V8DebuggerImpl::v8InternalizedString(const char* str) const
+v8::Local<v8::String> V8InspectorImpl::v8InternalizedString(const char* str) const
{
return v8::String::NewFromUtf8(m_isolate, str, v8::NewStringType::kInternalized).ToLocalChecked();
}
-v8::MaybeLocal<v8::Value> V8DebuggerImpl::functionScopes(v8::Local<v8::Function> function)
+v8::MaybeLocal<v8::Value> V8InspectorImpl::functionScopes(v8::Local<v8::Function> function)
{
if (!enabled()) {
NOTREACHED();
@@ -672,7 +672,7 @@
return scopes;
}
-v8::MaybeLocal<v8::Array> V8DebuggerImpl::internalProperties(v8::Local<v8::Context> context, v8::Local<v8::Value> value)
+v8::MaybeLocal<v8::Array> V8InspectorImpl::internalProperties(v8::Local<v8::Context> context, v8::Local<v8::Value> value)
{
v8::Local<v8::Array> properties;
if (!v8::Debug::GetInternalProperties(m_isolate, value).ToLocal(&properties))
@@ -717,7 +717,7 @@
return properties;
}
-v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
+v8::Local<v8::Value> V8InspectorImpl::collectionEntries(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
{
if (!enabled()) {
NOTREACHED();
@@ -735,7 +735,7 @@
return entries;
}
-v8::Local<v8::Value> V8DebuggerImpl::generatorObjectLocation(v8::Local<v8::Object> object)
+v8::Local<v8::Value> V8InspectorImpl::generatorObjectLocation(v8::Local<v8::Object> object)
{
if (!enabled()) {
NOTREACHED();
@@ -751,7 +751,7 @@
return location;
}
-v8::Local<v8::Value> V8DebuggerImpl::functionLocation(v8::Local<v8::Context> context, v8::Local<v8::Function> function)
+v8::Local<v8::Value> V8InspectorImpl::functionLocation(v8::Local<v8::Context> context, v8::Local<v8::Function> function)
{
int scriptId = function->ScriptId();
if (scriptId == v8::UnboundScript::kNoScriptId)
@@ -772,12 +772,12 @@
return location;
}
-bool V8DebuggerImpl::isPaused()
+bool V8InspectorImpl::isPaused()
{
return !m_pausedContext.IsEmpty();
}
-v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Context> context, v8::Local<v8::Script> script)
+v8::MaybeLocal<v8::Value> V8InspectorImpl::runCompiledScript(v8::Local<v8::Context> context, v8::Local<v8::Script> script)
{
// TODO(dgozman): get rid of this check.
if (!m_client->isExecutionAllowed())
@@ -794,7 +794,7 @@
return result;
}
-v8::MaybeLocal<v8::Value> V8DebuggerImpl::callFunction(v8::Local<v8::Function> function, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[])
+v8::MaybeLocal<v8::Value> V8InspectorImpl::callFunction(v8::Local<v8::Function> function, v8::Local<v8::Context> context, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[])
{
// TODO(dgozman): get rid of this check.
if (!m_client->isExecutionAllowed())
@@ -811,7 +811,7 @@
return result;
}
-v8::MaybeLocal<v8::Value> V8DebuggerImpl::compileAndRunInternalScript(v8::Local<v8::Context> context, v8::Local<v8::String> source)
+v8::MaybeLocal<v8::Value> V8InspectorImpl::compileAndRunInternalScript(v8::Local<v8::Context> context, v8::Local<v8::String> source)
{
v8::Local<v8::Script> script = compileScript(context, source, String(), true);
if (script.IsEmpty())
@@ -820,7 +820,7 @@
return script->Run(context);
}
-v8::Local<v8::Script> V8DebuggerImpl::compileScript(v8::Local<v8::Context> context, v8::Local<v8::String> code, const String16& fileName, bool markAsInternal)
+v8::Local<v8::Script> V8InspectorImpl::compileScript(v8::Local<v8::Context> context, v8::Local<v8::String> code, const String16& fileName, bool markAsInternal)
{
v8::ScriptOrigin origin(
toV8String(m_isolate, fileName),
@@ -838,20 +838,20 @@
return script;
}
-void V8DebuggerImpl::enableStackCapturingIfNeeded()
+void V8InspectorImpl::enableStackCapturingIfNeeded()
{
if (!m_capturingStackTracesCount)
V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, true);
++m_capturingStackTracesCount;
}
-void V8DebuggerImpl::disableStackCapturingIfNeeded()
+void V8InspectorImpl::disableStackCapturingIfNeeded()
{
if (!(--m_capturingStackTracesCount))
V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions(m_isolate, false);
}
-V8ConsoleMessageStorage* V8DebuggerImpl::ensureConsoleMessageStorage(int contextGroupId)
+V8ConsoleMessageStorage* V8InspectorImpl::ensureConsoleMessageStorage(int contextGroupId)
{
ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGroupId);
if (storageIt == m_consoleStorageMap.end())
@@ -859,18 +859,18 @@
return storageIt->second.get();
}
-std::unique_ptr<V8StackTrace> V8DebuggerImpl::createStackTrace(v8::Local<v8::StackTrace> stackTrace)
+std::unique_ptr<V8StackTrace> V8InspectorImpl::createStackTrace(v8::Local<v8::StackTrace> stackTrace)
{
return createStackTraceImpl(stackTrace);
}
-std::unique_ptr<V8StackTraceImpl> V8DebuggerImpl::createStackTraceImpl(v8::Local<v8::StackTrace> stackTrace)
+std::unique_ptr<V8StackTraceImpl> V8InspectorImpl::createStackTraceImpl(v8::Local<v8::StackTrace> stackTrace)
{
int contextGroupId = m_isolate->InContext() ? getGroupId(m_isolate->GetCurrentContext()) : 0;
return V8StackTraceImpl::create(this, contextGroupId, stackTrace, V8StackTraceImpl::maxCallStackSizeToCapture);
}
-std::unique_ptr<V8InspectorSession> V8DebuggerImpl::connect(int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const String16* state)
+std::unique_ptr<V8InspectorSession> V8InspectorImpl::connect(int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const String16* state)
{
DCHECK(m_sessions.find(contextGroupId) == m_sessions.cend());
std::unique_ptr<V8InspectorSessionImpl> session =
@@ -879,13 +879,13 @@
return std::move(session);
}
-void V8DebuggerImpl::disconnect(V8InspectorSessionImpl* session)
+void V8InspectorImpl::disconnect(V8InspectorSessionImpl* session)
{
DCHECK(m_sessions.find(session->contextGroupId()) != m_sessions.end());
m_sessions.erase(session->contextGroupId());
}
-InspectedContext* V8DebuggerImpl::getContext(int groupId, int contextId) const
+InspectedContext* V8InspectorImpl::getContext(int groupId, int contextId) const
{
ContextsByGroupMap::const_iterator contextGroupIt = m_contexts.find(groupId);
if (contextGroupIt == m_contexts.end())
@@ -898,7 +898,7 @@
return contextIt->second.get();
}
-void V8DebuggerImpl::contextCreated(const V8ContextInfo& info)
+void V8InspectorImpl::contextCreated(const V8ContextInfo& info)
{
DCHECK(info.context->GetIsolate() == m_isolate);
// TODO(dgozman): make s_lastContextId non-static.
@@ -922,9 +922,9 @@
sessionIt->second->runtimeAgent()->reportExecutionContextCreated(context);
}
-void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context)
+void V8InspectorImpl::contextDestroyed(v8::Local<v8::Context> context)
{
- int contextId = V8DebuggerImpl::contextId(context);
+ int contextId = V8InspectorImpl::contextId(context);
int contextGroupId = getGroupId(context);
ConsoleStorageMap::iterator storageIt = m_consoleStorageMap.find(contextGroupId);
@@ -941,7 +941,7 @@
discardInspectedContext(contextGroupId, contextId);
}
-void V8DebuggerImpl::resetContextGroup(int contextGroupId)
+void V8InspectorImpl::resetContextGroup(int contextGroupId)
{
m_consoleStorageMap.erase(contextGroupId);
SessionMap::iterator session = m_sessions.find(contextGroupId);
@@ -950,7 +950,7 @@
m_contexts.erase(contextGroupId);
}
-void V8DebuggerImpl::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth)
+void V8InspectorImpl::setAsyncCallStackDepth(V8DebuggerAgentImpl* agent, int depth)
{
if (depth <= 0)
m_maxAsyncCallStackDepthMap.erase(agent);
@@ -970,7 +970,7 @@
allAsyncTasksCanceled();
}
-void V8DebuggerImpl::asyncTaskScheduled(const String16& taskName, void* task, bool recurring)
+void V8InspectorImpl::asyncTaskScheduled(const String16& taskName, void* task, bool recurring)
{
if (!m_maxAsyncCallStackDepth)
return;
@@ -984,7 +984,7 @@
}
}
-void V8DebuggerImpl::asyncTaskCanceled(void* task)
+void V8InspectorImpl::asyncTaskCanceled(void* task)
{
if (!m_maxAsyncCallStackDepth)
return;
@@ -992,7 +992,7 @@
m_recurringTasks.erase(task);
}
-void V8DebuggerImpl::asyncTaskStarted(void* task)
+void V8InspectorImpl::asyncTaskStarted(void* task)
{
if (!m_maxAsyncCallStackDepth)
return;
@@ -1011,7 +1011,7 @@
m_currentStacks.push_back(std::move(stack));
}
-void V8DebuggerImpl::asyncTaskFinished(void* task)
+void V8InspectorImpl::asyncTaskFinished(void* task)
{
if (!m_maxAsyncCallStackDepth)
return;
@@ -1027,7 +1027,7 @@
m_asyncTaskStacks.erase(task);
}
-void V8DebuggerImpl::allAsyncTasksCanceled()
+void V8InspectorImpl::allAsyncTasksCanceled()
{
m_asyncTaskStacks.clear();
m_recurringTasks.clear();
@@ -1035,29 +1035,29 @@
m_currentTasks.clear();
}
-void V8DebuggerImpl::willExecuteScript(v8::Local<v8::Context> context, int scriptId)
+void V8InspectorImpl::willExecuteScript(v8::Local<v8::Context> context, int scriptId)
{
if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(context))
agent->willExecuteScript(scriptId);
}
-void V8DebuggerImpl::didExecuteScript(v8::Local<v8::Context> context)
+void V8InspectorImpl::didExecuteScript(v8::Local<v8::Context> context)
{
if (V8DebuggerAgentImpl* agent = findEnabledDebuggerAgent(context))
agent->didExecuteScript();
}
-void V8DebuggerImpl::idleStarted()
+void V8InspectorImpl::idleStarted()
{
m_isolate->GetCpuProfiler()->SetIdle(true);
}
-void V8DebuggerImpl::idleFinished()
+void V8InspectorImpl::idleFinished()
{
m_isolate->GetCpuProfiler()->SetIdle(false);
}
-unsigned V8DebuggerImpl::exceptionThrown(v8::Local<v8::Context> context, const String16& message, v8::Local<v8::Value> exception, const String16& detailedMessage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId)
+unsigned V8InspectorImpl::exceptionThrown(v8::Local<v8::Context> context, const String16& message, v8::Local<v8::Value> exception, const String16& detailedMessage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace> stackTrace, int scriptId)
{
int contextGroupId = getGroupId(context);
if (!contextGroupId)
@@ -1069,7 +1069,7 @@
return exceptionId;
}
-void V8DebuggerImpl::exceptionRevoked(v8::Local<v8::Context> context, unsigned exceptionId, const String16& message)
+void V8InspectorImpl::exceptionRevoked(v8::Local<v8::Context> context, unsigned exceptionId, const String16& message)
{
int contextGroupId = getGroupId(context);
if (!contextGroupId)
@@ -1079,12 +1079,12 @@
ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMessage));
}
-std::unique_ptr<V8StackTrace> V8DebuggerImpl::captureStackTrace(bool fullStack)
+std::unique_ptr<V8StackTrace> V8InspectorImpl::captureStackTrace(bool fullStack)
{
return captureStackTraceImpl(fullStack);
}
-std::unique_ptr<V8StackTraceImpl> V8DebuggerImpl::captureStackTraceImpl(bool fullStack)
+std::unique_ptr<V8StackTraceImpl> V8InspectorImpl::captureStackTraceImpl(bool fullStack)
{
if (!m_isolate->InContext())
return nullptr;
@@ -1102,14 +1102,14 @@
return V8StackTraceImpl::capture(this, contextGroupId, stackSize);
}
-v8::Local<v8::Context> V8DebuggerImpl::regexContext()
+v8::Local<v8::Context> V8InspectorImpl::regexContext()
{
if (m_regexContext.IsEmpty())
m_regexContext.Reset(m_isolate, v8::Context::New(m_isolate));
return m_regexContext.Get(m_isolate);
}
-void V8DebuggerImpl::discardInspectedContext(int contextGroupId, int contextId)
+void V8InspectorImpl::discardInspectedContext(int contextGroupId, int contextId)
{
if (!getContext(contextGroupId, contextId))
return;
@@ -1118,13 +1118,13 @@
m_contexts.erase(contextGroupId);
}
-const V8DebuggerImpl::ContextByIdMap* V8DebuggerImpl::contextGroup(int contextGroupId)
+const V8InspectorImpl::ContextByIdMap* V8InspectorImpl::contextGroup(int contextGroupId)
{
ContextsByGroupMap::iterator iter = m_contexts.find(contextGroupId);
return iter == m_contexts.end() ? nullptr : iter->second.get();
}
-V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupId)
+V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(int contextGroupId)
{
if (!contextGroupId)
return nullptr;
diff --git a/V8DebuggerImpl.h b/V8InspectorImpl.h
similarity index 95%
rename from V8DebuggerImpl.h
rename to V8InspectorImpl.h
index 8c747d9..dda3ff7 100644
--- a/V8DebuggerImpl.h
+++ b/V8InspectorImpl.h
@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef V8DebuggerImpl_h
-#define V8DebuggerImpl_h
+#ifndef V8InspectorImpl_h
+#define V8InspectorImpl_h
#include "platform/inspector_protocol/Collections.h"
#include "platform/inspector_protocol/Maybe.h"
@@ -37,14 +37,12 @@
#include "platform/v8_inspector/JavaScriptCallFrame.h"
#include "platform/v8_inspector/V8DebuggerScript.h"
#include "platform/v8_inspector/protocol/Debugger.h"
-#include "platform/v8_inspector/public/V8Debugger.h"
+#include "platform/v8_inspector/public/V8Inspector.h"
#include <v8-debug.h>
#include <v8.h>
#include <vector>
-#include <vector>
-
namespace blink {
using protocol::Maybe;
@@ -57,11 +55,11 @@
class V8RuntimeAgentImpl;
class V8StackTraceImpl;
-class V8DebuggerImpl : public V8Debugger {
- PROTOCOL_DISALLOW_COPY(V8DebuggerImpl);
+class V8InspectorImpl : public V8Inspector {
+ PROTOCOL_DISALLOW_COPY(V8InspectorImpl);
public:
- V8DebuggerImpl(v8::Isolate*, V8DebuggerClient*);
- ~V8DebuggerImpl() override;
+ V8InspectorImpl(v8::Isolate*, V8InspectorClient*);
+ ~V8InspectorImpl() override;
static int contextId(v8::Local<v8::Context>);
static int getGroupId(v8::Local<v8::Context>);
@@ -109,7 +107,7 @@
v8::MaybeLocal<v8::Array> internalProperties(v8::Local<v8::Context>, v8::Local<v8::Value>);
v8::Isolate* isolate() const { return m_isolate; }
- V8DebuggerClient* client() { return m_client; }
+ V8InspectorClient* client() { return m_client; }
v8::MaybeLocal<v8::Value> runCompiledScript(v8::Local<v8::Context>, v8::Local<v8::Script>);
v8::MaybeLocal<v8::Value> callFunction(v8::Local<v8::Function>, v8::Local<v8::Context>, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> info[]);
@@ -177,7 +175,7 @@
v8::Local<v8::Value> functionLocation(v8::Local<v8::Context>, v8::Local<v8::Function>);
v8::Isolate* m_isolate;
- V8DebuggerClient* m_client;
+ V8InspectorClient* m_client;
ContextsByGroupMap m_contexts;
using SessionMap = protocol::HashMap<int, V8InspectorSessionImpl*>;
SessionMap m_sessions;
@@ -206,4 +204,4 @@
} // namespace blink
-#endif // V8DebuggerImpl_h
+#endif // V8InspectorImpl_h
diff --git a/V8InspectorSessionImpl.cpp b/V8InspectorSessionImpl.cpp
index 4e8e159..c2901d2 100644
--- a/V8InspectorSessionImpl.cpp
+++ b/V8InspectorSessionImpl.cpp
@@ -10,13 +10,13 @@
#include "platform/v8_inspector/RemoteObjectId.h"
#include "platform/v8_inspector/V8ConsoleAgentImpl.h"
#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
#include "platform/v8_inspector/V8HeapProfilerAgentImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8ProfilerAgentImpl.h"
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
#include "platform/v8_inspector/public/V8ContextInfo.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
namespace blink {
@@ -30,14 +30,14 @@
|| method.startWith(protocol::Console::Metainfo::commandPrefix);
}
-std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8DebuggerImpl* debugger, int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const String16* state)
+std::unique_ptr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8InspectorImpl* inspector, int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const String16* state)
{
- return wrapUnique(new V8InspectorSessionImpl(debugger, contextGroupId, channel, client, state));
+ return wrapUnique(new V8InspectorSessionImpl(inspector, contextGroupId, channel, client, state));
}
-V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const String16* savedState)
+V8InspectorSessionImpl::V8InspectorSessionImpl(V8InspectorImpl* inspector, int contextGroupId, protocol::FrontendChannel* channel, V8InspectorSessionClient* client, const String16* savedState)
: m_contextGroupId(contextGroupId)
- , m_debugger(debugger)
+ , m_inspector(inspector)
, m_client(client)
, m_customObjectFormatterEnabled(false)
, m_dispatcher(channel)
@@ -92,7 +92,7 @@
m_runtimeAgent->disable(&errorString);
discardInjectedScripts();
- m_debugger->disconnect(this);
+ m_inspector->disconnect(this);
}
protocol::DictionaryValue* V8InspectorSessionImpl::agentState(const String16& name)
@@ -116,7 +116,7 @@
void V8InspectorSessionImpl::discardInjectedScripts()
{
m_inspectedObjects.clear();
- const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_contextGroupId);
+ const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts)
return;
@@ -125,7 +125,7 @@
for (auto& idContext : *contexts)
keys.push_back(idContext.first);
for (auto& key : keys) {
- contexts = m_debugger->contextGroup(m_contextGroupId);
+ contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts)
continue;
auto contextIt = contexts->find(key);
@@ -141,7 +141,7 @@
return nullptr;
}
- const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_contextGroupId);
+ const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts) {
*errorString = "Cannot find context with specified id";
return nullptr;
@@ -173,7 +173,7 @@
void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup)
{
- const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_contextGroupId);
+ const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts)
return;
@@ -181,7 +181,7 @@
for (auto& idContext : *contexts)
keys.push_back(idContext.first);
for (auto& key : keys) {
- contexts = m_debugger->contextGroup(m_contextGroupId);
+ contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts)
continue;
auto contextsIt = contexts->find(key);
@@ -216,7 +216,7 @@
std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& groupName, bool generatePreview)
{
ErrorString errorString;
- InjectedScript* injectedScript = findInjectedScript(&errorString, V8DebuggerImpl::contextId(context));
+ InjectedScript* injectedScript = findInjectedScript(&errorString, V8InspectorImpl::contextId(context));
if (!injectedScript)
return nullptr;
return injectedScript->wrapObject(&errorString, value, groupName, false, generatePreview);
@@ -225,7 +225,7 @@
std::unique_ptr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapTable(v8::Local<v8::Context> context, v8::Local<v8::Value> table, v8::Local<v8::Value> columns)
{
ErrorString errorString;
- InjectedScript* injectedScript = findInjectedScript(&errorString, V8DebuggerImpl::contextId(context));
+ InjectedScript* injectedScript = findInjectedScript(&errorString, V8InspectorImpl::contextId(context));
if (!injectedScript)
return nullptr;
return injectedScript->wrapTable(table, columns);
@@ -234,7 +234,7 @@
void V8InspectorSessionImpl::setCustomObjectFormatterEnabled(bool enabled)
{
m_customObjectFormatterEnabled = enabled;
- const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_contextGroupId);
+ const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts)
return;
for (auto& idContext : *contexts) {
@@ -246,7 +246,7 @@
void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent)
{
- const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_contextGroupId);
+ const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(m_contextGroupId);
if (!contexts)
return;
for (auto& idContext : *contexts)
diff --git a/V8InspectorSessionImpl.h b/V8InspectorSessionImpl.h
index 0cd1d2d..1964d0f 100644
--- a/V8InspectorSessionImpl.h
+++ b/V8InspectorSessionImpl.h
@@ -23,7 +23,7 @@
class RemoteObjectIdBase;
class V8ConsoleAgentImpl;
class V8DebuggerAgentImpl;
-class V8DebuggerImpl;
+class V8InspectorImpl;
class V8HeapProfilerAgentImpl;
class V8ProfilerAgentImpl;
class V8RuntimeAgentImpl;
@@ -31,10 +31,10 @@
class V8InspectorSessionImpl : public V8InspectorSession {
PROTOCOL_DISALLOW_COPY(V8InspectorSessionImpl);
public:
- static std::unique_ptr<V8InspectorSessionImpl> create(V8DebuggerImpl*, int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state);
+ static std::unique_ptr<V8InspectorSessionImpl> create(V8InspectorImpl*, int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state);
~V8InspectorSessionImpl();
- V8DebuggerImpl* debugger() const { return m_debugger; }
+ V8InspectorImpl* inspector() const { return m_inspector; }
V8InspectorSessionClient* client() const { return m_client; }
V8ConsoleAgentImpl* consoleAgent() { return m_consoleAgent.get(); }
V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); }
@@ -70,11 +70,11 @@
static const unsigned kInspectedObjectBufferSize = 5;
private:
- V8InspectorSessionImpl(V8DebuggerImpl*, int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state);
+ V8InspectorSessionImpl(V8InspectorImpl*, int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state);
protocol::DictionaryValue* agentState(const String16& name);
int m_contextGroupId;
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
V8InspectorSessionClient* m_client;
bool m_customObjectFormatterEnabled;
diff --git a/V8ProfilerAgentImpl.cpp b/V8ProfilerAgentImpl.cpp
index 58e2b53..57712a9 100644
--- a/V8ProfilerAgentImpl.cpp
+++ b/V8ProfilerAgentImpl.cpp
@@ -5,7 +5,7 @@
#include "platform/v8_inspector/V8ProfilerAgentImpl.h"
#include "platform/v8_inspector/Atomics.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
@@ -105,9 +105,9 @@
return profile;
}
-std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8DebuggerImpl* debugger)
+std::unique_ptr<protocol::Debugger::Location> currentDebugLocation(V8InspectorImpl* inspector)
{
- std::unique_ptr<V8StackTrace> callStack = debugger->captureStackTrace(1);
+ std::unique_ptr<V8StackTrace> callStack = inspector->captureStackTrace(1);
std::unique_ptr<protocol::Debugger::Location> location = protocol::Debugger::Location::create()
.setScriptId(callStack->topScriptId())
.setLineNumber(callStack->topLineNumber()).build();
@@ -130,7 +130,7 @@
V8ProfilerAgentImpl::V8ProfilerAgentImpl(V8InspectorSessionImpl* session, protocol::FrontendChannel* frontendChannel, protocol::DictionaryValue* state)
: m_session(session)
- , m_isolate(m_session->debugger()->isolate())
+ , m_isolate(m_session->inspector()->isolate())
, m_profiler(nullptr)
, m_state(state)
, m_frontend(frontendChannel)
@@ -154,7 +154,7 @@
String16 id = nextProfileId();
m_startedProfiles.push_back(ProfileDescriptor(id, title));
startProfiling(id);
- m_frontend.consoleProfileStarted(id, currentDebugLocation(m_session->debugger()), title);
+ m_frontend.consoleProfileStarted(id, currentDebugLocation(m_session->inspector()), title);
}
void V8ProfilerAgentImpl::consoleProfileEnd(const String16& title)
@@ -185,7 +185,7 @@
std::unique_ptr<protocol::Profiler::CPUProfile> profile = stopProfiling(id, true);
if (!profile)
return;
- std::unique_ptr<protocol::Debugger::Location> location = currentDebugLocation(m_session->debugger());
+ std::unique_ptr<protocol::Debugger::Location> location = currentDebugLocation(m_session->inspector());
m_frontend.consoleProfileFinished(id, std::move(location), std::move(profile), resolvedTitle);
}
diff --git a/V8Regex.cpp b/V8Regex.cpp
index 304b715..96cd350 100644
--- a/V8Regex.cpp
+++ b/V8Regex.cpp
@@ -5,20 +5,20 @@
#include "platform/v8_inspector/V8Regex.h"
#include "platform/v8_inspector/V8Compat.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
#include <limits.h>
namespace blink {
-V8Regex::V8Regex(V8DebuggerImpl* debugger, const String16& pattern, bool caseSensitive, bool multiline)
- : m_debugger(debugger)
+V8Regex::V8Regex(V8InspectorImpl* inspector, const String16& pattern, bool caseSensitive, bool multiline)
+ : m_inspector(inspector)
{
- v8::Isolate* isolate = m_debugger->isolate();
+ v8::Isolate* isolate = m_inspector->isolate();
v8::HandleScope handleScope(isolate);
- v8::Local<v8::Context> context = m_debugger->regexContext();
+ v8::Local<v8::Context> context = m_inspector->regexContext();
v8::Context::Scope contextScope(context);
v8::TryCatch tryCatch(isolate);
@@ -49,9 +49,9 @@
if (string.length() > INT_MAX)
return -1;
- v8::Isolate* isolate = m_debugger->isolate();
+ v8::Isolate* isolate = m_inspector->isolate();
v8::HandleScope handleScope(isolate);
- v8::Local<v8::Context> context = m_debugger->regexContext();
+ v8::Local<v8::Context> context = m_inspector->regexContext();
v8::MicrotasksScope microtasks(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::TryCatch tryCatch(isolate);
diff --git a/V8Regex.h b/V8Regex.h
index 983717d..e4900e2 100644
--- a/V8Regex.h
+++ b/V8Regex.h
@@ -11,7 +11,7 @@
namespace blink {
-class V8DebuggerImpl;
+class V8InspectorImpl;
enum MultilineMode {
MultilineDisabled,
@@ -21,13 +21,13 @@
class V8Regex {
PROTOCOL_DISALLOW_COPY(V8Regex);
public:
- V8Regex(V8DebuggerImpl*, const String16&, bool caseSensitive, bool multiline = false);
+ V8Regex(V8InspectorImpl*, const String16&, bool caseSensitive, bool multiline = false);
int match(const String16&, int startFrom = 0, int* matchLength = 0) const;
bool isValid() const { return !m_regex.IsEmpty(); }
const String16& errorMessage() const { return m_errorMessage; }
private:
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
v8::Global<v8::RegExp> m_regex;
String16 m_errorMessage;
};
diff --git a/V8RuntimeAgentImpl.cpp b/V8RuntimeAgentImpl.cpp
index df2e9be..3eb396b 100644
--- a/V8RuntimeAgentImpl.cpp
+++ b/V8RuntimeAgentImpl.cpp
@@ -35,11 +35,11 @@
#include "platform/v8_inspector/InspectedContext.h"
#include "platform/v8_inspector/RemoteObjectId.h"
#include "platform/v8_inspector/V8ConsoleMessage.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
namespace blink {
@@ -63,10 +63,10 @@
template<typename Callback>
class ProtocolPromiseHandler {
public:
- static void add(V8DebuggerImpl* debugger, int contextGroupId, const String16& promiseObjectId, std::unique_ptr<Callback> callback, bool returnByValue, bool generatePreview)
+ static void add(V8InspectorImpl* inspector, int contextGroupId, const String16& promiseObjectId, std::unique_ptr<Callback> callback, bool returnByValue, bool generatePreview)
{
ErrorString errorString;
- InjectedScript::ObjectScope scope(&errorString, debugger, contextGroupId, promiseObjectId);
+ InjectedScript::ObjectScope scope(&errorString, inspector, contextGroupId, promiseObjectId);
if (!scope.initialize()) {
callback->sendFailure(errorString);
return;
@@ -77,8 +77,8 @@
}
Callback* rawCallback = callback.get();
- ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler(debugger, contextGroupId, promiseObjectId, std::move(callback), returnByValue, generatePreview);
- v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(debugger->isolate());
+ ProtocolPromiseHandler<Callback>* handler = new ProtocolPromiseHandler(inspector, contextGroupId, promiseObjectId, std::move(callback), returnByValue, generatePreview);
+ v8::Local<v8::Value> wrapper = handler->m_wrapper.Get(inspector->isolate());
v8::Local<v8::Promise> promise = v8::Local<v8::Promise>::Cast(scope.object());
v8::Local<v8::Function> thenCallbackFunction = v8::Function::New(scope.context(), thenCallback, wrapper, 0, v8::ConstructorBehavior::kThrow).ToLocalChecked();
@@ -109,7 +109,7 @@
v8::Local<v8::Value> value = info.Length() > 0 ? info[0] : v8::Local<v8::Value>::Cast(v8::Undefined(info.GetIsolate()));
std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails;
- std::unique_ptr<V8StackTraceImpl> stack = handler->m_debugger->captureStackTraceImpl(true);
+ std::unique_ptr<V8StackTraceImpl> stack = handler->m_inspector->captureStackTraceImpl(true);
if (stack) {
exceptionDetails = protocol::Runtime::ExceptionDetails::create()
.setText("Promise was rejected")
@@ -122,14 +122,14 @@
handler->m_callback->sendSuccess(handler->wrapObject(value), true, std::move(exceptionDetails));
}
- ProtocolPromiseHandler(V8DebuggerImpl* debugger, int contextGroupId, const String16& promiseObjectId, std::unique_ptr<Callback> callback, bool returnByValue, bool generatePreview)
- : m_debugger(debugger)
+ ProtocolPromiseHandler(V8InspectorImpl* inspector, int contextGroupId, const String16& promiseObjectId, std::unique_ptr<Callback> callback, bool returnByValue, bool generatePreview)
+ : m_inspector(inspector)
, m_contextGroupId(contextGroupId)
, m_promiseObjectId(promiseObjectId)
, m_callback(std::move(callback))
, m_returnByValue(returnByValue)
, m_generatePreview(generatePreview)
- , m_wrapper(debugger->isolate(), v8::External::New(debugger->isolate(), this))
+ , m_wrapper(inspector->isolate(), v8::External::New(inspector->isolate(), this))
{
m_wrapper.SetWeak(this, cleanup, v8::WeakCallbackType::kParameter);
}
@@ -148,7 +148,7 @@
std::unique_ptr<protocol::Runtime::RemoteObject> wrapObject(v8::Local<v8::Value> value)
{
ErrorString errorString;
- InjectedScript::ObjectScope scope(&errorString, m_debugger, m_contextGroupId, m_promiseObjectId);
+ InjectedScript::ObjectScope scope(&errorString, m_inspector, m_contextGroupId, m_promiseObjectId);
if (!scope.initialize()) {
m_callback->sendFailure(errorString);
return nullptr;
@@ -161,7 +161,7 @@
return wrappedValue;
}
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
int m_contextGroupId;
String16 m_promiseObjectId;
std::unique_ptr<Callback> m_callback;
@@ -176,7 +176,7 @@
: m_session(session)
, m_state(state)
, m_frontend(FrontendChannel)
- , m_debugger(session->debugger())
+ , m_inspector(session->inspector())
, m_enabled(false)
{
}
@@ -202,16 +202,16 @@
if (executionContextId.isJust()) {
contextId = executionContextId.fromJust();
} else {
- v8::HandleScope handles(m_debugger->isolate());
- v8::Local<v8::Context> defaultContext = m_debugger->client()->ensureDefaultContextInGroup(m_session->contextGroupId());
+ v8::HandleScope handles(m_inspector->isolate());
+ v8::Local<v8::Context> defaultContext = m_inspector->client()->ensureDefaultContextInGroup(m_session->contextGroupId());
if (defaultContext.IsEmpty()) {
callback->sendFailure("Cannot find default execution context");
return;
}
- contextId = V8DebuggerImpl::contextId(defaultContext);
+ contextId = V8InspectorImpl::contextId(defaultContext);
}
- InjectedScript::ContextScope scope(errorString, m_debugger, m_session->contextGroupId(), contextId);
+ InjectedScript::ContextScope scope(errorString, m_inspector, m_session->contextGroupId(), contextId);
if (!scope.initialize()) {
callback->sendFailure(*errorString);
return;
@@ -233,9 +233,9 @@
scope.context()->AllowCodeGenerationFromStrings(true);
v8::MaybeLocal<v8::Value> maybeResultValue;
- v8::Local<v8::Script> script = m_debugger->compileScript(scope.context(), toV8String(m_debugger->isolate(), expression), String16(), false);
+ v8::Local<v8::Script> script = m_inspector->compileScript(scope.context(), toV8String(m_inspector->isolate(), expression), String16(), false);
if (!script.IsEmpty())
- maybeResultValue = m_debugger->runCompiledScript(scope.context(), script);
+ maybeResultValue = m_inspector->runCompiledScript(scope.context(), script);
if (evalIsDisabled)
scope.context()->AllowCodeGenerationFromStrings(false);
@@ -279,7 +279,7 @@
return;
}
- ProtocolPromiseHandler<EvaluateCallback>::add(m_debugger, m_session->contextGroupId(), result->getObjectId(String16()), std::move(callback), returnByValue.fromMaybe(false), generatePreview.fromMaybe(false));
+ ProtocolPromiseHandler<EvaluateCallback>::add(m_inspector, m_session->contextGroupId(), result->getObjectId(String16()), std::move(callback), returnByValue.fromMaybe(false), generatePreview.fromMaybe(false));
}
void V8RuntimeAgentImpl::awaitPromise(ErrorString* errorString,
@@ -288,7 +288,7 @@
const Maybe<bool>& generatePreview,
std::unique_ptr<AwaitPromiseCallback> callback)
{
- ProtocolPromiseHandler<AwaitPromiseCallback>::add(m_debugger, m_session->contextGroupId(), promiseObjectId, std::move(callback), returnByValue.fromMaybe(false), generatePreview.fromMaybe(false));
+ ProtocolPromiseHandler<AwaitPromiseCallback>::add(m_inspector, m_session->contextGroupId(), promiseObjectId, std::move(callback), returnByValue.fromMaybe(false), generatePreview.fromMaybe(false));
}
void V8RuntimeAgentImpl::callFunctionOn(ErrorString* errorString,
@@ -302,7 +302,7 @@
std::unique_ptr<RemoteObject>* result,
Maybe<bool>* wasThrown)
{
- InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contextGroupId(), objectId);
+ InjectedScript::ObjectScope scope(errorString, m_inspector, m_session->contextGroupId(), objectId);
if (!scope.initialize())
return;
@@ -325,7 +325,7 @@
if (userGesture.fromMaybe(false))
scope.pretendUserGesture();
- v8::MaybeLocal<v8::Value> maybeFunctionValue = m_debugger->compileAndRunInternalScript(scope.context(), toV8String(m_debugger->isolate(), "(" + expression + ")"));
+ v8::MaybeLocal<v8::Value> maybeFunctionValue = m_inspector->compileAndRunInternalScript(scope.context(), toV8String(m_inspector->isolate(), "(" + expression + ")"));
// Re-initialize after running client's code, as it could have destroyed context or session.
if (!scope.initialize())
return;
@@ -341,7 +341,7 @@
return;
}
- v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->callFunction(functionValue.As<v8::Function>(), scope.context(), scope.object(), argc, argv.get());
+ v8::MaybeLocal<v8::Value> maybeResultValue = m_inspector->callFunction(functionValue.As<v8::Function>(), scope.context(), scope.object(), argc, argv.get());
// Re-initialize after running client's code, as it could have destroyed context or session.
if (!scope.initialize())
return;
@@ -361,7 +361,7 @@
{
using protocol::Runtime::InternalPropertyDescriptor;
- InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contextGroupId(), objectId);
+ InjectedScript::ObjectScope scope(errorString, m_inspector, m_session->contextGroupId(), objectId);
if (!scope.initialize())
return;
@@ -376,7 +376,7 @@
if (!errorString->isEmpty() || exceptionDetails->isJust() || accessorPropertiesOnly.fromMaybe(false))
return;
v8::Local<v8::Array> propertiesArray;
- if (hasInternalError(errorString, !m_debugger->internalProperties(scope.context(), scope.object()).ToLocal(&propertiesArray)))
+ if (hasInternalError(errorString, !m_inspector->internalProperties(scope.context(), scope.object()).ToLocal(&propertiesArray)))
return;
std::unique_ptr<protocol::Array<InternalPropertyDescriptor>> propertiesProtocolArray = protocol::Array<InternalPropertyDescriptor>::create();
for (uint32_t i = 0; i < propertiesArray->Length(); i += 2) {
@@ -400,7 +400,7 @@
void V8RuntimeAgentImpl::releaseObject(ErrorString* errorString, const String16& objectId)
{
- InjectedScript::ObjectScope scope(errorString, m_debugger, m_session->contextGroupId(), objectId);
+ InjectedScript::ObjectScope scope(errorString, m_inspector, m_session->contextGroupId(), objectId);
if (!scope.initialize())
return;
scope.injectedScript()->releaseObject(objectId);
@@ -424,7 +424,7 @@
void V8RuntimeAgentImpl::discardConsoleEntries(ErrorString*)
{
- V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessageStorage(m_session->contextGroupId());
+ V8ConsoleMessageStorage* storage = m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId());
storage->clear();
}
@@ -440,11 +440,11 @@
*errorString = "Runtime agent is not enabled";
return;
}
- InjectedScript::ContextScope scope(errorString, m_debugger, m_session->contextGroupId(), executionContextId);
+ InjectedScript::ContextScope scope(errorString, m_inspector, m_session->contextGroupId(), executionContextId);
if (!scope.initialize())
return;
- v8::Local<v8::Script> script = m_debugger->compileScript(scope.context(), toV8String(m_debugger->isolate(), expression), sourceURL, false);
+ v8::Local<v8::Script> script = m_inspector->compileScript(scope.context(), toV8String(m_inspector->isolate(), expression), sourceURL, false);
if (script.IsEmpty()) {
v8::Local<v8::Message> message = scope.tryCatch().Message();
if (!message.IsEmpty())
@@ -458,7 +458,7 @@
return;
String16 scriptValueId = String16::fromInteger(script->GetUnboundScript()->GetId());
- std::unique_ptr<v8::Global<v8::Script>> global(new v8::Global<v8::Script>(m_debugger->isolate(), script));
+ std::unique_ptr<v8::Global<v8::Script>> global(new v8::Global<v8::Script>(m_inspector->isolate(), script));
m_compiledScripts[scriptValueId] = std::move(global);
*scriptId = scriptValueId;
}
@@ -483,7 +483,7 @@
return;
}
- InjectedScript::ContextScope scope(errorString, m_debugger, m_session->contextGroupId(), executionContextId);
+ InjectedScript::ContextScope scope(errorString, m_inspector, m_session->contextGroupId(), executionContextId);
if (!scope.initialize())
return;
@@ -492,7 +492,7 @@
std::unique_ptr<v8::Global<v8::Script>> scriptWrapper = std::move(it->second);
m_compiledScripts.erase(it);
- v8::Local<v8::Script> script = scriptWrapper->Get(m_debugger->isolate());
+ v8::Local<v8::Script> script = scriptWrapper->Get(m_inspector->isolate());
if (script.IsEmpty()) {
*errorString = "Script execution failed";
return;
@@ -501,7 +501,7 @@
if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI())
return;
- v8::MaybeLocal<v8::Value> maybeResultValue = m_debugger->runCompiledScript(scope.context(), script);
+ v8::MaybeLocal<v8::Value> maybeResultValue = m_inspector->runCompiledScript(scope.context(), script);
// Re-initialize after running client's code, as it could have destroyed context or session.
if (!scope.initialize())
@@ -524,12 +524,12 @@
{
if (m_enabled)
return;
- m_debugger->client()->beginEnsureAllContextsInGroup(m_session->contextGroupId());
+ m_inspector->client()->beginEnsureAllContextsInGroup(m_session->contextGroupId());
m_enabled = true;
m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, true);
- m_session->debugger()->enableStackCapturingIfNeeded();
+ m_inspector->enableStackCapturingIfNeeded();
m_session->reportAllContexts(this);
- V8ConsoleMessageStorage* storage = m_session->debugger()->ensureConsoleMessageStorage(m_session->contextGroupId());
+ V8ConsoleMessageStorage* storage = m_inspector->ensureConsoleMessageStorage(m_session->contextGroupId());
for (const auto& message : storage->messages())
reportMessage(message.get(), false);
}
@@ -540,17 +540,17 @@
return;
m_enabled = false;
m_state->setBoolean(V8RuntimeAgentImplState::runtimeEnabled, false);
- m_session->debugger()->disableStackCapturingIfNeeded();
+ m_inspector->disableStackCapturingIfNeeded();
m_session->discardInjectedScripts();
reset();
- m_debugger->client()->endEnsureAllContextsInGroup(m_session->contextGroupId());
+ m_inspector->client()->endEnsureAllContextsInGroup(m_session->contextGroupId());
}
void V8RuntimeAgentImpl::reset()
{
m_compiledScripts.clear();
if (m_enabled) {
- if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_session->contextGroupId())) {
+ if (const V8InspectorImpl::ContextByIdMap* contexts = m_inspector->contextGroup(m_session->contextGroupId())) {
for (auto& idContext : *contexts)
idContext.second->setReported(false);
}
diff --git a/V8RuntimeAgentImpl.h b/V8RuntimeAgentImpl.h
index e316539..049f709 100644
--- a/V8RuntimeAgentImpl.h
+++ b/V8RuntimeAgentImpl.h
@@ -43,7 +43,7 @@
class InspectedContext;
class RemoteObjectIdBase;
class V8ConsoleMessage;
-class V8DebuggerImpl;
+class V8InspectorImpl;
class V8InspectorSessionImpl;
namespace protocol {
@@ -130,7 +130,7 @@
V8InspectorSessionImpl* m_session;
protocol::DictionaryValue* m_state;
protocol::Runtime::Frontend m_frontend;
- V8DebuggerImpl* m_debugger;
+ V8InspectorImpl* m_inspector;
bool m_enabled;
protocol::HashMap<String16, std::unique_ptr<v8::Global<v8::Script>>> m_compiledScripts;
};
diff --git a/V8StackTraceImpl.cpp b/V8StackTraceImpl.cpp
index 8221c3a..0bf639c 100644
--- a/V8StackTraceImpl.cpp
+++ b/V8StackTraceImpl.cpp
@@ -6,7 +6,7 @@
#include "platform/inspector_protocol/Platform.h"
#include "platform/inspector_protocol/String16.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
#include <v8-debug.h>
@@ -105,7 +105,7 @@
}
// static
-std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(V8DebuggerImpl* debugger, int contextGroupId, v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize, const String16& description)
+std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(V8InspectorImpl* inspector, int contextGroupId, v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize, const String16& description)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
@@ -115,9 +115,9 @@
int maxAsyncCallChainDepth = 1;
V8StackTraceImpl* asyncCallChain = nullptr;
- if (debugger && maxStackSize > 1) {
- asyncCallChain = debugger->currentAsyncCallChain();
- maxAsyncCallChainDepth = debugger->maxAsyncCallChainDepth();
+ if (inspector && maxStackSize > 1) {
+ asyncCallChain = inspector->currentAsyncCallChain();
+ maxAsyncCallChainDepth = inspector->maxAsyncCallChainDepth();
}
// Do not accidentally append async call chain from another group. This should not
// happen if we have proper instrumentation, but let's double-check to be safe.
@@ -147,7 +147,7 @@
return result;
}
-std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(V8DebuggerImpl* debugger, int contextGroupId, size_t maxStackSize, const String16& description)
+std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture(V8InspectorImpl* inspector, int contextGroupId, size_t maxStackSize, const String16& description)
{
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handleScope(isolate);
@@ -158,7 +158,7 @@
#endif
stackTrace = v8::StackTrace::CurrentStackTrace(isolate, maxStackSize, stackTraceOptions);
}
- return V8StackTraceImpl::create(debugger, contextGroupId, stackTrace, maxStackSize, description);
+ return V8StackTraceImpl::create(inspector, contextGroupId, stackTrace, maxStackSize, description);
}
std::unique_ptr<V8StackTrace> V8StackTraceImpl::clone()
@@ -242,11 +242,11 @@
return stackTrace;
}
-std::unique_ptr<protocol::Runtime::StackTrace> V8StackTraceImpl::buildInspectorObjectForTail(V8DebuggerImpl* debugger) const
+std::unique_ptr<protocol::Runtime::StackTrace> V8StackTraceImpl::buildInspectorObjectForTail(V8InspectorImpl* inspector) const
{
v8::HandleScope handleScope(v8::Isolate::GetCurrent());
// Next call collapses possible empty stack and ensures maxAsyncCallChainDepth.
- std::unique_ptr<V8StackTraceImpl> fullChain = V8StackTraceImpl::create(debugger, m_contextGroupId, v8::Local<v8::StackTrace>(), V8StackTraceImpl::maxCallStackSizeToCapture);
+ std::unique_ptr<V8StackTraceImpl> fullChain = V8StackTraceImpl::create(inspector, m_contextGroupId, v8::Local<v8::StackTrace>(), V8StackTraceImpl::maxCallStackSizeToCapture);
if (!fullChain || !fullChain->m_parent)
return nullptr;
return fullChain->m_parent->buildInspectorObjectImpl();
diff --git a/V8StackTraceImpl.h b/V8StackTraceImpl.h
index c9f3137..2f92d07 100644
--- a/V8StackTraceImpl.h
+++ b/V8StackTraceImpl.h
@@ -15,7 +15,7 @@
namespace blink {
class TracedValue;
-class V8DebuggerImpl;
+class V8InspectorImpl;
// Note: async stack trace may have empty top stack with non-empty tail to indicate
// that current native-only state had some async story.
@@ -51,14 +51,14 @@
};
static void setCaptureStackTraceForUncaughtExceptions(v8::Isolate*, bool capture);
- static std::unique_ptr<V8StackTraceImpl> create(V8DebuggerImpl*, int contextGroupId, v8::Local<v8::StackTrace>, size_t maxStackSize, const String16& description = String16());
- static std::unique_ptr<V8StackTraceImpl> capture(V8DebuggerImpl*, int contextGroupId, size_t maxStackSize, const String16& description = String16());
+ static std::unique_ptr<V8StackTraceImpl> create(V8InspectorImpl*, int contextGroupId, v8::Local<v8::StackTrace>, size_t maxStackSize, const String16& description = String16());
+ static std::unique_ptr<V8StackTraceImpl> capture(V8InspectorImpl*, int contextGroupId, size_t maxStackSize, const String16& description = String16());
std::unique_ptr<V8StackTrace> clone() override;
std::unique_ptr<V8StackTraceImpl> cloneImpl();
std::unique_ptr<V8StackTrace> isolatedCopy() override;
std::unique_ptr<V8StackTraceImpl> isolatedCopyImpl();
- std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V8DebuggerImpl*) const;
+ std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectForTail(V8InspectorImpl*) const;
std::unique_ptr<protocol::Runtime::StackTrace> buildInspectorObjectImpl() const;
~V8StackTraceImpl() override;
diff --git a/V8StringUtil.cpp b/V8StringUtil.cpp
index 1509153..f440c73 100644
--- a/V8StringUtil.cpp
+++ b/V8StringUtil.cpp
@@ -5,7 +5,7 @@
#include "platform/v8_inspector/V8StringUtil.h"
#include "platform/inspector_protocol/String16.h"
-#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8InspectorImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8Regex.h"
@@ -143,10 +143,10 @@
.build();
}
-std::unique_ptr<V8Regex> createSearchRegex(V8DebuggerImpl* debugger, const String16& query, bool caseSensitive, bool isRegex)
+std::unique_ptr<V8Regex> createSearchRegex(V8InspectorImpl* inspector, const String16& query, bool caseSensitive, bool isRegex)
{
String16 regexSource = isRegex ? query : createSearchRegexSource(query);
- return wrapUnique(new V8Regex(debugger, regexSource, caseSensitive));
+ return wrapUnique(new V8Regex(inspector, regexSource, caseSensitive));
}
} // namespace
@@ -183,7 +183,7 @@
std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> searchInTextByLinesImpl(V8InspectorSession* session, const String16& text, const String16& query, const bool caseSensitive, const bool isRegex)
{
- std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSessionImpl*>(session)->debugger(), query, caseSensitive, isRegex);
+ std::unique_ptr<V8Regex> regex = createSearchRegex(static_cast<V8InspectorSessionImpl*>(session)->inspector(), query, caseSensitive, isRegex);
std::vector<std::pair<int, String16>> matches = scriptRegexpMatchesByLines(*regex.get(), text);
std::vector<std::unique_ptr<protocol::Debugger::SearchMatch>> result;
diff --git a/public/SimpleInspector.cpp b/public/SimpleInspector.cpp
new file mode 100644
index 0000000..5ff43de
--- /dev/null
+++ b/public/SimpleInspector.cpp
@@ -0,0 +1,74 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+#include "platform/v8_inspector/public/SimpleInspector.h"
+
+#include "platform/inspector_protocol/DispatcherBase.h"
+#include "platform/v8_inspector/V8StringUtil.h"
+#include "platform/v8_inspector/public/V8Inspector.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
+
+namespace blink {
+
+SimpleInspector::SimpleInspector(v8::Isolate* isolate, v8::Local<v8::Context> context)
+ : m_context(context)
+{
+ m_inspector = V8Inspector::create(isolate, this);
+ m_inspector->contextCreated(V8ContextInfo(context, 1, true, "",
+ "NodeJS Main Context", "", false));
+}
+
+SimpleInspector::~SimpleInspector()
+{
+ disconnectFrontend();
+}
+
+String16 SimpleInspector::valueSubtype(v8::Local<v8::Value> value)
+{
+ return String16();
+}
+
+bool SimpleInspector::formatAccessorsAsProperties(v8::Local<v8::Value> value)
+{
+ return false;
+}
+
+void SimpleInspector::connectFrontend(protocol::FrontendChannel* channel)
+{
+ m_session = m_inspector->connect(1, channel, this, &m_state);
+}
+
+void SimpleInspector::disconnectFrontend()
+{
+ m_session.reset();
+}
+
+void SimpleInspector::dispatchMessageFromFrontend(const String16& message)
+{
+ if (m_session)
+ m_session->dispatchProtocolMessage(message);
+}
+
+v8::Local<v8::Context> SimpleInspector::ensureDefaultContextInGroup(int)
+{
+ return m_context;
+}
+
+bool SimpleInspector::isExecutionAllowed()
+{
+ return true;
+}
+
+bool SimpleInspector::canExecuteScripts()
+{
+ return true;
+}
+
+void SimpleInspector::notifyContextDestroyed()
+{
+ m_inspector->contextDestroyed(m_context);
+}
+
+} // namespace blink
diff --git a/public/SimpleInspector.h b/public/SimpleInspector.h
new file mode 100644
index 0000000..eb6c8eb
--- /dev/null
+++ b/public/SimpleInspector.h
@@ -0,0 +1,81 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SimpleInspector_h
+#define SimpleInspector_h
+
+#include "platform/inspector_protocol/Platform.h"
+#include "platform/v8_inspector/public/V8InspectorClient.h"
+#include "platform/v8_inspector/public/V8InspectorSession.h"
+#include "platform/v8_inspector/public/V8InspectorSessionClient.h"
+
+#include <v8.h>
+
+namespace blink {
+
+namespace protocol {
+class Dispatcher;
+class Frontend;
+class FrontendChannel;
+}
+
+class V8Inspector;
+class V8HeapProfilerAgent;
+class V8ProfilerAgent;
+
+class SimpleInspector : public V8InspectorClient, V8InspectorSessionClient {
+public:
+ SimpleInspector(v8::Isolate*, v8::Local<v8::Context>);
+ ~SimpleInspector();
+
+ // Transport interface.
+ void connectFrontend(protocol::FrontendChannel*);
+ void disconnectFrontend();
+ void dispatchMessageFromFrontend(const String16& message);
+ void notifyContextDestroyed();
+
+private:
+ String16 valueSubtype(v8::Local<v8::Value>) override;
+ bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
+ void muteWarningsAndDeprecations(int) override { }
+ void unmuteWarningsAndDeprecations(int) override { }
+ double currentTimeMS() override { return 0; };
+
+ bool isExecutionAllowed() override;
+ v8::Local<v8::Context> ensureDefaultContextInGroup(int contextGroupId) override;
+ void beginEnsureAllContextsInGroup(int contextGroupId) override { }
+ void endEnsureAllContextsInGroup(int contextGroupId) override { }
+ void beginUserGesture() override { }
+ void endUserGesture() override { }
+ bool isInspectableHeapObject(v8::Local<v8::Object>) override { return true; }
+ void consoleTime(const String16& title) override { }
+ void consoleTimeEnd(const String16& title) override { }
+ void consoleTimeStamp(const String16& title) override { }
+ void consoleAPIMessage(int contextGroupId, MessageLevel, const String16& message, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTrace*) override { }
+ v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*, v8::Local<v8::Context>) override
+ {
+ return v8::MaybeLocal<v8::Value>();
+ }
+ void installAdditionalCommandLineAPI(v8::Local<v8::Context>, v8::Local<v8::Object>) override { }
+ void enableAsyncInstrumentation() override { }
+ void disableAsyncInstrumentation() override { }
+ void startRepeatingTimer(double, TimerCallback, void* data) override { }
+ void cancelTimer(void* data) override { }
+
+ // V8InspectorSessionClient
+ void resumeStartup() override { };
+ bool canExecuteScripts() override;
+ void profilingStarted() override { };
+ void profilingStopped() override { };
+ void consoleCleared() override { };
+
+ std::unique_ptr<V8Inspector> m_inspector;
+ std::unique_ptr<V8InspectorSession> m_session;
+ String16 m_state;
+ v8::Local<v8::Context> m_context;
+};
+
+}
+
+#endif // SimpleInspector_h
diff --git a/public/V8Debugger.h b/public/V8Debugger.h
deleted file mode 100644
index d61491c..0000000
--- a/public/V8Debugger.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef V8Debugger_h
-#define V8Debugger_h
-
-#include "platform/inspector_protocol/Platform.h"
-#include "platform/inspector_protocol/String16.h"
-
-#include <v8.h>
-
-namespace blink {
-
-class V8ContextInfo;
-class V8DebuggerClient;
-class V8InspectorSession;
-class V8InspectorSessionClient;
-class V8StackTrace;
-
-namespace protocol {
-class FrontendChannel;
-}
-
-class PLATFORM_EXPORT V8Debugger {
-public:
- static std::unique_ptr<V8Debugger> create(v8::Isolate*, V8DebuggerClient*);
- virtual ~V8Debugger() { }
-
- // Contexts instrumentation.
- virtual void contextCreated(const V8ContextInfo&) = 0;
- virtual void contextDestroyed(v8::Local<v8::Context>) = 0;
- virtual void resetContextGroup(int contextGroupId) = 0;
-
- // Various instrumentation.
- virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0;
- virtual void didExecuteScript(v8::Local<v8::Context>) = 0;
- virtual void idleStarted() = 0;
- virtual void idleFinished() = 0;
-
- // Async stack traces instrumentation.
- virtual void asyncTaskScheduled(const String16& taskName, void* task, bool recurring) = 0;
- virtual void asyncTaskCanceled(void* task) = 0;
- virtual void asyncTaskStarted(void* task) = 0;
- virtual void asyncTaskFinished(void* task) = 0;
- virtual void allAsyncTasksCanceled() = 0;
-
- // Exceptions instrumentation.
- virtual unsigned exceptionThrown(v8::Local<v8::Context>, const String16& message, v8::Local<v8::Value> exception, const String16& detailedMessage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) = 0;
- virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId, const String16& message) = 0;
-
- // API methods.
- virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state) = 0;
- virtual std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>) = 0;
- virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
-};
-
-} // namespace blink
-
-
-#endif // V8Debugger_h
diff --git a/public/V8Inspector.cpp b/public/V8Inspector.cpp
deleted file mode 100644
index 4470318..0000000
--- a/public/V8Inspector.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-#include "platform/v8_inspector/public/V8Inspector.h"
-
-#include "platform/inspector_protocol/DispatcherBase.h"
-#include "platform/v8_inspector/V8StringUtil.h"
-#include "platform/v8_inspector/public/V8Debugger.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
-
-namespace blink {
-
-V8Inspector::V8Inspector(v8::Isolate* isolate, v8::Local<v8::Context> context)
- : m_context(context)
-{
- m_debugger = V8Debugger::create(isolate, this);
- m_debugger->contextCreated(V8ContextInfo(context, 1, true, "",
- "NodeJS Main Context", "", false));
-}
-
-V8Inspector::~V8Inspector()
-{
- disconnectFrontend();
-}
-
-String16 V8Inspector::valueSubtype(v8::Local<v8::Value> value)
-{
- return String16();
-}
-
-bool V8Inspector::formatAccessorsAsProperties(v8::Local<v8::Value> value)
-{
- return false;
-}
-
-void V8Inspector::connectFrontend(protocol::FrontendChannel* channel)
-{
- m_session = m_debugger->connect(1, channel, this, &m_state);
-}
-
-void V8Inspector::disconnectFrontend()
-{
- m_session.reset();
-}
-
-void V8Inspector::dispatchMessageFromFrontend(const String16& message)
-{
- if (m_session)
- m_session->dispatchProtocolMessage(message);
-}
-
-v8::Local<v8::Context> V8Inspector::ensureDefaultContextInGroup(int)
-{
- return m_context;
-}
-
-bool V8Inspector::isExecutionAllowed()
-{
- return true;
-}
-
-bool V8Inspector::canExecuteScripts()
-{
- return true;
-}
-
-void V8Inspector::notifyContextDestroyed()
-{
- m_debugger->contextDestroyed(m_context);
-}
-
-} // namespace blink
diff --git a/public/V8Inspector.h b/public/V8Inspector.h
index 2d795eb..f67f1e9 100644
--- a/public/V8Inspector.h
+++ b/public/V8Inspector.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,76 +6,56 @@
#define V8Inspector_h
#include "platform/inspector_protocol/Platform.h"
-#include "platform/v8_inspector/public/V8DebuggerClient.h"
-#include "platform/v8_inspector/public/V8InspectorSession.h"
-#include "platform/v8_inspector/public/V8InspectorSessionClient.h"
+#include "platform/inspector_protocol/String16.h"
#include <v8.h>
namespace blink {
+class V8ContextInfo;
+class V8InspectorClient;
+class V8InspectorSession;
+class V8InspectorSessionClient;
+class V8StackTrace;
+
namespace protocol {
-class Dispatcher;
-class Frontend;
class FrontendChannel;
}
-class V8Debugger;
-class V8HeapProfilerAgent;
-class V8ProfilerAgent;
-
-class V8Inspector : public V8DebuggerClient, V8InspectorSessionClient {
+class PLATFORM_EXPORT V8Inspector {
public:
- V8Inspector(v8::Isolate*, v8::Local<v8::Context>);
- ~V8Inspector();
+ static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*);
+ virtual ~V8Inspector() { }
- // Transport interface.
- void connectFrontend(protocol::FrontendChannel*);
- void disconnectFrontend();
- void dispatchMessageFromFrontend(const String16& message);
- void notifyContextDestroyed();
+ // Contexts instrumentation.
+ virtual void contextCreated(const V8ContextInfo&) = 0;
+ virtual void contextDestroyed(v8::Local<v8::Context>) = 0;
+ virtual void resetContextGroup(int contextGroupId) = 0;
-private:
- String16 valueSubtype(v8::Local<v8::Value>) override;
- bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
- void muteWarningsAndDeprecations(int) override { }
- void unmuteWarningsAndDeprecations(int) override { }
- double currentTimeMS() override { return 0; };
+ // Various instrumentation.
+ virtual void willExecuteScript(v8::Local<v8::Context>, int scriptId) = 0;
+ virtual void didExecuteScript(v8::Local<v8::Context>) = 0;
+ virtual void idleStarted() = 0;
+ virtual void idleFinished() = 0;
- bool isExecutionAllowed() override;
- v8::Local<v8::Context> ensureDefaultContextInGroup(int contextGroupId) override;
- void beginEnsureAllContextsInGroup(int contextGroupId) override { }
- void endEnsureAllContextsInGroup(int contextGroupId) override { }
- void beginUserGesture() override { }
- void endUserGesture() override { }
- bool isInspectableHeapObject(v8::Local<v8::Object>) override { return true; }
- void consoleTime(const String16& title) override { }
- void consoleTimeEnd(const String16& title) override { }
- void consoleTimeStamp(const String16& title) override { }
- void consoleAPIMessage(int contextGroupId, MessageLevel, const String16& message, const String16& url, unsigned lineNumber, unsigned columnNumber, V8StackTrace*) override { }
- v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*, v8::Local<v8::Context>) override
- {
- return v8::MaybeLocal<v8::Value>();
- }
- void installAdditionalCommandLineAPI(v8::Local<v8::Context>, v8::Local<v8::Object>) override { }
- void enableAsyncInstrumentation() override { }
- void disableAsyncInstrumentation() override { }
- void startRepeatingTimer(double, TimerCallback, void* data) override { }
- void cancelTimer(void* data) override { }
+ // Async stack traces instrumentation.
+ virtual void asyncTaskScheduled(const String16& taskName, void* task, bool recurring) = 0;
+ virtual void asyncTaskCanceled(void* task) = 0;
+ virtual void asyncTaskStarted(void* task) = 0;
+ virtual void asyncTaskFinished(void* task) = 0;
+ virtual void allAsyncTasksCanceled() = 0;
- // V8InspectorSessionClient
- void resumeStartup() override { };
- bool canExecuteScripts() override;
- void profilingStarted() override { };
- void profilingStopped() override { };
- void consoleCleared() override { };
+ // Exceptions instrumentation.
+ virtual unsigned exceptionThrown(v8::Local<v8::Context>, const String16& message, v8::Local<v8::Value> exception, const String16& detailedMessage, const String16& url, unsigned lineNumber, unsigned columnNumber, std::unique_ptr<V8StackTrace>, int scriptId) = 0;
+ virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId, const String16& message) = 0;
- std::unique_ptr<V8Debugger> m_debugger;
- std::unique_ptr<V8InspectorSession> m_session;
- String16 m_state;
- v8::Local<v8::Context> m_context;
+ // API methods.
+ virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId, protocol::FrontendChannel*, V8InspectorSessionClient*, const String16* state) = 0;
+ virtual std::unique_ptr<V8StackTrace> createStackTrace(v8::Local<v8::StackTrace>) = 0;
+ virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
};
-}
+} // namespace blink
+
#endif // V8Inspector_h
diff --git a/public/V8DebuggerClient.h b/public/V8InspectorClient.h
similarity index 92%
rename from public/V8DebuggerClient.h
rename to public/V8InspectorClient.h
index e185a01..38e9784 100644
--- a/public/V8DebuggerClient.h
+++ b/public/V8InspectorClient.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef V8DebuggerClient_h
-#define V8DebuggerClient_h
+#ifndef V8InspectorClient_h
+#define V8InspectorClient_h
#include "platform/inspector_protocol/Platform.h"
#include "platform/v8_inspector/public/V8ContextInfo.h"
@@ -16,9 +16,9 @@
enum class V8ConsoleAPIType { kClear, kDebug, kLog, kInfo, kWarning, kError };
-class PLATFORM_EXPORT V8DebuggerClient {
+class PLATFORM_EXPORT V8InspectorClient {
public:
- virtual ~V8DebuggerClient() { }
+ virtual ~V8InspectorClient() { }
virtual void runMessageLoopOnPause(int contextGroupId) = 0;
virtual void quitMessageLoopOnPause() = 0;
virtual void muteWarningsAndDeprecations(int contextGroupId) = 0;
@@ -53,4 +53,4 @@
} // namespace blink
-#endif // V8DebuggerClient_h
+#endif // V8InspectorClient_h
diff --git a/v8_inspector.gyp b/v8_inspector.gyp
index 78df087..151a1e9 100644
--- a/v8_inspector.gyp
+++ b/v8_inspector.gyp
@@ -207,8 +207,8 @@
'V8ConsoleMessage.h',
'V8DebuggerAgentImpl.cpp',
'V8DebuggerAgentImpl.h',
- 'V8DebuggerImpl.cpp',
- 'V8DebuggerImpl.h',
+ 'V8InspectorImpl.cpp',
+ 'V8InspectorImpl.h',
'V8DebuggerScript.cpp',
'V8DebuggerScript.h',
'V8FunctionCall.cpp',
@@ -233,11 +233,11 @@
'V8StringUtil.h',
'public/V8EventListenerInfo.h',
'public/V8ContextInfo.h',
- 'public/V8Debugger.h',
- 'public/V8DebuggerClient.h',
- 'public/V8HeapProfilerAgent.h',
- 'public/V8Inspector.cpp',
'public/V8Inspector.h',
+ 'public/V8InspectorClient.h',
+ 'public/V8HeapProfilerAgent.h',
+ 'public/SimpleInspector.cpp',
+ 'public/SimpleInspector.h',
'public/V8InspectorSession.h',
'public/V8StackTrace.h',