Commit 77facfa7 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Inline static Create() factory functions from renderer/core/page

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

Bug: 939691
Change-Id: I89d73850a0d6e5a7937ede262c166e317e63b253
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1942674Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#720367}
parent 7a1d56b0
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" #include "third_party/blink/renderer/core/scroll/scroll_animator_base.h"
#include "third_party/blink/renderer/core/scroll/scroll_customization.h" #include "third_party/blink/renderer/core/scroll/scroll_customization.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/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
...@@ -260,7 +261,8 @@ bool ScrollManager::LogicalScroll(ScrollDirection direction, ...@@ -260,7 +261,8 @@ bool ScrollManager::LogicalScroll(ScrollDirection direction,
Deque<DOMNodeId> scroll_chain; Deque<DOMNodeId> scroll_chain;
std::unique_ptr<ScrollStateData> scroll_state_data = std::unique_ptr<ScrollStateData> scroll_state_data =
std::make_unique<ScrollStateData>(); std::make_unique<ScrollStateData>();
ScrollState* scroll_state = ScrollState::Create(std::move(scroll_state_data)); auto* scroll_state =
MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
RecomputeScrollChain(*node, *scroll_state, scroll_chain); RecomputeScrollChain(*node, *scroll_state, scroll_chain);
while (!scroll_chain.IsEmpty()) { while (!scroll_chain.IsEmpty()) {
...@@ -472,7 +474,8 @@ WebInputEventResult ScrollManager::HandleGestureScrollBegin( ...@@ -472,7 +474,8 @@ WebInputEventResult ScrollManager::HandleGestureScrollBegin(
gesture_event.SourceDevice() == WebGestureDevice::kTouchscreen; gesture_event.SourceDevice() == WebGestureDevice::kTouchscreen;
scroll_state_data->delta_consumed_for_scroll_sequence = scroll_state_data->delta_consumed_for_scroll_sequence =
delta_consumed_for_scroll_sequence_; delta_consumed_for_scroll_sequence_;
ScrollState* scroll_state = ScrollState::Create(std::move(scroll_state_data)); auto* scroll_state =
MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
// For middle click autoscroll, only scrollable area for // For middle click autoscroll, only scrollable area for
// |scroll_gesture_handling_node_| should receive and handle all scroll // |scroll_gesture_handling_node_| should receive and handle all scroll
// events. It should not bubble up to the ancestor. // events. It should not bubble up to the ancestor.
...@@ -600,7 +603,8 @@ WebInputEventResult ScrollManager::HandleGestureScrollUpdate( ...@@ -600,7 +603,8 @@ WebInputEventResult ScrollManager::HandleGestureScrollUpdate(
scroll_state_data->from_user_input = true; scroll_state_data->from_user_input = true;
scroll_state_data->delta_consumed_for_scroll_sequence = scroll_state_data->delta_consumed_for_scroll_sequence =
delta_consumed_for_scroll_sequence_; delta_consumed_for_scroll_sequence_;
ScrollState* scroll_state = ScrollState::Create(std::move(scroll_state_data)); auto* scroll_state =
MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
if (previous_gesture_scrolled_node_) { if (previous_gesture_scrolled_node_) {
// The ScrollState needs to know what the current // The ScrollState needs to know what the current
// native scrolling element is, so that for an // native scrolling element is, so that for an
...@@ -689,8 +693,8 @@ WebInputEventResult ScrollManager::HandleGestureScrollEnd( ...@@ -689,8 +693,8 @@ WebInputEventResult ScrollManager::HandleGestureScrollEnd(
gesture_event.SourceDevice() == WebGestureDevice::kTouchscreen; gesture_event.SourceDevice() == WebGestureDevice::kTouchscreen;
scroll_state_data->delta_consumed_for_scroll_sequence = scroll_state_data->delta_consumed_for_scroll_sequence =
delta_consumed_for_scroll_sequence_; delta_consumed_for_scroll_sequence_;
ScrollState* scroll_state = auto* scroll_state =
ScrollState::Create(std::move(scroll_state_data)); MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
CustomizedScroll(*scroll_state); CustomizedScroll(*scroll_state);
// We add a callback to set the hover state dirty and send a scroll end // We add a callback to set the hover state dirty and send a scroll end
...@@ -816,7 +820,8 @@ gfx::Vector2dF ScrollManager::ScrollByForSnapFling( ...@@ -816,7 +820,8 @@ gfx::Vector2dF ScrollManager::ScrollByForSnapFling(
static_cast<double>(ScrollGranularity::kScrollByPrecisePixel); static_cast<double>(ScrollGranularity::kScrollByPrecisePixel);
scroll_state_data->delta_consumed_for_scroll_sequence = scroll_state_data->delta_consumed_for_scroll_sequence =
delta_consumed_for_scroll_sequence_; delta_consumed_for_scroll_sequence_;
ScrollState* scroll_state = ScrollState::Create(std::move(scroll_state_data)); auto* scroll_state =
MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
scroll_state->SetCurrentNativeScrollingNode(previous_gesture_scrolled_node_); scroll_state->SetCurrentNativeScrollingNode(previous_gesture_scrolled_node_);
CustomizedScroll(*scroll_state); CustomizedScroll(*scroll_state);
...@@ -843,7 +848,8 @@ void ScrollManager::ScrollEndForSnapFling() { ...@@ -843,7 +848,8 @@ void ScrollManager::ScrollEndForSnapFling() {
scroll_state_data->from_user_input = true; scroll_state_data->from_user_input = true;
scroll_state_data->delta_consumed_for_scroll_sequence = scroll_state_data->delta_consumed_for_scroll_sequence =
delta_consumed_for_scroll_sequence_; delta_consumed_for_scroll_sequence_;
ScrollState* scroll_state = ScrollState::Create(std::move(scroll_state_data)); auto* scroll_state =
MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
CustomizedScroll(*scroll_state); CustomizedScroll(*scroll_state);
NotifyScrollPhaseEndForCustomizedScroll(); NotifyScrollPhaseEndForCustomizedScroll();
ClearGestureScrollState(); ClearGestureScrollState();
......
...@@ -161,10 +161,6 @@ ChromeClientImpl::~ChromeClientImpl() { ...@@ -161,10 +161,6 @@ ChromeClientImpl::~ChromeClientImpl() {
DCHECK(file_chooser_queue_.IsEmpty()); DCHECK(file_chooser_queue_.IsEmpty());
} }
ChromeClientImpl* ChromeClientImpl::Create(WebViewImpl* web_view) {
return MakeGarbageCollected<ChromeClientImpl>(web_view);
}
void ChromeClientImpl::Trace(Visitor* visitor) { void ChromeClientImpl::Trace(Visitor* visitor) {
visitor->Trace(popup_opening_observers_); visitor->Trace(popup_opening_observers_);
visitor->Trace(external_date_time_chooser_); visitor->Trace(external_date_time_chooser_);
......
...@@ -52,7 +52,6 @@ struct WebCursorInfo; ...@@ -52,7 +52,6 @@ struct WebCursorInfo;
// Handles window-level notifications from core on behalf of a WebView. // Handles window-level notifications from core on behalf of a WebView.
class CORE_EXPORT ChromeClientImpl final : public ChromeClient { class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
public: public:
static ChromeClientImpl* Create(WebViewImpl*);
explicit ChromeClientImpl(WebViewImpl*); explicit ChromeClientImpl(WebViewImpl*);
~ChromeClientImpl() override; ~ChromeClientImpl() override;
void Trace(Visitor* visitor) override; void Trace(Visitor* visitor) override;
......
...@@ -42,12 +42,6 @@ ScrollState* ScrollState::Create(ScrollStateInit* init) { ...@@ -42,12 +42,6 @@ ScrollState* ScrollState::Create(ScrollStateInit* init) {
return scroll_state; return scroll_state;
} }
ScrollState* ScrollState::Create(std::unique_ptr<ScrollStateData> data) {
ScrollState* scroll_state =
MakeGarbageCollected<ScrollState>(std::move(data));
return scroll_state;
}
ScrollState::ScrollState(std::unique_ptr<ScrollStateData> data) ScrollState::ScrollState(std::unique_ptr<ScrollStateData> data)
: data_(std::move(data)) {} : data_(std::move(data)) {}
......
...@@ -23,7 +23,6 @@ class CORE_EXPORT ScrollState final : public ScriptWrappable { ...@@ -23,7 +23,6 @@ class CORE_EXPORT ScrollState final : public ScriptWrappable {
public: public:
static ScrollState* Create(ScrollStateInit*); static ScrollState* Create(ScrollStateInit*);
static ScrollState* Create(std::unique_ptr<ScrollStateData>);
explicit ScrollState(std::unique_ptr<ScrollStateData>); explicit ScrollState(std::unique_ptr<ScrollStateData>);
~ScrollState() override = default; ~ScrollState() override = default;
......
...@@ -24,7 +24,7 @@ ScrollState* CreateScrollState(double delta_x, ...@@ -24,7 +24,7 @@ ScrollState* CreateScrollState(double delta_x,
scroll_state_data->delta_y = delta_y; scroll_state_data->delta_y = delta_y;
scroll_state_data->is_beginning = beginning; scroll_state_data->is_beginning = beginning;
scroll_state_data->is_ending = ending; scroll_state_data->is_ending = ending;
return ScrollState::Create(std::move(scroll_state_data)); return MakeGarbageCollected<ScrollState>(std::move(scroll_state_data));
} }
class ScrollStateTest : public testing::Test {}; class ScrollStateTest : public testing::Test {};
......
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