#include "test/inspector/isolate-data.h"
#include <optional>
#include "include/v8-context.h"
#include "include/v8-exception.h"
#include "include/v8-microtask-queue.h"
#include "include/v8-template.h"
#include "src/execution/isolate.h"
#include "src/heap/heap.h"
#include "src/init/v8.h"
#include "src/inspector/test-interface.h"
#include "test/inspector/frontend-channel.h"
#include "test/inspector/task-runner.h"
#include "test/inspector/utils.h"
namespace v8 {
namespace internal {
namespace {
const int kIsolateDataIndex = …;
const int kContextGroupIdIndex = …;
void Print(v8::Isolate* isolate, const v8_inspector::StringView& string) { … }
class Inspectable : public v8_inspector::V8InspectorSession::Inspectable { … };
}
InspectorIsolateData::InspectorIsolateData(
TaskRunner* task_runner,
InspectorIsolateData::SetupGlobalTasks setup_global_tasks,
v8::StartupData* startup_data, WithInspector with_inspector)
: … { … }
InspectorIsolateData* InspectorIsolateData::FromContext(
v8::Local<v8::Context> context) { … }
InspectorIsolateData::~InspectorIsolateData() { … }
int InspectorIsolateData::CreateContextGroup() { … }
bool InspectorIsolateData::CreateContext(int context_group_id,
v8_inspector::StringView name) { … }
v8::Local<v8::Context> InspectorIsolateData::GetDefaultContext(
int context_group_id) { … }
void InspectorIsolateData::ResetContextGroup(int context_group_id) { … }
int InspectorIsolateData::GetContextGroupId(v8::Local<v8::Context> context) { … }
void InspectorIsolateData::RegisterModule(v8::Local<v8::Context> context,
std::vector<uint16_t> name,
v8::ScriptCompiler::Source* source) { … }
v8::MaybeLocal<v8::Module> InspectorIsolateData::ModuleResolveCallback(
v8::Local<v8::Context> context, v8::Local<v8::String> specifier,
v8::Local<v8::FixedArray> import_attributes,
v8::Local<v8::Module> referrer) { … }
std::optional<int> InspectorIsolateData::ConnectSession(
int context_group_id, const v8_inspector::StringView& state,
std::unique_ptr<FrontendChannelImpl> channel, bool is_fully_trusted) { … }
namespace {
class RemoveChannelTask : public TaskRunner::Task { … };
}
std::vector<uint8_t> InspectorIsolateData::DisconnectSession(
int session_id, TaskRunner* context_task_runner) { … }
void InspectorIsolateData::SendMessage(
int session_id, const v8_inspector::StringView& message) { … }
void InspectorIsolateData::BreakProgram(
int context_group_id, const v8_inspector::StringView& reason,
const v8_inspector::StringView& details) { … }
void InspectorIsolateData::Stop(int session_id) { … }
void InspectorIsolateData::SchedulePauseOnNextStatement(
int context_group_id, const v8_inspector::StringView& reason,
const v8_inspector::StringView& details) { … }
void InspectorIsolateData::CancelPauseOnNextStatement(int context_group_id) { … }
void InspectorIsolateData::AsyncTaskScheduled(
const v8_inspector::StringView& name, void* task, bool recurring) { … }
void InspectorIsolateData::AsyncTaskStarted(void* task) { … }
void InspectorIsolateData::AsyncTaskFinished(void* task) { … }
v8_inspector::V8StackTraceId InspectorIsolateData::StoreCurrentStackTrace(
const v8_inspector::StringView& description) { … }
void InspectorIsolateData::ExternalAsyncTaskStarted(
const v8_inspector::V8StackTraceId& parent) { … }
void InspectorIsolateData::ExternalAsyncTaskFinished(
const v8_inspector::V8StackTraceId& parent) { … }
void InspectorIsolateData::AddInspectedObject(int session_id,
v8::Local<v8::Value> object) { … }
void InspectorIsolateData::SetMaxAsyncTaskStacksForTest(int limit) { … }
void InspectorIsolateData::DumpAsyncTaskStacksStateForTest() { … }
int InspectorIsolateData::HandleMessage(v8::Local<v8::Message> message,
v8::Local<v8::Value> exception) { … }
void InspectorIsolateData::MessageHandler(v8::Local<v8::Message> message,
v8::Local<v8::Value> exception) { … }
void InspectorIsolateData::PromiseRejectHandler(v8::PromiseRejectMessage data) { … }
void InspectorIsolateData::FireContextCreated(v8::Local<v8::Context> context,
int context_group_id,
v8_inspector::StringView name) { … }
void InspectorIsolateData::FireContextDestroyed(
v8::Local<v8::Context> context) { … }
void InspectorIsolateData::FreeContext(v8::Local<v8::Context> context) { … }
std::vector<int> InspectorIsolateData::GetSessionIds(int context_group_id) { … }
bool InspectorIsolateData::isInspectableHeapObject(
v8::Local<v8::Object> object) { … }
v8::Local<v8::Context> InspectorIsolateData::ensureDefaultContextInGroup(
int context_group_id) { … }
void InspectorIsolateData::SetCurrentTimeMS(double time) { … }
double InspectorIsolateData::currentTimeMS() { … }
void InspectorIsolateData::SetMemoryInfo(v8::Local<v8::Value> memory_info) { … }
void InspectorIsolateData::SetLogConsoleApiMessageCalls(bool log) { … }
void InspectorIsolateData::SetLogMaxAsyncCallStackDepthChanged(bool log) { … }
void InspectorIsolateData::SetAdditionalConsoleApi(
v8_inspector::StringView api_script) { … }
v8::MaybeLocal<v8::Value> InspectorIsolateData::memoryInfo(
v8::Isolate* isolate, v8::Local<v8::Context>) { … }
void InspectorIsolateData::runMessageLoopOnPause(int) { … }
void InspectorIsolateData::runIfWaitingForDebugger(int) { … }
void InspectorIsolateData::quitMessageLoopOnPause() { … }
void InspectorIsolateData::installAdditionalCommandLineAPI(
v8::Local<v8::Context> context, v8::Local<v8::Object> object) { … }
void InspectorIsolateData::consoleAPIMessage(
int contextGroupId, v8::Isolate::MessageErrorLevel level,
const v8_inspector::StringView& message,
const v8_inspector::StringView& url, unsigned lineNumber,
unsigned columnNumber, v8_inspector::V8StackTrace* stack) { … }
void InspectorIsolateData::maxAsyncCallStackDepthChanged(int depth) { … }
void InspectorIsolateData::SetResourceNamePrefix(v8::Local<v8::String> prefix) { … }
bool InspectorIsolateData::AssociateExceptionData(
v8::Local<v8::Value> exception, v8::Local<v8::Name> key,
v8::Local<v8::Value> value) { … }
void InspectorIsolateData::WaitForDebugger(int context_group_id) { … }
namespace {
class StringBufferImpl : public v8_inspector::StringBuffer { … };
}
std::unique_ptr<v8_inspector::StringBuffer>
InspectorIsolateData::resourceNameToUrl(
const v8_inspector::StringView& resourceName) { … }
int64_t InspectorIsolateData::generateUniqueId() { … }
void ChannelHolder::AddChannel(int session_id,
std::unique_ptr<FrontendChannelImpl> channel) { … }
FrontendChannelImpl* ChannelHolder::GetChannel(int session_id) { … }
void ChannelHolder::RemoveChannel(int session_id) { … }
std::map<int, std::unique_ptr<FrontendChannelImpl>> ChannelHolder::channels_;
}
}