Commit 8a6f6297 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Inline static Create() factory functions renderer/core/input

This CL removes Create() factory functions in
//third_partyb/blink/renderer/core/input as much as possible, and
makes all callers use MakeGarbageCollected<Foo> instead.

Bug: 939691
Change-Id: I8d392effb5089f4a7025e38c5c83061652d2a9fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1942890Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#720298}
parent 48195878
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/events/touch_event.h" #include "third_party/blink/renderer/core/events/touch_event.h"
#include "third_party/blink/renderer/core/input/touch_list.h" #include "third_party/blink/renderer/core/input/touch_list.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink { namespace blink {
...@@ -37,9 +38,9 @@ TouchEventContext* TouchEventContext::Create() { ...@@ -37,9 +38,9 @@ TouchEventContext* TouchEventContext::Create() {
} }
TouchEventContext::TouchEventContext() TouchEventContext::TouchEventContext()
: touches_(TouchList::Create()), : touches_(MakeGarbageCollected<TouchList>()),
target_touches_(TouchList::Create()), target_touches_(MakeGarbageCollected<TouchList>()),
changed_touches_(TouchList::Create()) {} changed_touches_(MakeGarbageCollected<TouchList>()) {}
void TouchEventContext::HandleLocalEvents(Event& event) const { void TouchEventContext::HandleLocalEvents(Event& event) const {
DCHECK(event.IsTouchEvent()); DCHECK(event.IsTouchEvent());
......
...@@ -44,20 +44,6 @@ class CORE_EXPORT Touch final : public ScriptWrappable { ...@@ -44,20 +44,6 @@ class CORE_EXPORT Touch final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
static Touch* Create(LocalFrame* frame,
EventTarget* target,
int identifier,
const FloatPoint& screen_pos,
const FloatPoint& page_pos,
const FloatSize& radius,
float rotation_angle,
float force,
String region) {
return MakeGarbageCollected<Touch>(frame, target, identifier, screen_pos,
page_pos, radius, rotation_angle, force,
region);
}
static Touch* Create(const Document& document, const TouchInit* initializer) { static Touch* Create(const Document& document, const TouchInit* initializer) {
return MakeGarbageCollected<Touch>(document.GetFrame(), initializer); return MakeGarbageCollected<Touch>(document.GetFrame(), initializer);
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "third_party/blink/renderer/core/layout/hit_test_canvas_result.h" #include "third_party/blink/renderer/core/layout/hit_test_canvas_result.h"
#include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
...@@ -394,7 +395,7 @@ TouchEventManager::DispatchTouchEventFromAccumulatdTouchPoints() { ...@@ -394,7 +395,7 @@ TouchEventManager::DispatchTouchEventFromAccumulatdTouchPoints() {
} }
// Holds the complete set of touches on the screen. // Holds the complete set of touches on the screen.
TouchList* touches = TouchList::Create(); auto* touches = MakeGarbageCollected<TouchList>();
// A different view on the 'touches' list above, filtered and grouped by // A different view on the 'touches' list above, filtered and grouped by
// event target. Used for the |targetTouches| list in the JS event. // event target. Used for the |targetTouches| list in the JS event.
...@@ -422,7 +423,7 @@ TouchEventManager::DispatchTouchEventFromAccumulatdTouchPoints() { ...@@ -422,7 +423,7 @@ TouchEventManager::DispatchTouchEventFromAccumulatdTouchPoints() {
TargetTouchesHeapMap::iterator target_touches_iterator = TargetTouchesHeapMap::iterator target_touches_iterator =
touches_by_target.find(touch_target); touches_by_target.find(touch_target);
if (target_touches_iterator == touches_by_target.end()) { if (target_touches_iterator == touches_by_target.end()) {
touches_by_target.Set(touch_target, TouchList::Create()); touches_by_target.Set(touch_target, MakeGarbageCollected<TouchList>());
target_touches_iterator = touches_by_target.find(touch_target); target_touches_iterator = touches_by_target.find(touch_target);
} }
...@@ -443,8 +444,10 @@ TouchEventManager::DispatchTouchEventFromAccumulatdTouchPoints() { ...@@ -443,8 +444,10 @@ TouchEventManager::DispatchTouchEventFromAccumulatdTouchPoints() {
// for further discussion about the TouchStationary state. // for further discussion about the TouchStationary state.
if (!touch_point_attribute->stale_ && known_target) { if (!touch_point_attribute->stale_ && known_target) {
size_t event_type_idx = event_type - WebInputEvent::kPointerTypeFirst; size_t event_type_idx = event_type - WebInputEvent::kPointerTypeFirst;
if (!changed_touches[event_type_idx].touches_) if (!changed_touches[event_type_idx].touches_) {
changed_touches[event_type_idx].touches_ = TouchList::Create(); changed_touches[event_type_idx].touches_ =
MakeGarbageCollected<TouchList>();
}
changed_touches[event_type_idx].touches_->Append(touch); changed_touches[event_type_idx].touches_->Append(touch);
changed_touches[event_type_idx].targets_.insert(touch_target); changed_touches[event_type_idx].targets_.insert(touch_target);
} }
......
...@@ -38,8 +38,6 @@ class CORE_EXPORT TouchList final : public ScriptWrappable { ...@@ -38,8 +38,6 @@ class CORE_EXPORT TouchList final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO(); DEFINE_WRAPPERTYPEINFO();
public: public:
static TouchList* Create() { return MakeGarbageCollected<TouchList>(); }
static TouchList* Create(const HeapVector<Member<Touch>>& touches) { static TouchList* Create(const HeapVector<Member<Touch>>& touches) {
TouchList* list = MakeGarbageCollected<TouchList>(); TouchList* list = MakeGarbageCollected<TouchList>();
list->values_.AppendVector(touches); list->values_.AppendVector(touches);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "third_party/blink/renderer/core/loader/empty_clients.h" #include "third_party/blink/renderer/core/loader/empty_clients.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h" #include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
...@@ -131,13 +132,13 @@ class MediaControlsDisplayCutoutDelegateTest ...@@ -131,13 +132,13 @@ class MediaControlsDisplayCutoutDelegateTest
} }
TouchList* CreateTouchListWithOnePoint(int x, int y) { TouchList* CreateTouchListWithOnePoint(int x, int y) {
TouchList* list = TouchList::Create(); auto* list = MakeGarbageCollected<TouchList>();
list->Append(CreateTouchAtPoint(x, y)); list->Append(CreateTouchAtPoint(x, y));
return list; return list;
} }
TouchList* CreateTouchListWithTwoPoints(int x1, int y1, int x2, int y2) { TouchList* CreateTouchListWithTwoPoints(int x1, int y1, int x2, int y2) {
TouchList* list = TouchList::Create(); auto* list = MakeGarbageCollected<TouchList>();
list->Append(CreateTouchAtPoint(x1, y1)); list->Append(CreateTouchAtPoint(x1, y1));
list->Append(CreateTouchAtPoint(x2, y2)); list->Append(CreateTouchAtPoint(x2, y2));
return list; return list;
...@@ -152,9 +153,9 @@ class MediaControlsDisplayCutoutDelegateTest ...@@ -152,9 +153,9 @@ class MediaControlsDisplayCutoutDelegateTest
} }
Touch* CreateTouchAtPoint(int x, int y) { Touch* CreateTouchAtPoint(int x, int y) {
return Touch::Create(GetDocument().GetFrame(), &GetVideoElement(), return MakeGarbageCollected<Touch>(
1 /* identifier */, FloatPoint(x, y), FloatPoint(x, y), GetDocument().GetFrame(), &GetVideoElement(), 1 /* identifier */,
FloatSize(1, 1), 90, 0, "test"); FloatPoint(x, y), FloatPoint(x, y), FloatSize(1, 1), 90, 0, "test");
} }
mojom::ViewportFit CurrentViewportFit() const { mojom::ViewportFit CurrentViewportFit() const {
......
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