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

Unified Diff: Source/core/frame/FrameView.cpp

Issue 193413002: Only schedule a widget update when necessary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 7746f348bf0c895e4966c9ba283bd36ddec8831a..99b2e7368871438fa3af58c19e8cf1e0cb84e63c 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -1961,6 +1961,10 @@ void FrameView::scrollToAnchor()
bool FrameView::updateWidgets()
{
+ // This is always called from updateWidgetsTimerFired.
+ // m_updateWidgetsTimer should only be scheduled if we have widgets to update.
+ // Thus I believe we can stop checking isEmpty here, and just ASSERT isEmpty:
+ ASSERT(!m_widgetUpdateSet.isEmpty());
if (m_nestedLayoutCount > 1 || m_widgetUpdateSet.isEmpty())
return true;
@@ -2011,6 +2015,13 @@ void FrameView::flushAnyPendingPostLayoutTasks()
updateWidgetsTimerFired(0);
}
+void FrameView::scheduleUpdateWidgetsIfNecessary()
+{
+ if (m_updateWidgetsTimer.isActive() || m_widgetUpdateSet.isEmpty())
+ return;
+ m_updateWidgetsTimer.startOneShot(0, FROM_HERE);
+}
+
void FrameView::performPostLayoutTasks()
{
TRACE_EVENT0("webkit", "FrameView::performPostLayoutTasks");
@@ -2052,8 +2063,7 @@ void FrameView::performPostLayoutTasks()
if (!renderView())
return;
- if (!m_updateWidgetsTimer.isActive())
- m_updateWidgetsTimer.startOneShot(0, FROM_HERE);
+ scheduleUpdateWidgetsIfNecessary();
if (Page* page = m_frame->page()) {
if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698