Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1089)

Unified Diff: Source/core/platform/mac/NSScrollerImpDetails.mm

Issue 27058002: Cache results from respondsToSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make similar Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/mac/NSScrollerImpDetails.mm
diff --git a/Source/core/platform/mac/NSScrollerImpDetails.mm b/Source/core/platform/mac/NSScrollerImpDetails.mm
index a5f09c5d519c0df39a5713c72bc1acc9152a3ce1..464bbc0c4b498fa665be8c0a6913010bd023d5c7 100644
--- a/Source/core/platform/mac/NSScrollerImpDetails.mm
+++ b/Source/core/platform/mac/NSScrollerImpDetails.mm
@@ -48,7 +48,13 @@ bool isScrollbarOverlayAPIAvailable()
NSScrollerStyle recommendedScrollerStyle() {
if (RuntimeEnabledFeatures::overlayScrollbarsEnabled())
return NSScrollerStyleOverlay;
- if ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)])
Nico 2013/10/11 19:48:48 If this is called from a single thread, just sta
+ bool respondsToSelectorPreferredScrollerStyle;
+ bool shouldInitialize = true;
Nico 2013/10/11 19:48:48 …wait, how does this version work? Isn't this stil
+ if (shouldInitialize) {
+ shouldInitialize = false;
+ respondsToSelectorPreferredScrollerStyle = [NSScroller respondsToSelector:@selector(preferredScrollerStyle)];
+ }
+ if (respondsToSelectorPreferredScrollerStyle)
return [NSScroller preferredScrollerStyle];
return NSScrollerStyleLegacy;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698