[inspector] Name callback functions more descriptively

Change-Id: I37e241d9c62f1a7fed438ee8717f02f5b4f51bea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2253846
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68435}
This commit is contained in:
Peter Marshall 2020-06-19 12:33:38 +02:00 committed by Commit Bot
parent 9f60cf6831
commit a7b3d8f95d

View File

@ -111,10 +111,11 @@ std::vector<uint16_t> ToVector(const v8_inspector::StringView& string) {
class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
public:
FrontendChannelImpl(TaskRunner* task_runner, int context_group_id,
v8::Isolate* isolate, v8::Local<v8::Function> function)
v8::Isolate* isolate,
v8::Local<v8::Function> dispatch_message_callback)
: task_runner_(task_runner),
context_group_id_(context_group_id),
function_(isolate, function) {}
dispatch_message_callback_(isolate, dispatch_message_callback) {}
~FrontendChannelImpl() override = default;
void set_session_id(int session_id) { session_id_ = session_id; }
@ -151,7 +152,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
v8::Context::Scope context_scope(context);
v8::Local<v8::Value> message = ToV8String(data->isolate(), message_);
v8::MaybeLocal<v8::Value> result;
result = channel_->function_.Get(data->isolate())
result = channel_->dispatch_message_callback_.Get(data->isolate())
->Call(context, context->Global(), 1, &message);
}
FrontendChannelImpl* channel_;
@ -160,7 +161,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
TaskRunner* task_runner_;
int context_group_id_;
v8::Global<v8::Function> function_;
v8::Global<v8::Function> dispatch_message_callback_;
int session_id_;
DISALLOW_COPY_AND_ASSIGN(FrontendChannelImpl);
};
@ -636,8 +637,8 @@ std::map<int, std::unique_ptr<FrontendChannelImpl>> UtilsExtension::channels_;
class SetTimeoutTask : public TaskRunner::Task {
public:
SetTimeoutTask(int context_group_id, v8::Isolate* isolate,
v8::Local<v8::Function> function)
: function_(isolate, function), context_group_id_(context_group_id) {}
v8::Local<v8::Function> callback)
: callback_(isolate, callback), context_group_id_(context_group_id) {}
~SetTimeoutTask() override = default;
bool is_priority_task() final { return false; }
@ -649,12 +650,12 @@ class SetTimeoutTask : public TaskRunner::Task {
v8::Local<v8::Context> context = data->GetContext(context_group_id_);
v8::Context::Scope context_scope(context);
v8::Local<v8::Function> function = function_.Get(data->isolate());
v8::Local<v8::Function> callback = callback_.Get(data->isolate());
v8::MaybeLocal<v8::Value> result;
result = function->Call(context, context->Global(), 0, nullptr);
result = callback->Call(context, context->Global(), 0, nullptr);
}
v8::Global<v8::Function> function_;
v8::Global<v8::Function> callback_;
int context_group_id_;
};