Title: [136303] trunk/Source/WebCore
Revision
136303
Author
simon.fra...@apple.com
Date
2012-11-30 22:12:31 -0800 (Fri, 30 Nov 2012)

Log Message

Avoid calling into NSUserDefaults every time we start a scroll
https://bugs.webkit.org/show_bug.cgi?id=103804

Reviewed by Dan Bernstein.

Cache the NSScrollAnimationEnabled preference to avoid
hitting NSUserDefaults every time we start scrolling.

* platform/mac/ScrollAnimatorMac.mm:
(WebCore::scrollAnimationEnabledForSystem):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136302 => 136303)


--- trunk/Source/WebCore/ChangeLog	2012-12-01 02:24:18 UTC (rev 136302)
+++ trunk/Source/WebCore/ChangeLog	2012-12-01 06:12:31 UTC (rev 136303)
@@ -1,3 +1,16 @@
+2012-11-30  Simon Fraser  <simon.fra...@apple.com>
+
+        Avoid calling into NSUserDefaults every time we start a scroll
+        https://bugs.webkit.org/show_bug.cgi?id=103804
+
+        Reviewed by Dan Bernstein.
+
+        Cache the NSScrollAnimationEnabled preference to avoid
+        hitting NSUserDefaults every time we start scrolling.
+
+        * platform/mac/ScrollAnimatorMac.mm:
+        (WebCore::scrollAnimationEnabledForSystem):
+
 2012-11-30  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=103790

Modified: trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (136302 => 136303)


--- trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-12-01 02:24:18 UTC (rev 136302)
+++ trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2012-12-01 06:12:31 UTC (rev 136303)
@@ -635,11 +635,14 @@
 
 static bool scrollAnimationEnabledForSystem()
 {
+    NSString* scrollAnimationDefaultsKey = 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM)
-    return [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollAnimationEnabled"];
+        @"AppleScrollAnimationEnabled";
 #else
-    return [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"];
+        @"NSScrollAnimationEnabled";
 #endif
+    static bool enabled = [[NSUserDefaults standardUserDefaults] boolForKey:scrollAnimationDefaultsKey];
+    return enabled;
 }
 
 #if ENABLE(RUBBER_BANDING)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to