Commit 19a302c3 authored by Yuki Yamada's avatar Yuki Yamada Committed by Commit Bot

Removed V8WorkerOrWorkletEventListener::HandleEvent()

Removed V8WorkerOrWorkletEventListener::HandleEvent() in order to
remove blink::V8WorkerOrWorkletEventListener.
The difference between V8AbstractEventListener::HandleEvent() and
V8WorkerOrWorkletEventListener::HandleEvent() was checking if script
controller is available or not. This should be done in not only
V8WorkerOrWorkletEventListener but also other event listeners, so this
CL added this operation by checking ScriptState::ContextIsValid().

Bug: 869778
Change-Id: I3168f9990d2c6d076061b4d7d8f9ab85619f71d5
Reviewed-on: https://chromium-review.googlesource.com/1160069Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Yuki Yamada <yukiy@google.com>
Cr-Commit-Position: refs/heads/master@{#580808}
parent 21453c7b
...@@ -114,6 +114,9 @@ void V8AbstractEventListener::handleEvent(ExecutionContext* execution_context, ...@@ -114,6 +114,9 @@ void V8AbstractEventListener::handleEvent(ExecutionContext* execution_context,
void V8AbstractEventListener::HandleEvent(ScriptState* script_state, void V8AbstractEventListener::HandleEvent(ScriptState* script_state,
Event* event) { Event* event) {
if (!script_state->ContextIsValid())
return;
ScriptState::Scope scope(script_state); ScriptState::Scope scope(script_state);
// Get the V8 wrapper for the event object. // Get the V8 wrapper for the event object.
......
...@@ -49,26 +49,6 @@ V8WorkerOrWorkletEventListener::V8WorkerOrWorkletEventListener( ...@@ -49,26 +49,6 @@ V8WorkerOrWorkletEventListener::V8WorkerOrWorkletEventListener(
ScriptState* script_state) ScriptState* script_state)
: V8EventListener(is_inline, script_state) {} : V8EventListener(is_inline, script_state) {}
void V8WorkerOrWorkletEventListener::HandleEvent(ScriptState* script_state,
Event* event) {
v8::Local<v8::Context> context = script_state->GetContext();
WorkerOrWorkletScriptController* script_controller =
ToWorkerOrWorkletGlobalScope(ToExecutionContext(context))
->ScriptController();
if (!script_controller)
return;
ScriptState::Scope scope(script_state);
// Get the V8 wrapper for the event object.
v8::Local<v8::Value> js_event = ToV8(event, context->Global(), GetIsolate());
if (js_event.IsEmpty())
return;
InvokeEventHandler(script_state, event,
v8::Local<v8::Value>::New(GetIsolate(), js_event));
}
v8::Local<v8::Value> V8WorkerOrWorkletEventListener::CallListenerFunction( v8::Local<v8::Value> V8WorkerOrWorkletEventListener::CallListenerFunction(
ScriptState* script_state, ScriptState* script_state,
v8::Local<v8::Value> js_event, v8::Local<v8::Value> js_event,
......
...@@ -52,8 +52,6 @@ class V8WorkerOrWorkletEventListener final : public V8EventListener { ...@@ -52,8 +52,6 @@ class V8WorkerOrWorkletEventListener final : public V8EventListener {
return event_listener; return event_listener;
} }
void HandleEvent(ScriptState*, Event*) override;
protected: protected:
V8WorkerOrWorkletEventListener(bool is_inline, ScriptState*); V8WorkerOrWorkletEventListener(bool is_inline, ScriptState*);
......
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