Commit e821cc7a authored by Samuel Groß's avatar Samuel Groß Committed by V8 LUCI CQ

Fix name collision of v8::internal::IsolateData

The v8::internal::IsolateData class in test/inspector/isolate-data.h
collides with v8::internal::IsolateData defined in
src/execution/isolate-data.h. In some circumstances, this can lead to
compilation or runtime issues. To fix that, this CL renames the class in
test/inspector to InspectorIsolateData.

Change-Id: I4b62b2a9d141169480c5a0591c1bcb2f275f87f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3116248Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76481}
parent ef84e57e
This diff is collapsed.
......@@ -55,7 +55,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
bool is_priority_task() final { return false; }
private:
void Run(IsolateData* data) override {
void Run(InspectorIsolateData* data) override {
v8::MicrotasksScope microtasks_scope(data->isolate(),
v8::MicrotasksScope::kRunMicrotasks);
v8::HandleScope handle_scope(data->isolate());
......
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,7 @@ class TaskRunner;
enum WithInspector : bool { kWithInspector = true, kNoInspector = false };
class IsolateData : public v8_inspector::V8InspectorClient {
class InspectorIsolateData : public v8_inspector::V8InspectorClient {
public:
class SetupGlobalTask {
public:
......@@ -40,14 +40,16 @@ class IsolateData : public v8_inspector::V8InspectorClient {
};
using SetupGlobalTasks = std::vector<std::unique_ptr<SetupGlobalTask>>;
IsolateData(const IsolateData&) = delete;
IsolateData& operator=(const IsolateData&) = delete;
IsolateData(TaskRunner* task_runner, SetupGlobalTasks setup_global_tasks,
v8::StartupData* startup_data, WithInspector with_inspector);
static IsolateData* FromContext(v8::Local<v8::Context> context);
InspectorIsolateData(const InspectorIsolateData&) = delete;
InspectorIsolateData& operator=(const InspectorIsolateData&) = delete;
InspectorIsolateData(TaskRunner* task_runner,
SetupGlobalTasks setup_global_tasks,
v8::StartupData* startup_data,
WithInspector with_inspector);
static InspectorIsolateData* FromContext(v8::Local<v8::Context> context);
~IsolateData() override {
// Enter the isolate before destructing this IsolateData, so that
~InspectorIsolateData() override {
// Enter the isolate before destructing this InspectorIsolateData, so that
// destructors that run before the Isolate's destructor still see it as
// entered.
isolate()->Enter();
......@@ -149,7 +151,7 @@ class IsolateData : public v8_inspector::V8InspectorClient {
// disposed in the right order, relative to other member variables.
struct IsolateDeleter {
void operator()(v8::Isolate* isolate) const {
// Exit the isolate after it was entered by ~IsolateData.
// Exit the isolate after it was entered by ~InspectorIsolateData.
isolate->Exit();
isolate->Dispose();
}
......
......@@ -38,11 +38,10 @@ void ReportUncaughtException(v8::Isolate* isolate,
} // namespace
TaskRunner::TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks,
CatchExceptions catch_exceptions,
v8::base::Semaphore* ready_semaphore,
v8::StartupData* startup_data,
WithInspector with_inspector)
TaskRunner::TaskRunner(
InspectorIsolateData::SetupGlobalTasks setup_global_tasks,
CatchExceptions catch_exceptions, v8::base::Semaphore* ready_semaphore,
v8::StartupData* startup_data, WithInspector with_inspector)
: Thread(Options("Task Runner")),
setup_global_tasks_(std::move(setup_global_tasks)),
startup_data_(startup_data),
......@@ -59,8 +58,8 @@ TaskRunner::TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks,
TaskRunner::~TaskRunner() {}
void TaskRunner::Run() {
data_.reset(new IsolateData(this, std::move(setup_global_tasks_),
startup_data_, with_inspector_));
data_.reset(new InspectorIsolateData(this, std::move(setup_global_tasks_),
startup_data_, with_inspector_));
if (ready_semaphore_) ready_semaphore_->Signal();
RunMessageLoop(false);
}
......
......@@ -34,17 +34,17 @@ class TaskRunner : public v8::base::Thread {
public:
virtual ~Task() = default;
virtual bool is_priority_task() = 0;
virtual void Run(IsolateData* data) = 0;
virtual void Run(InspectorIsolateData* data) = 0;
};
TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks,
TaskRunner(InspectorIsolateData::SetupGlobalTasks setup_global_tasks,
CatchExceptions catch_exceptions,
v8::base::Semaphore* ready_semaphore,
v8::StartupData* startup_data, WithInspector with_inspector);
~TaskRunner() override;
TaskRunner(const TaskRunner&) = delete;
TaskRunner& operator=(const TaskRunner&) = delete;
IsolateData* data() const { return data_.get(); }
InspectorIsolateData* data() const { return data_.get(); }
// Thread implementation.
void Run() override;
......@@ -61,12 +61,12 @@ class TaskRunner : public v8::base::Thread {
std::unique_ptr<Task> GetNext(bool only_protocol);
v8::Isolate* isolate() const { return data_->isolate(); }
IsolateData::SetupGlobalTasks setup_global_tasks_;
InspectorIsolateData::SetupGlobalTasks setup_global_tasks_;
v8::StartupData* startup_data_;
WithInspector with_inspector_;
CatchExceptions catch_exceptions_;
v8::base::Semaphore* ready_semaphore_;
std::unique_ptr<IsolateData> data_;
std::unique_ptr<InspectorIsolateData> data_;
// deferred_queue_ combined with queue_ (in this order) have all tasks in the
// correct order. Sometimes we skip non-protocol tasks by moving them from
......
......@@ -14,7 +14,7 @@
namespace v8 {
namespace internal {
void ExecuteStringTask::Run(IsolateData* data) {
void ExecuteStringTask::Run(InspectorIsolateData* data) {
v8::MicrotasksScope microtasks_scope(data->isolate(),
v8::MicrotasksScope::kRunMicrotasks);
v8::HandleScope handle_scope(data->isolate());
......
......@@ -30,7 +30,7 @@ void RunSyncTask(TaskRunner* task_runner, T callback) {
bool is_priority_task() final { return true; }
private:
void Run(IsolateData* data) override {
void Run(InspectorIsolateData* data) override {
callback_(data);
if (ready_semaphore_) ready_semaphore_->Signal();
}
......@@ -51,7 +51,7 @@ class SendMessageToBackendTask : public TaskRunner::Task {
bool is_priority_task() final { return true; }
private:
void Run(IsolateData* data) override {
void Run(InspectorIsolateData* data) override {
v8_inspector::StringView message_view(message_.data(), message_.size());
data->SendMessage(session_id_, message_view);
}
......@@ -71,7 +71,7 @@ inline void RunAsyncTask(TaskRunner* task_runner,
AsyncTask(const AsyncTask&) = delete;
AsyncTask& operator=(const AsyncTask&) = delete;
bool is_priority_task() override { return inner_->is_priority_task(); }
void Run(IsolateData* data) override {
void Run(InspectorIsolateData* data) override {
data->AsyncTaskStarted(inner_.get());
inner_->Run(data);
data->AsyncTaskFinished(inner_.get());
......@@ -107,7 +107,7 @@ class ExecuteStringTask : public TaskRunner::Task {
ExecuteStringTask(const ExecuteStringTask&) = delete;
ExecuteStringTask& operator=(const ExecuteStringTask&) = delete;
bool is_priority_task() override { return false; }
void Run(IsolateData* data) override;
void Run(InspectorIsolateData* data) override;
private:
std::vector<uint16_t> expression_;
......@@ -128,7 +128,7 @@ class SetTimeoutTask : public TaskRunner::Task {
bool is_priority_task() final { return false; }
private:
void Run(IsolateData* data) override {
void Run(InspectorIsolateData* data) override {
v8::MicrotasksScope microtasks_scope(data->isolate(),
v8::MicrotasksScope::kRunMicrotasks);
v8::HandleScope handle_scope(data->isolate());
......@@ -144,7 +144,7 @@ class SetTimeoutTask : public TaskRunner::Task {
int context_group_id_;
};
class SetTimeoutExtension : public IsolateData::SetupGlobalTask {
class SetTimeoutExtension : public InspectorIsolateData::SetupGlobalTask {
public:
void Run(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> global) override {
......@@ -162,7 +162,7 @@ class SetTimeoutExtension : public IsolateData::SetupGlobalTask {
}
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
InspectorIsolateData* data = InspectorIsolateData::FromContext(context);
int context_group_id = data->GetContextGroupId(context);
const char* task_name = "setTimeout";
v8_inspector::StringView task_name_view(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment