-
oliver@apple.com authored
https://bugs.webkit.org/show_bug.cgi?id=116893 Reviewed by Gavin Barraclough. Source/WebCore: Add a hysteresis to Page activity throttling. We do this through a PageThrottler class that now handles entering and exiting throttling state, and adds a hysteresis to we can limit the amount of on/off bouncing on the throttle. Media elements now make use of this to disable timer throttling while they are playing, and plugins use it to momentarily bounce from throttled to unthrottled state. * CMakeLists.txt: * GNUmakefile.list.am: * Target.pri: * WebCore.exp.in: * WebCore.vcproj/WebCore.vcproj: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::~HTMLMediaElement): (WebCore::HTMLMediaElement::pageThrottlerIfPossible): (WebCore): (WebCore::HTMLMediaElement::playInternal): (WebCore::HTMLMediaElement::pauseInternal): * html/HTMLMediaElement.h: (WebCore): * html/MediaController.cpp: (MediaController::unpause): * page/ChromeClient.h: (WebCore::ChromeClient::incrementActivePageCount): (WebCore::ChromeClient::decrementActivePageCount): (ChromeClient): * page/Page.cpp: (WebCore::Page::Page): (WebCore::Page::~Page): (WebCore::Page::setThrottled): * page/Page.h: (WebCore): (Page): (WebCore::Page::pageThrottler): * page/PageThrottleState.h: Added. * page/PageThrottler.cpp: Added. (WebCore): (WebCore::PageThrottler::PageThrottler): (WebCore::PageThrottler::~PageThrottler): (WebCore::PageThrottler::clearPage): (WebCore::PageThrottler::throttlePage): (WebCore::PageThrottler::unthrottlePage): (WebCore::PageThrottler::setThrottled): (WebCore::PageThrottler::preventThrottling): (WebCore::PageThrottler::allowThrottling): (WebCore::PageThrottler::stopThrottleHysteresisTimer): (WebCore::PageThrottler::reportInterestingEvent): (WebCore::PageThrottler::startThrottleHysteresisTimer): (WebCore::PageThrottler::throttleHysteresisTimerFired): * page/PageThrottler.h: Added. (WebCore): (PageThrottler): (WebCore::PageThrottler::create): (WebCore::PageThrottler::shouldThrottleAnimations): (WebCore::PageThrottler::shouldThrottleTimers): Source/WebKit2: This extends the logic in WebCore from a Page to Process granularity, so we will avoid lowering the child process priority if there is active content. This also plumbs in the logic to allow plugins to report that they have done something "interesting". Currently this is somewhat conservative but even this is sufficient to fix some stuttering issues that we've seen. * Shared/ChildProcess.cpp: (WebKit::ChildProcess::ChildProcess): * Shared/ChildProcess.h: (ChildProcess): (WebKit::ChildProcess::processSuppressionEnabled): (WebKit::ChildProcess::incrementActiveTaskCount): (WebKit::ChildProcess::decrementActiveTaskCount): * Shared/mac/ChildProcessMac.mm: (WebKit): (WebKit::ChildProcess::setProcessSuppressionEnabledInternal): (WebKit::ChildProcess::setProcessSuppressionEnabled): (WebKit::ChildProcess::incrementActiveTaskCount): (WebKit::ChildProcess::decrementActiveTaskCount): (WebKit::ChildProcess::suspensionHysteresisTimerFired): * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: (WebKit::NPRuntimeObjectMap::NPRuntimeObjectMap): (WebKit::NPRuntimeObjectMap::evaluate): * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h: (WebCore): (NPRuntimeObjectMap): * WebProcess/Plugins/PluginView.cpp: (WebKit::PluginView::PluginView): * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::incrementActivePageCount): (WebKit): (WebKit::WebChromeClient::decrementActivePageCount): * WebProcess/WebCoreSupport/WebChromeClient.h: (WebChromeClient): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
e1e8f92c