Commit 1633b920 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

Remove pre-finalizer from from Scrollbar.

The pre-finalizer was used to unregister the Scrollbar from the theme.
The only implementation of the UnregisterScrollbar method that did
anything was that of ScrollbarThemeMac, which removed the scrollbar
from a HashSet and a HashMap. Both data-structures actually held
weak members, so the gc can automatically remove the ScrollBar from
the data-structures and the pre-finalizer is not needed.

The method UnregisterScrollbar was only called from the pre-finalizer,
so I removed it as well.

Bug: 981414
Change-Id: Ief15a9df658a12568de9fabdabd2950419835b56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720774Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681731}
parent d2b8afa2
......@@ -72,10 +72,6 @@ class LayoutScrollbarTheme final : public ScrollbarTheme {
return ScrollbarTheme::DeprecatedStaticGetTheme().RegisterScrollbar(
scrollbar);
}
void UnregisterScrollbar(Scrollbar& scrollbar) override {
return ScrollbarTheme::DeprecatedStaticGetTheme().UnregisterScrollbar(
scrollbar);
}
int MinimumThumbLength(const Scrollbar&) override;
......
......@@ -229,14 +229,8 @@ static NSSize abs(NSSize size) {
scrollbar = _scrollableArea->VerticalScrollbar();
// It is possible to have a null scrollbar here since it is possible for this
// delegate
// method to be called between the moment when a scrollbar has been set to 0
// and the
// moment when its destructor has been called. We should probably de-couple
// some
// of the clean-up work in ScrollbarThemeMac::unregisterScrollbar() to avoid
// this
// issue.
// delegate method to be called between the moment when a scrollbar has been
// set to 0 and the moment when its destructor has been called.
if (!scrollbar)
return NSZeroPoint;
......
......@@ -85,10 +85,6 @@ Scrollbar::Scrollbar(ScrollableArea* scrollable_area,
Scrollbar::~Scrollbar() =default;
void Scrollbar::Dispose() {
theme_.UnregisterScrollbar(*this);
}
void Scrollbar::Trace(blink::Visitor* visitor) {
visitor->Trace(scrollable_area_);
visitor->Trace(chrome_client_);
......
......@@ -47,7 +47,6 @@ class WebMouseEvent;
class CORE_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
public DisplayItemClient {
USING_PRE_FINALIZER(Scrollbar, Dispose);
public:
// Theme object ownership remains with the caller and it must outlive the
// scrollbar.
......@@ -190,9 +189,6 @@ class CORE_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>,
CompositorElementId GetElementId();
// Promptly unregister from the theme manager + run finalizers of derived
// Scrollbars.
void Dispose();
virtual void Trace(blink::Visitor*);
protected:
......
......@@ -190,7 +190,6 @@ class CORE_EXPORT ScrollbarTheme {
}
virtual void RegisterScrollbar(Scrollbar&) {}
virtual void UnregisterScrollbar(Scrollbar&) {}
virtual bool IsMockTheme() const { return false; }
......
......@@ -43,7 +43,6 @@ class PLATFORM_EXPORT ScrollbarThemeMac : public ScrollbarTheme {
~ScrollbarThemeMac() override;
void RegisterScrollbar(Scrollbar&) override;
void UnregisterScrollbar(Scrollbar&) override;
bool SupportsControlTints() const override { return true; }
......
......@@ -228,11 +228,6 @@ void ScrollbarThemeMac::RegisterScrollbar(Scrollbar& scrollbar) {
UpdateScrollbarOverlayColorTheme(scrollbar);
}
void ScrollbarThemeMac::UnregisterScrollbar(Scrollbar& scrollbar) {
GetScrollbarPainterMap().erase(&scrollbar);
GetScrollbarSet().erase(&scrollbar);
}
void ScrollbarThemeMac::SetNewPainterForScrollbar(
Scrollbar& scrollbar,
ScrollbarPainter new_painter) {
......
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