WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-138844-20141118153124.patch (text/plain), 15.60 KB, created by
Chris Dumez
on 2014-11-18 15:31:11 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2014-11-18 15:31:11 PST
Size:
15.60 KB
patch
obsolete
>Subversion Revision: 176282 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9fe56893fb5d3582a340a3b7318285875e982030..c61a08108b7ba1e1b94032e27f793c305716121b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,5 +1,24 @@ > 2014-11-18 Chris Dumez <cdumez@apple.com> > >+ Add a setting to toggle DOMTimer throttling support >+ https://bugs.webkit.org/show_bug.cgi?id=138844 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a setting to disable DOM timers throttling, in order to help >+ developers determine if a specific issue is caused by timer >+ throttling. >+ >+ * page/DOMTimer.cpp: >+ (WebCore::DOMTimerFireState::contextDocument): >+ (WebCore::DOMTimerFireState::scriptMadeUserObservableChanges): >+ (WebCore::DOMTimer::isDOMTimersThrottlingEnabled): >+ (WebCore::DOMTimer::updateThrottlingStateIfNecessary): >+ * page/DOMTimer.h: >+ * page/Settings.in: >+ >+2014-11-18 Chris Dumez <cdumez@apple.com> >+ > DOMTimers sometimes don't get unthrottled on scrolling > https://bugs.webkit.org/show_bug.cgi?id=138838 > >diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog >index ef785118d5c60314b19d150b15b1b738eb5d37aa..fd24b55d70a93d340770af6243e88db76594565b 100644 >--- a/Source/WebKit/mac/ChangeLog >+++ b/Source/WebKit/mac/ChangeLog >@@ -1,3 +1,23 @@ >+2014-11-18 Chris Dumez <cdumez@apple.com> >+ >+ Add a setting to toggle DOMTimer throttling support >+ https://bugs.webkit.org/show_bug.cgi?id=138844 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a setting to disable DOM timers throttling, in order to help >+ developers determine if a specific issue is caused by timer >+ throttling. >+ >+ * WebView/WebPreferenceKeysPrivate.h: >+ * WebView/WebPreferences.mm: >+ (+[WebPreferences initialize]): >+ (-[WebPreferences domTimersThrottlingEnabled]): >+ (-[WebPreferences setDOMTimersThrottlingEnabled:]): >+ * WebView/WebPreferencesPrivate.h: >+ * WebView/WebView.mm: >+ (-[WebView _preferencesChanged:]): >+ > 2014-11-18 Daniel Bates <dabates@apple.com> > > [iOS] Libdispatch, Dyld, IOKit, Mach, NSPointerFunctions, MobileGestalt >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index f2aeb2361ca4e7acd913bd48a27304b3e2c2d236..8f707c425aafd7542b288450f0d3e2733df25e5e 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,22 @@ >+2014-11-18 Chris Dumez <cdumez@apple.com> >+ >+ Add a setting to toggle DOMTimer throttling support >+ https://bugs.webkit.org/show_bug.cgi?id=138844 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a setting to disable DOM timers throttling, in order to help >+ developers determine if a specific issue is caused by timer >+ throttling. >+ >+ * Shared/WebPreferencesDefinitions.h: >+ * UIProcess/API/C/WKPreferences.cpp: >+ (WKPreferencesSetDOMTimersThrottlingEnabled): >+ (WKPreferencesGetDOMTimersThrottlingEnabled): >+ * UIProcess/API/C/WKPreferencesRefPrivate.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::updatePreferences): >+ > 2014-11-18 Myles C. Maxfield <mmaxfield@apple.com> > > Subclass CachedFont for SVG fonts >diff --git a/Source/WebCore/page/DOMTimer.cpp b/Source/WebCore/page/DOMTimer.cpp >index 42ceedc227163d8aafa0bf7737687b93372e11b2..e3c1ad2748bdbbf5e8bcec74ba6d17fd74a26c03 100644 >--- a/Source/WebCore/page/DOMTimer.cpp >+++ b/Source/WebCore/page/DOMTimer.cpp >@@ -31,9 +31,11 @@ > #include "HTMLPlugInElement.h" > #include "InspectorInstrumentation.h" > #include "Logging.h" >+#include "Page.h" > #include "PluginViewBase.h" > #include "ScheduledAction.h" > #include "ScriptExecutionContext.h" >+#include "Settings.h" > #include "UserGestureIndicator.h" > #include <wtf/CurrentTime.h> > #include <wtf/HashSet.h> >@@ -45,7 +47,6 @@ > #include "Chrome.h" > #include "ChromeClient.h" > #include "Frame.h" >-#include "Page.h" > #include "WKContentObservation.h" > #endif > >@@ -77,6 +78,8 @@ public: > current = m_previous; > } > >+ Document* contextDocument() const { return m_contextIsDocument ? &downcast<Document>(m_context) : nullptr; } >+ > void setScriptMadeUserObservableChanges() { m_scriptMadeUserObservableChanges = true; } > void setScriptMadeNonUserObservableChanges() { m_scriptMadeNonUserObservableChanges = true; } > void setScriptMadeNonUserObservableChangesToElementStyle(StyledElement& element) >@@ -91,8 +94,9 @@ public: > if (m_scriptMadeUserObservableChanges) > return true; > >+ Document* document = contextDocument(); > // To be conservative, we also consider any DOM Tree change to be user observable. >- return m_contextIsDocument && downcast<Document>(m_context).domTreeVersion() != m_initialDOMTreeVersion; >+ return document && document->domTreeVersion() != m_initialDOMTreeVersion; > } > > void setChangedStyleOfElementOutsideViewport(StyledElement& element) >@@ -251,8 +255,31 @@ void DOMTimer::removeById(ScriptExecutionContext& context, int timeoutId) > context.removeTimeout(timeoutId); > } > >+inline bool DOMTimer::isDOMTimersThrottlingEnabled(Document& document) const >+{ >+ auto* page = document.page(); >+ if (!page) >+ return true; >+ return page->settings().domTimersThrottlingEnabled(); >+} >+ > void DOMTimer::updateThrottlingStateIfNecessary(const DOMTimerFireState& fireState) > { >+ Document* contextDocument = fireState.contextDocument(); >+ // We don't throttle timers in worker threads. >+ if (!contextDocument) >+ return; >+ >+ if (UNLIKELY(!isDOMTimersThrottlingEnabled(*contextDocument))) { >+ if (m_throttleState == ShouldThrottle) { >+ // Unthrottle the timer in case it was throttled before the setting was updated. >+ LOG(DOMTimers, "%p - Unthrottling DOM timer because throttling was disabled via settings.", this); >+ m_throttleState = ShouldNotThrottle; >+ updateTimerIntervalIfNecessary(); >+ } >+ return; >+ } >+ > if (fireState.scriptMadeUserObservableChanges()) { > ASSERT(m_elementsCausingThrottling.isEmpty()); > if (m_throttleState != ShouldNotThrottle) { >diff --git a/Source/WebCore/page/DOMTimer.h b/Source/WebCore/page/DOMTimer.h >index 683346b0d9978a648a9ff86dadbc67128eac35e7..85b376282e91735ac99274cb6546b902fd1d944e 100644 >--- a/Source/WebCore/page/DOMTimer.h >+++ b/Source/WebCore/page/DOMTimer.h >@@ -35,6 +35,7 @@ > namespace WebCore { > > class DOMTimerFireState; >+ class Document; > class HTMLPlugInElement; > class IntRect; > class ScheduledAction; >@@ -65,6 +66,7 @@ namespace WebCore { > > double intervalClampedToMinimum() const; > >+ bool isDOMTimersThrottlingEnabled(Document&) const; > bool isIntervalDependentOnViewport() const { return m_throttleState == ShouldThrottle && !m_elementsCausingThrottling.isEmpty(); } > void registerForViewportChanges(); > void unregisterForViewportChanges(); >diff --git a/Source/WebCore/page/Settings.in b/Source/WebCore/page/Settings.in >index 4983e3357ac677f4c627ab5e020281b018972be6..6ad97bc9bb527a78140cbd5357531aaa8e6e218b 100644 >--- a/Source/WebCore/page/Settings.in >+++ b/Source/WebCore/page/Settings.in >@@ -76,6 +76,7 @@ developerExtrasEnabled initial=false > javaScriptExperimentsEnabled initial=false > scriptMarkupEnabled initial=true > needsSiteSpecificQuirks initial=false >+domTimersThrottlingEnabled initial=true > webArchiveDebugModeEnabled initial=false, conditional=WEB_ARCHIVE > localFileContentSniffingEnabled initial=false > offlineWebApplicationCacheEnabled initial=false >diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h >index 106631aa562629e2043c24d453ba61bdb309ad74..4f203a57809d6ffe06f0820b95c76acdf6f10911 100644 >--- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h >+++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h >@@ -87,6 +87,7 @@ > #define WebKitJavaScriptExperimentsEnabledPreferenceKey @"WebKitJavaScriptExperimentsEnabledPreferenceKey" > #define WebKitAuthorAndUserStylesEnabledPreferenceKey @"WebKitAuthorAndUserStylesEnabledPreferenceKey" > #define WebKitApplicationChromeModeEnabledPreferenceKey @"WebKitApplicationChromeModeEnabledPreferenceKey" >+#define WebKitDOMTimersThrottlingEnabledPreferenceKey @"WebKitDOMTimersThrottlingEnabledPreferenceKey" > #define WebKitWebArchiveDebugModeEnabledPreferenceKey @"WebKitWebArchiveDebugModeEnabledPreferenceKey" > #define WebKitLocalFileContentSniffingEnabledPreferenceKey @"WebKitLocalFileContentSniffingEnabledPreferenceKey" > #define WebKitLocalStorageDatabasePathPreferenceKey @"WebKitLocalStorageDatabasePathPreferenceKey" >diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm >index 04ca54ae68af0f27cb98bf12adc10e25f4402661..feb731e427bbc988ce3008bb5129672afd860e1b 100644 >--- a/Source/WebKit/mac/WebView/WebPreferences.mm >+++ b/Source/WebKit/mac/WebView/WebPreferences.mm >@@ -476,6 +476,7 @@ public: > [NSNumber numberWithBool:NO], WebKitJavaScriptExperimentsEnabledPreferenceKey, > [NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey, > [NSNumber numberWithBool:NO], WebKitApplicationChromeModeEnabledPreferenceKey, >+ [NSNumber numberWithBool:YES], WebKitDOMTimersThrottlingEnabledPreferenceKey, > [NSNumber numberWithBool:NO], WebKitWebArchiveDebugModeEnabledPreferenceKey, > [NSNumber numberWithBool:NO], WebKitLocalFileContentSniffingEnabledPreferenceKey, > [NSNumber numberWithBool:NO], WebKitOfflineWebApplicationCacheEnabledPreferenceKey, >@@ -1224,6 +1225,16 @@ public: > [self _setBoolValue:flag forKey:WebKitApplicationChromeModeEnabledPreferenceKey]; > } > >+- (BOOL)domTimersThrottlingEnabled >+{ >+ return [self _boolValueForKey:WebKitDOMTimersThrottlingEnabledPreferenceKey]; >+} >+ >+- (void)setDOMTimersThrottlingEnabled:(BOOL)flag >+{ >+ [self _setBoolValue:flag forKey:WebKitDOMTimersThrottlingEnabledPreferenceKey]; >+} >+ > - (BOOL)webArchiveDebugModeEnabled > { > return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey]; >diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h >index 0e69d3eac77574f4bd158c8f38ffabbd985934b4..b21f13b1e6a28e0641d7e4330e72849db4026eb3 100644 >--- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h >+++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h >@@ -102,6 +102,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification; > - (BOOL)automaticallyDetectsCacheModel; > - (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel; > >+- (BOOL)domTimersThrottlingEnabled; >+- (void)setDOMTimersThrottlingEnabled:(BOOL)domTimersThrottlingEnabled; >+ > - (BOOL)webArchiveDebugModeEnabled; > - (void)setWebArchiveDebugModeEnabled:(BOOL)webArchiveDebugModeEnabled; > >diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm >index 13774302c9e58e834f10b74a16beca2774af7370..3251ee5ba9c39ecd30baa34a0acabd4cfd8553de 100644 >--- a/Source/WebKit/mac/WebView/WebView.mm >+++ b/Source/WebKit/mac/WebView/WebView.mm >@@ -2222,6 +2222,7 @@ static bool needsSelfRetainWhileLoadingQuirk() > settings.setApplicationChromeMode([preferences applicationChromeModeEnabled]); > > settings.setNeedsSiteSpecificQuirks(_private->useSiteSpecificSpoofing); >+ settings.setDOMTimersThrottlingEnabled([preferences domTimersThrottlingEnabled]); > settings.setWebArchiveDebugModeEnabled([preferences webArchiveDebugModeEnabled]); > settings.setLocalFileContentSniffingEnabled([preferences localFileContentSniffingEnabled]); > settings.setOfflineWebApplicationCacheEnabled([preferences offlineWebApplicationCacheEnabled]); >diff --git a/Source/WebKit2/Shared/WebPreferencesDefinitions.h b/Source/WebKit2/Shared/WebPreferencesDefinitions.h >index 93ac2b4e76a5d48316a4543024efa9aaeeb4a32b..b46cf3a2da1d0d86bacec8156a62eb4cdba35d3c 100644 >--- a/Source/WebKit2/Shared/WebPreferencesDefinitions.h >+++ b/Source/WebKit2/Shared/WebPreferencesDefinitions.h >@@ -120,6 +120,7 @@ > macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \ > macro(TabsToLinks, tabsToLinks, Bool, bool, DEFAULT_WEBKIT_TABSTOLINKS_ENABLED) \ > macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \ >+ macro(DOMTimersThrottlingEnabled, domTimersThrottlingEnabled, Bool, bool, true) \ > macro(WebArchiveDebugModeEnabled, webArchiveDebugModeEnabled, Bool, bool, false) \ > macro(LocalFileContentSniffingEnabled, localFileContentSniffingEnabled, Bool, bool, false) \ > macro(UsesPageCache, usesPageCache, Bool, bool, true) \ >diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp >index 44add1d27dd6cd6e0599e1d93af5652474b29b4d..2212031180f2c912b77ef0dfc822bcee8474fb01 100644 >--- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp >+++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp >@@ -579,6 +579,16 @@ bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferencesRef) > return toImpl(preferencesRef)->shouldPrintBackgrounds(); > } > >+void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef, bool enabled) >+{ >+ toImpl(preferencesRef)->setDOMTimersThrottlingEnabled(enabled); >+} >+ >+bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferencesRef) >+{ >+ return toImpl(preferencesRef)->domTimersThrottlingEnabled(); >+} >+ > void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled) > { > toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled); >diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h >index e38322d6ebfc78b0a35fce4faac8ed32b67f6b20..147c202fcacb0689095077c0b32d0592c03526f2 100644 >--- a/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h >+++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h >@@ -116,6 +116,10 @@ WK_EXPORT bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef prefer > WK_EXPORT void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferences, WKStringRef path); > WK_EXPORT WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferences); > >+// Defaults to true. >+WK_EXPORT void WKPreferencesSetDOMTimersThrottlingEnabled(WKPreferencesRef preferences, bool enabled); >+WK_EXPORT bool WKPreferencesGetDOMTimersThrottlingEnabled(WKPreferencesRef preferences); >+ > // Defaults to false. > WK_EXPORT void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferences, bool enabled); > WK_EXPORT bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferences); >diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >index 599f939ce3ba36d56977cab4708aac3c8a634206..6e5d0cca5f358757decfc2514094bd79688420ba 100644 >--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp >@@ -2660,6 +2660,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store) > settings.setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey())); > settings.setForceFTPDirectoryListings(store.getBoolValueForKey(WebPreferencesKey::forceFTPDirectoryListingsKey())); > settings.setDNSPrefetchingEnabled(store.getBoolValueForKey(WebPreferencesKey::dnsPrefetchingEnabledKey())); >+ settings.setDOMTimersThrottlingEnabled(store.getBoolValueForKey(WebPreferencesKey::domTimersThrottlingEnabledKey())); > #if ENABLE(WEB_ARCHIVE) > settings.setWebArchiveDebugModeEnabled(store.getBoolValueForKey(WebPreferencesKey::webArchiveDebugModeEnabledKey())); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 138844
:
241819
|
241820