Title: [152402] trunk/Source/WebCore
- Revision
- 152402
- Author
- barraclo...@apple.com
- Date
- 2013-07-04 11:00:01 -0700 (Thu, 04 Jul 2013)
Log Message
Remove PageThrottler::m_activeThrottleBlockers
https://bugs.webkit.org/show_bug.cgi?id=118375
Reviewed by Mark Rowe.
This is simply m_activityTokens.size().
Also, fold preventThrottling into addActivityToken & allowThrottling into removeActivityToken
(these should no longer be called directly, and should not be public).
* page/PageThrottler.cpp:
(WebCore::PageThrottler::PageThrottler):
- removed m_activeThrottleBlockers
(WebCore::PageThrottler::startThrottleHysteresisTimer):
- m_activeThrottleBlockers -> m_activityTokens.size()
(WebCore::PageThrottler::throttleHysteresisTimerFired):
- m_activeThrottleBlockers -> m_activityTokens.size()
(WebCore::PageThrottler::addActivityToken):
- added functionality from preventThrottling
(WebCore::PageThrottler::removeActivityToken):
- added functionality from allowThrottling
* page/PageThrottler.h:
- removed preventThrottling, allowThrottling, and m_activeThrottleBlockers.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (152401 => 152402)
--- trunk/Source/WebCore/ChangeLog 2013-07-04 15:51:44 UTC (rev 152401)
+++ trunk/Source/WebCore/ChangeLog 2013-07-04 18:00:01 UTC (rev 152402)
@@ -1,3 +1,29 @@
+2013-07-03 Gavin Barraclough <barraclo...@apple.com>
+
+ Remove PageThrottler::m_activeThrottleBlockers
+ https://bugs.webkit.org/show_bug.cgi?id=118375
+
+ Reviewed by Mark Rowe.
+
+ This is simply m_activityTokens.size().
+
+ Also, fold preventThrottling into addActivityToken & allowThrottling into removeActivityToken
+ (these should no longer be called directly, and should not be public).
+
+ * page/PageThrottler.cpp:
+ (WebCore::PageThrottler::PageThrottler):
+ - removed m_activeThrottleBlockers
+ (WebCore::PageThrottler::startThrottleHysteresisTimer):
+ - m_activeThrottleBlockers -> m_activityTokens.size()
+ (WebCore::PageThrottler::throttleHysteresisTimerFired):
+ - m_activeThrottleBlockers -> m_activityTokens.size()
+ (WebCore::PageThrottler::addActivityToken):
+ - added functionality from preventThrottling
+ (WebCore::PageThrottler::removeActivityToken):
+ - added functionality from allowThrottling
+ * page/PageThrottler.h:
+ - removed preventThrottling, allowThrottling, and m_activeThrottleBlockers.
+
2013-07-01 Antti Koivisto <an...@apple.com>
Take document height into account when determining when it is considered visually non-empy
Modified: trunk/Source/WebCore/page/PageThrottler.cpp (152401 => 152402)
--- trunk/Source/WebCore/page/PageThrottler.cpp 2013-07-04 15:51:44 UTC (rev 152401)
+++ trunk/Source/WebCore/page/PageThrottler.cpp 2013-07-04 18:00:01 UTC (rev 152402)
@@ -38,7 +38,6 @@
PageThrottler::PageThrottler(Page* page)
: m_page(page)
- , m_activeThrottleBlockers(0)
, m_throttleState(PageNotThrottledState)
, m_throttleHysteresisTimer(this, &PageThrottler::throttleHysteresisTimerFired)
{
@@ -106,37 +105,6 @@
}
}
-void PageThrottler::preventThrottling()
-{
- // If we've already got events that block throttling we can increment
- // and return early
- if (m_activeThrottleBlockers++)
- return;
-
- if (m_throttleState == PageNotThrottledState)
- return;
-
- if (m_throttleState == PageThrottledState)
- unthrottlePage();
-
- m_throttleState = PageWaitingToThrottleState;
- stopThrottleHysteresisTimer();
-}
-
-void PageThrottler::allowThrottling()
-{
- ASSERT(m_activeThrottleBlockers > 0);
- m_activeThrottleBlockers--;
- if (m_activeThrottleBlockers)
- return;
-
- if (m_throttleState == PageNotThrottledState)
- return;
-
- ASSERT(m_throttleState == PageWaitingToThrottleState);
- startThrottleHysteresisTimer();
-}
-
void PageThrottler::stopThrottleHysteresisTimer()
{
m_throttleHysteresisTimer.stop();
@@ -156,32 +124,50 @@
{
if (m_throttleHysteresisTimer.isActive())
m_throttleHysteresisTimer.stop();
- if (!m_activeThrottleBlockers)
+ if (!m_activityTokens.size())
m_throttleHysteresisTimer.startOneShot(kThrottleHysteresisSeconds);
}
void PageThrottler::throttleHysteresisTimerFired(Timer<PageThrottler>*)
{
- ASSERT(!m_activeThrottleBlockers);
+ ASSERT(!m_activityTokens.size());
throttlePage();
}
void PageThrottler::addActivityToken(PageActivityAssertionToken* token)
{
- if (!token || m_activityTokens.contains(token))
- return;
+ ASSERT(token && !m_activityTokens.contains(token));
m_activityTokens.add(token);
- preventThrottling();
+
+ // If we've already got events that block throttling we can return early
+ if (m_activityTokens.size() > 1)
+ return;
+
+ if (m_throttleState == PageNotThrottledState)
+ return;
+
+ if (m_throttleState == PageThrottledState)
+ unthrottlePage();
+
+ m_throttleState = PageWaitingToThrottleState;
+ stopThrottleHysteresisTimer();
}
void PageThrottler::removeActivityToken(PageActivityAssertionToken* token)
{
- if (!token || !m_activityTokens.contains(token))
- return;
+ ASSERT(token && m_activityTokens.contains(token));
m_activityTokens.remove(token);
- allowThrottling();
+
+ if (m_activityTokens.size())
+ return;
+
+ if (m_throttleState == PageNotThrottledState)
+ return;
+
+ ASSERT(m_throttleState == PageWaitingToThrottleState);
+ startThrottleHysteresisTimer();
}
}
Modified: trunk/Source/WebCore/page/PageThrottler.h (152401 => 152402)
--- trunk/Source/WebCore/page/PageThrottler.h 2013-07-04 15:51:44 UTC (rev 152401)
+++ trunk/Source/WebCore/page/PageThrottler.h 2013-07-04 18:00:01 UTC (rev 152402)
@@ -49,9 +49,7 @@
void setThrottled(bool);
- void preventThrottling();
void reportInterestingEvent();
- void allowThrottling();
~PageThrottler();
@@ -76,7 +74,6 @@
void throttlePage();
void unthrottlePage();
- unsigned m_activeThrottleBlockers;
PageThrottleState m_throttleState;
Timer<PageThrottler> m_throttleHysteresisTimer;
HashSet<PageActivityAssertionToken*> m_activityTokens;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes