Title: [177318] trunk/Source/WebCore
- Revision
- 177318
- Author
- [email protected]
- Date
- 2014-12-15 15:52:50 -0800 (Mon, 15 Dec 2014)
Log Message
Separate counted and hysteresis activities in PageThrottler
https://bugs.webkit.org/show_bug.cgi?id=139657
Reviewed by Sam Weinig.
Currently all activities funnel into a common hysteresis mechanism, the result of
which is combined with the visually idle state, the result of which in turn drives
a UserActivity::Impl.
This is a first refactoring towards moving the UserActivity out to WebKit2. Use
m_hysteresis only of the impulse activities (plugin evaluation, user input), and
flatten the three types of activities (impulse, counted, ViewState) to all directly
control a UserActivity. Switch from a UserActivity::Impl to a UserActivity since
this will provide hysteresis for media activity.
* page/PageThrottler.cpp:
(WebCore::m_pageActivityCounter):
- when the RefCounter changes just call updateUserActivity directly, removeed redundant call to updateUserActivity.
(WebCore::PageThrottler::createUserActivity):
- m_activity is now a UserActivity.
(WebCore::PageThrottler::updateUserActivity):
- previously just checked m_hysteresis for activity; now check m_pageActivityCounter too.
(WebCore::PageThrottler::pageActivityCounterValueDidChange): Deleted.
- no longer needed; when the RefCounter changes just call updateUserActivity directly.
* page/PageThrottler.h:
- removed pageActivityCounterValueDidChange, m_activity is now a UserActivity.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (177317 => 177318)
--- trunk/Source/WebCore/ChangeLog 2014-12-15 23:40:06 UTC (rev 177317)
+++ trunk/Source/WebCore/ChangeLog 2014-12-15 23:52:50 UTC (rev 177318)
@@ -1,3 +1,32 @@
+2014-12-15 Gavin Barraclough <[email protected]>
+
+ Separate counted and hysteresis activities in PageThrottler
+ https://bugs.webkit.org/show_bug.cgi?id=139657
+
+ Reviewed by Sam Weinig.
+
+ Currently all activities funnel into a common hysteresis mechanism, the result of
+ which is combined with the visually idle state, the result of which in turn drives
+ a UserActivity::Impl.
+
+ This is a first refactoring towards moving the UserActivity out to WebKit2. Use
+ m_hysteresis only of the impulse activities (plugin evaluation, user input), and
+ flatten the three types of activities (impulse, counted, ViewState) to all directly
+ control a UserActivity. Switch from a UserActivity::Impl to a UserActivity since
+ this will provide hysteresis for media activity.
+
+ * page/PageThrottler.cpp:
+ (WebCore::m_pageActivityCounter):
+ - when the RefCounter changes just call updateUserActivity directly, removeed redundant call to updateUserActivity.
+ (WebCore::PageThrottler::createUserActivity):
+ - m_activity is now a UserActivity.
+ (WebCore::PageThrottler::updateUserActivity):
+ - previously just checked m_hysteresis for activity; now check m_pageActivityCounter too.
+ (WebCore::PageThrottler::pageActivityCounterValueDidChange): Deleted.
+ - no longer needed; when the RefCounter changes just call updateUserActivity directly.
+ * page/PageThrottler.h:
+ - removed pageActivityCounterValueDidChange, m_activity is now a UserActivity.
+
2014-12-15 Commit Queue <[email protected]>
Unreviewed, rolling out r177284.
Modified: trunk/Source/WebCore/page/PageThrottler.cpp (177317 => 177318)
--- trunk/Source/WebCore/page/PageThrottler.cpp 2014-12-15 23:40:06 UTC (rev 177317)
+++ trunk/Source/WebCore/page/PageThrottler.cpp 2014-12-15 23:52:50 UTC (rev 177318)
@@ -31,15 +31,14 @@
PageThrottler::PageThrottler(ViewState::Flags viewState)
: m_viewState(viewState)
, m_hysteresis([this](HysteresisState) { updateUserActivity(); })
- , m_pageActivityCounter([this]() { pageActivityCounterValueDidChange(); })
+ , m_pageActivityCounter([this]() { updateUserActivity(); })
{
- updateUserActivity();
}
void PageThrottler::createUserActivity()
{
ASSERT(!m_activity);
- m_activity = std::make_unique<UserActivity::Impl>("Page is active.");
+ m_activity = std::make_unique<UserActivity>("Page is active.");
updateUserActivity();
}
@@ -53,27 +52,16 @@
return m_pageActivityCounter.count();
}
-void PageThrottler::pageActivityCounterValueDidChange()
-{
- if (m_pageActivityCounter.value())
- m_hysteresis.start();
- else
- m_hysteresis.stop();
-
- // If the counter is nonzero, state cannot be Stopped.
- ASSERT(!(m_pageActivityCounter.value() && m_hysteresis.state() == HysteresisState::Stopped));
-}
-
void PageThrottler::updateUserActivity()
{
if (!m_activity)
return;
// Allow throttling if there is no page activity, and the page is visually idle.
- if (m_hysteresis.state() == HysteresisState::Stopped && m_viewState & ViewState::IsVisuallyIdle)
- m_activity->endActivity();
+ if (!m_pageActivityCounter.value() && m_hysteresis.state() == HysteresisState::Stopped && m_viewState & ViewState::IsVisuallyIdle)
+ m_activity->stop();
else
- m_activity->beginActivity();
+ m_activity->start();
}
void PageThrottler::setViewState(ViewState::Flags viewState)
Modified: trunk/Source/WebCore/page/PageThrottler.h (177317 => 177318)
--- trunk/Source/WebCore/page/PageThrottler.h 2014-12-15 23:40:06 UTC (rev 177317)
+++ trunk/Source/WebCore/page/PageThrottler.h 2014-12-15 23:52:50 UTC (rev 177318)
@@ -50,12 +50,11 @@
PageActivityAssertionToken pageLoadActivityToken();
private:
- void pageActivityCounterValueDidChange();
void updateUserActivity();
ViewState::Flags m_viewState;
HysteresisActivity m_hysteresis;
- std::unique_ptr<UserActivity::Impl> m_activity;
+ std::unique_ptr<UserActivity> m_activity;
RefCounter m_pageActivityCounter;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes