Commit 5e6306c0 authored by Keishi Hattori's avatar Keishi Hattori Committed by Commit Bot

Convert Touch* class allocations to MakeGarbageCollected

Converts Touch* class allocations from new to MakeGarbageCollected.

Bug: 757708
Change-Id: I4fe095a494f7bc1756890d03b97b62dd2ed51f8d
Reviewed-on: https://chromium-review.googlesource.com/c/1317077Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605650}
parent 73377647
...@@ -53,15 +53,26 @@ class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { ...@@ -53,15 +53,26 @@ class CORE_EXPORT TouchEvent final : public UIEventWithKeyState {
const AtomicString& type, const AtomicString& type,
AbstractView* view, AbstractView* view,
TouchAction current_touch_action) { TouchAction current_touch_action) {
return new TouchEvent(event, touches, target_touches, changed_touches, type, return MakeGarbageCollected<TouchEvent>(event, touches, target_touches,
view, current_touch_action); changed_touches, type, view,
current_touch_action);
} }
static TouchEvent* Create(const AtomicString& type, static TouchEvent* Create(const AtomicString& type,
const TouchEventInit* initializer) { const TouchEventInit* initializer) {
return new TouchEvent(type, initializer); return MakeGarbageCollected<TouchEvent>(type, initializer);
} }
TouchEvent();
TouchEvent(const WebCoalescedInputEvent&,
TouchList* touches,
TouchList* target_touches,
TouchList* changed_touches,
const AtomicString& type,
AbstractView*,
TouchAction current_touch_action);
TouchEvent(const AtomicString&, const TouchEventInit*);
TouchList* touches() const { return touches_.Get(); } TouchList* touches() const { return touches_.Get(); }
TouchList* targetTouches() const { return target_touches_.Get(); } TouchList* targetTouches() const { return target_touches_.Get(); }
TouchList* changedTouches() const { return changed_touches_.Get(); } TouchList* changedTouches() const { return changed_touches_.Get(); }
...@@ -91,15 +102,6 @@ class CORE_EXPORT TouchEvent final : public UIEventWithKeyState { ...@@ -91,15 +102,6 @@ class CORE_EXPORT TouchEvent final : public UIEventWithKeyState {
void Trace(blink::Visitor*) override; void Trace(blink::Visitor*) override;
private: private:
TouchEvent();
TouchEvent(const WebCoalescedInputEvent&,
TouchList* touches,
TouchList* target_touches,
TouchList* changed_touches,
const AtomicString& type,
AbstractView*,
TouchAction current_touch_action);
TouchEvent(const AtomicString&, const TouchEventInit*);
bool IsTouchStartOrFirstTouchMove() const; bool IsTouchStartOrFirstTouchMove() const;
Member<TouchList> touches_; Member<TouchList> touches_;
......
...@@ -65,7 +65,7 @@ Element* GetPointerLockedElement(LocalFrame* frame) { ...@@ -65,7 +65,7 @@ Element* GetPointerLockedElement(LocalFrame* frame) {
PointerEventManager::PointerEventManager(LocalFrame& frame, PointerEventManager::PointerEventManager(LocalFrame& frame,
MouseEventManager& mouse_event_manager) MouseEventManager& mouse_event_manager)
: frame_(frame), : frame_(frame),
touch_event_manager_(new TouchEventManager(frame)), touch_event_manager_(MakeGarbageCollected<TouchEventManager>(frame)),
mouse_event_manager_(mouse_event_manager) { mouse_event_manager_(mouse_event_manager) {
Clear(); Clear();
} }
......
...@@ -112,9 +112,9 @@ Touch::Touch(LocalFrame* frame, const TouchInit* initializer) ...@@ -112,9 +112,9 @@ Touch::Touch(LocalFrame* frame, const TouchInit* initializer)
absolute_location_(PageToAbsolute(frame, page_pos_)) {} absolute_location_(PageToAbsolute(frame, page_pos_)) {}
Touch* Touch::CloneWithNewTarget(EventTarget* event_target) const { Touch* Touch::CloneWithNewTarget(EventTarget* event_target) const {
return new Touch(event_target, identifier_, client_pos_, screen_pos_, return MakeGarbageCollected<Touch>(
page_pos_, radius_, rotation_angle_, force_, region_, event_target, identifier_, client_pos_, screen_pos_, page_pos_, radius_,
absolute_location_); rotation_angle_, force_, region_, absolute_location_);
} }
void Touch::Trace(blink::Visitor* visitor) { void Touch::Trace(blink::Visitor* visitor) {
......
...@@ -53,37 +53,15 @@ class CORE_EXPORT Touch final : public ScriptWrappable { ...@@ -53,37 +53,15 @@ class CORE_EXPORT Touch final : public ScriptWrappable {
float rotation_angle, float rotation_angle,
float force, float force,
String region) { String region) {
return new Touch(frame, target, identifier, screen_pos, page_pos, radius, return MakeGarbageCollected<Touch>(frame, target, identifier, screen_pos,
rotation_angle, force, region); 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 new Touch(document.GetFrame(), initializer); return MakeGarbageCollected<Touch>(document.GetFrame(), initializer);
} }
// DOM Touch implementation
EventTarget* target() const { return target_.Get(); }
int identifier() const { return identifier_; }
double clientX() const { return client_pos_.X(); }
double clientY() const { return client_pos_.Y(); }
double screenX() const { return screen_pos_.X(); }
double screenY() const { return screen_pos_.Y(); }
double pageX() const { return page_pos_.X(); }
double pageY() const { return page_pos_.Y(); }
float radiusX() const { return radius_.Width(); }
float radiusY() const { return radius_.Height(); }
float rotationAngle() const { return rotation_angle_; }
float force() const { return force_; }
const String& region() const { return region_; }
// Blink-internal methods
const LayoutPoint& AbsoluteLocation() const { return absolute_location_; }
const FloatPoint& ScreenLocation() const { return screen_pos_; }
Touch* CloneWithNewTarget(EventTarget*) const;
void Trace(blink::Visitor*) override;
private:
Touch(LocalFrame*, Touch(LocalFrame*,
EventTarget*, EventTarget*,
int identifier, int identifier,
...@@ -107,6 +85,29 @@ class CORE_EXPORT Touch final : public ScriptWrappable { ...@@ -107,6 +85,29 @@ class CORE_EXPORT Touch final : public ScriptWrappable {
Touch(LocalFrame*, const TouchInit*); Touch(LocalFrame*, const TouchInit*);
// DOM Touch implementation
EventTarget* target() const { return target_.Get(); }
int identifier() const { return identifier_; }
double clientX() const { return client_pos_.X(); }
double clientY() const { return client_pos_.Y(); }
double screenX() const { return screen_pos_.X(); }
double screenY() const { return screen_pos_.Y(); }
double pageX() const { return page_pos_.X(); }
double pageY() const { return page_pos_.Y(); }
float radiusX() const { return radius_.Width(); }
float radiusY() const { return radius_.Height(); }
float rotationAngle() const { return rotation_angle_; }
float force() const { return force_; }
const String& region() const { return region_; }
// Blink-internal methods
const LayoutPoint& AbsoluteLocation() const { return absolute_location_; }
const FloatPoint& ScreenLocation() const { return screen_pos_; }
Touch* CloneWithNewTarget(EventTarget*) const;
void Trace(blink::Visitor*) override;
private:
Member<EventTarget> target_; Member<EventTarget> target_;
int identifier_; int identifier_;
// Position relative to the viewport in CSS px. // Position relative to the viewport in CSS px.
......
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