Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2613)

Unified Diff: Source/platform/scroll/Scrollbar.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch LocalFrame::m_pluginElements rep to HashSet<HTMLPlugInElement*> Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/platform/scroll/Scrollbar.cpp
diff --git a/Source/platform/scroll/Scrollbar.cpp b/Source/platform/scroll/Scrollbar.cpp
index 19e48492d67aff44e16edfb340d82b5f8972fba8..c9a4aec7f8874cb2c5cf226e71557db053eff9ef 100644
--- a/Source/platform/scroll/Scrollbar.cpp
+++ b/Source/platform/scroll/Scrollbar.cpp
@@ -42,9 +42,9 @@
namespace blink {
-PassRefPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
+PassRefPtrWillBeRawPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
{
- return adoptRef(new Scrollbar(scrollableArea, orientation, size));
+ return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size));
}
Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, ScrollbarTheme* theme)
@@ -80,6 +80,11 @@ Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient
Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
m_currentPos = scrollableAreaCurrentPos();
+
+#if ENABLE(OILPAN)
+ if (m_scrollableArea)
+ m_animator = m_scrollableArea->scrollAnimator();
+#endif
}
Scrollbar::~Scrollbar()
@@ -87,6 +92,17 @@ Scrollbar::~Scrollbar()
stopTimerIfNeeded();
m_theme->unregisterScrollbar(this);
+
+#if ENABLE(OILPAN)
+ if (!m_animator)
+ return;
+
+ ASSERT(m_scrollableArea);
+ if (m_orientation == VerticalScrollbar)
+ m_animator->willRemoveVerticalScrollbar(this);
+ else
+ m_animator->willRemoveHorizontalScrollbar(this);
+#endif
}
ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const
@@ -127,6 +143,14 @@ void Scrollbar::offsetDidChange()
setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosition);
}
+void Scrollbar::disconnectFromScrollableArea()
+{
+ m_scrollableArea = nullptr;
+#if ENABLE(OILPAN)
+ m_animator = nullptr;
+#endif
+}
+
void Scrollbar::setProportion(int visibleSize, int totalSize)
{
if (visibleSize == m_visibleSize && totalSize == m_totalSize)

Powered by Google App Engine
This is Rietveld 408576698