Commit cd5e88dc authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Worklet: Rename V8WorkerGlobalScopeEventListener to V8WorkerOrWorkletEventListener

This is a follow-up CL for https://chromium-review.googlesource.com/c/759438/

After the CL, V8WorkerGlobalScopeEventListener is used not only for Workers but
also for Worklets.

Bug: 782696
Change-Id: Iece08a78ff0d640aca21e49bf23ecf9623204daa
Reviewed-on: https://chromium-review.googlesource.com/776207Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517312}
parent 6cce3ba9
...@@ -152,8 +152,8 @@ bindings_core_v8_files = ...@@ -152,8 +152,8 @@ bindings_core_v8_files =
"core/v8/V8StringResource.h", "core/v8/V8StringResource.h",
"core/v8/V8V0CustomElementLifecycleCallbacks.cpp", "core/v8/V8V0CustomElementLifecycleCallbacks.cpp",
"core/v8/V8V0CustomElementLifecycleCallbacks.h", "core/v8/V8V0CustomElementLifecycleCallbacks.h",
"core/v8/V8WorkerGlobalScopeEventListener.cpp", "core/v8/V8WorkerOrWorkletEventListener.cpp",
"core/v8/V8WorkerGlobalScopeEventListener.h", "core/v8/V8WorkerOrWorkletEventListener.h",
"core/v8/WindowProxy.cpp", "core/v8/WindowProxy.cpp",
"core/v8/WindowProxy.h", "core/v8/WindowProxy.h",
"core/v8/WindowProxyManager.cpp", "core/v8/WindowProxyManager.cpp",
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "bindings/core/v8/V8ErrorHandler.h" #include "bindings/core/v8/V8ErrorHandler.h"
#include "bindings/core/v8/V8EventListener.h" #include "bindings/core/v8/V8EventListener.h"
#include "bindings/core/v8/V8Window.h" #include "bindings/core/v8/V8Window.h"
#include "bindings/core/v8/V8WorkerGlobalScopeEventListener.h" #include "bindings/core/v8/V8WorkerOrWorkletEventListener.h"
#include "platform/bindings/V8PrivateProperty.h" #include "platform/bindings/V8PrivateProperty.h"
namespace blink { namespace blink {
...@@ -89,7 +89,7 @@ V8EventListener* V8EventListenerHelper::GetEventListener( ...@@ -89,7 +89,7 @@ V8EventListener* V8EventListenerHelper::GetEventListener(
isolate, object, listener_property, lookup, isolate, object, listener_property, lookup,
[object, is_attribute, script_state]() { [object, is_attribute, script_state]() {
return script_state->World().IsWorkerWorld() return script_state->World().IsWorkerWorld()
? V8WorkerGlobalScopeEventListener::Create( ? V8WorkerOrWorkletEventListener::Create(
object, is_attribute, script_state) object, is_attribute, script_state)
: V8EventListener::Create(object, is_attribute, : V8EventListener::Create(object, is_attribute,
script_state); script_state);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "bindings/core/v8/V8WorkerGlobalScopeEventListener.h" #include "bindings/core/v8/V8WorkerOrWorkletEventListener.h"
#include "bindings/core/v8/V8BindingForCore.h" #include "bindings/core/v8/V8BindingForCore.h"
#include "bindings/core/v8/V8Event.h" #include "bindings/core/v8/V8Event.h"
...@@ -44,18 +44,18 @@ ...@@ -44,18 +44,18 @@
namespace blink { namespace blink {
V8WorkerGlobalScopeEventListener::V8WorkerGlobalScopeEventListener( V8WorkerOrWorkletEventListener::V8WorkerOrWorkletEventListener(
bool is_inline, bool is_inline,
ScriptState* script_state) ScriptState* script_state)
: V8EventListener(is_inline, script_state) {} : V8EventListener(is_inline, script_state) {}
void V8WorkerGlobalScopeEventListener::HandleEvent(ScriptState* script_state, void V8WorkerOrWorkletEventListener::HandleEvent(ScriptState* script_state,
Event* event) { Event* event) {
v8::Local<v8::Context> context = script_state->GetContext(); v8::Local<v8::Context> context = script_state->GetContext();
WorkerOrWorkletScriptController* script = WorkerOrWorkletScriptController* script_controller =
ToWorkerOrWorkletGlobalScope(ToExecutionContext(context)) ToWorkerOrWorkletGlobalScope(ToExecutionContext(context))
->ScriptController(); ->ScriptController();
if (!script) if (!script_controller)
return; return;
ScriptState::Scope scope(script_state); ScriptState::Scope scope(script_state);
...@@ -69,7 +69,7 @@ void V8WorkerGlobalScopeEventListener::HandleEvent(ScriptState* script_state, ...@@ -69,7 +69,7 @@ void V8WorkerGlobalScopeEventListener::HandleEvent(ScriptState* script_state,
v8::Local<v8::Value>::New(GetIsolate(), js_event)); v8::Local<v8::Value>::New(GetIsolate(), js_event));
} }
v8::Local<v8::Value> V8WorkerGlobalScopeEventListener::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,
Event* event) { Event* event) {
...@@ -92,7 +92,7 @@ v8::Local<v8::Value> V8WorkerGlobalScopeEventListener::CallListenerFunction( ...@@ -92,7 +92,7 @@ v8::Local<v8::Value> V8WorkerGlobalScopeEventListener::CallListenerFunction(
// FIXME: Remove getReceiverObject(). // FIXME: Remove getReceiverObject().
// This is almost identical to V8AbstractEventListener::getReceiverObject(). // This is almost identical to V8AbstractEventListener::getReceiverObject().
v8::Local<v8::Object> V8WorkerGlobalScopeEventListener::GetReceiverObject( v8::Local<v8::Object> V8WorkerOrWorkletEventListener::GetReceiverObject(
ScriptState* script_state, ScriptState* script_state,
Event* event) { Event* event) {
v8::Local<v8::Object> listener = v8::Local<v8::Object> listener =
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef V8WorkerGlobalScopeEventListener_h #ifndef V8WorkerOrWorkletEventListener_h
#define V8WorkerGlobalScopeEventListener_h #define V8WorkerOrWorkletEventListener_h
#include "bindings/core/v8/V8EventListener.h" #include "bindings/core/v8/V8EventListener.h"
#include "platform/wtf/RefPtr.h" #include "platform/wtf/RefPtr.h"
...@@ -39,16 +39,13 @@ namespace blink { ...@@ -39,16 +39,13 @@ namespace blink {
class Event; class Event;
// TODO(nhiroki): Rename this to V8WorkerOrWorkletGlobalScopeEventListener. class V8WorkerOrWorkletEventListener final : public V8EventListener {
// (https://crbug.com/782696)
class V8WorkerGlobalScopeEventListener final : public V8EventListener {
public: public:
static V8WorkerGlobalScopeEventListener* Create( static V8WorkerOrWorkletEventListener* Create(v8::Local<v8::Object> listener,
v8::Local<v8::Object> listener, bool is_inline,
bool is_inline, ScriptState* script_state) {
ScriptState* script_state) { V8WorkerOrWorkletEventListener* event_listener =
V8WorkerGlobalScopeEventListener* event_listener = new V8WorkerOrWorkletEventListener(is_inline, script_state);
new V8WorkerGlobalScopeEventListener(is_inline, script_state);
event_listener->SetListenerObject(listener); event_listener->SetListenerObject(listener);
return event_listener; return event_listener;
} }
...@@ -56,7 +53,7 @@ class V8WorkerGlobalScopeEventListener final : public V8EventListener { ...@@ -56,7 +53,7 @@ class V8WorkerGlobalScopeEventListener final : public V8EventListener {
void HandleEvent(ScriptState*, Event*) override; void HandleEvent(ScriptState*, Event*) override;
protected: protected:
V8WorkerGlobalScopeEventListener(bool is_inline, ScriptState*); V8WorkerOrWorkletEventListener(bool is_inline, ScriptState*);
private: private:
v8::Local<v8::Value> CallListenerFunction(ScriptState*, v8::Local<v8::Value> CallListenerFunction(ScriptState*,
...@@ -67,4 +64,4 @@ class V8WorkerGlobalScopeEventListener final : public V8EventListener { ...@@ -67,4 +64,4 @@ class V8WorkerGlobalScopeEventListener final : public V8EventListener {
} // namespace blink } // namespace blink
#endif // V8WorkerGlobalScopeEventListener_h #endif // V8WorkerOrWorkletEventListener_h
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