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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 30 matching lines...) Expand all
41 Class scrollerImpPairClass = NSClassFromString(@"NSScrollerImpPair"); 41 Class scrollerImpPairClass = NSClassFromString(@"NSScrollerImpPair");
42 apiAvailable = [scrollerImpClass respondsToSelector:@selector(scrollerIm pWithStyle:controlSize:horizontal:replacingScrollerImp:)] 42 apiAvailable = [scrollerImpClass respondsToSelector:@selector(scrollerIm pWithStyle:controlSize:horizontal:replacingScrollerImp:)]
43 && [scrollerImpPairClass instancesRespondToSelector:@sele ctor(scrollerStyle)]; 43 && [scrollerImpPairClass instancesRespondToSelector:@sele ctor(scrollerStyle)];
44 } 44 }
45 return apiAvailable; 45 return apiAvailable;
46 } 46 }
47 47
48 NSScrollerStyle recommendedScrollerStyle() { 48 NSScrollerStyle recommendedScrollerStyle() {
49 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) 49 if (RuntimeEnabledFeatures::overlayScrollbarsEnabled())
50 return NSScrollerStyleOverlay; 50 return NSScrollerStyleOverlay;
51 if ([NSScroller respondsToSelector:@selector(preferredScrollerStyle)]) 51 bool respondsToSelectorPreferredScrollerStyle;
Nico 2013/10/11 19:48:48 If this is called from a single thread, just sta
52 bool shouldInitialize = true;
Nico 2013/10/11 19:48:48 …wait, how does this version work? Isn't this stil
53 if (shouldInitialize) {
54 shouldInitialize = false;
55 respondsToSelectorPreferredScrollerStyle = [NSScroller respondsToSelecto r:@selector(preferredScrollerStyle)];
56 }
57 if (respondsToSelectorPreferredScrollerStyle)
52 return [NSScroller preferredScrollerStyle]; 58 return [NSScroller preferredScrollerStyle];
53 return NSScrollerStyleLegacy; 59 return NSScrollerStyleLegacy;
54 } 60 }
55 61
56 } 62 }
OLDNEW
« 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