diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 00:38:57 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 00:38:57 +0000 |
commit | 02e32372b266ef841c8158f4f64d13a2a57c1e55 (patch) | |
tree | e7710a8d4d7da9514298f3b5df224e24740f97b7 /base/mac | |
parent | bf07c945a432c4477997b87022b2d30acbadb059 (diff) | |
download | chromium_src-02e32372b266ef841c8158f4f64d13a2a57c1e55.zip chromium_src-02e32372b266ef841c8158f4f64d13a2a57c1e55.tar.gz chromium_src-02e32372b266ef841c8158f4f64d13a2a57c1e55.tar.bz2 |
Revert 231670 "Make RenderTextMac more efficient by caching font..."
> Make RenderTextMac more efficient by caching fonts and taking advantage of toll-free bridging of CT/NSFont.
>
> BUG=312436
> TEST=no console spew as in bug
> R=asvitkine@chromium.org, mark@chromium.org, shess@chromium.org
>
> Review URL: https://codereview.chromium.org/49503003
TBR=avi@chromium.org
Review URL: https://codereview.chromium.org/51463003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231685 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r-- | base/mac/foundation_util.h | 10 | ||||
-rw-r--r-- | base/mac/foundation_util.mm | 60 |
2 files changed, 1 insertions, 69 deletions
diff --git a/base/mac/foundation_util.h b/base/mac/foundation_util.h index 46ea3c3..447f7bf 100644 --- a/base/mac/foundation_util.h +++ b/base/mac/foundation_util.h @@ -16,14 +16,10 @@ #if defined(__OBJC__) #import <Foundation/Foundation.h> -@class NSFont; -@class UIFont; #else // __OBJC__ #include <CoreFoundation/CoreFoundation.h> class NSBundle; -class NSFont; class NSString; -class UIFont; #endif // __OBJC__ #if defined(OS_IOS) @@ -229,12 +225,6 @@ CF_TO_NS_CAST_DECL(CFWriteStream, NSOutputStream); CF_TO_NS_MUTABLE_CAST_DECL(String); CF_TO_NS_CAST_DECL(CFURL, NSURL); -#if defined(OS_IOS) -CF_TO_NS_CAST_DECL(CTFont, UIFont); -#else -CF_TO_NS_CAST_DECL(CTFont, NSFont); -#endif - #undef CF_TO_NS_CAST_DECL #undef CF_TO_NS_MUTABLE_CAST_DECL #undef OBJC_CPP_CLASS_DECL diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm index 4e9b224..19df847 100644 --- a/base/mac/foundation_util.mm +++ b/base/mac/foundation_util.mm @@ -17,7 +17,6 @@ extern "C" { CFTypeID SecACLGetTypeID(); CFTypeID SecTrustedApplicationGetTypeID(); -Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj); } // extern "C" #endif @@ -291,31 +290,6 @@ CF_TO_NS_CAST_DEFN(CFWriteStream, NSOutputStream); CF_TO_NS_MUTABLE_CAST_DEFN(String); CF_TO_NS_CAST_DEFN(CFURL, NSURL); -#if defined(OS_IOS) -CF_TO_NS_CAST_DEFN(CTFont, UIFont); -#else -// The NSFont/CTFont toll-free bridging is broken when it comes to type -// checking, so do some special-casing. -// http://www.openradar.me/15341349 rdar://15341349 -NSFont* CFToNSCast(CTFontRef cf_val) { - NSFont* ns_val = - const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val)); - DCHECK(!cf_val || - CTFontGetTypeID() == CFGetTypeID(cf_val) || - (_CFIsObjC(CTFontGetTypeID(), cf_val) && - [ns_val isKindOfClass:NSClassFromString(@"NSFont")])); - return ns_val; -} - -CTFontRef NSToCFCast(NSFont* ns_val) { - CTFontRef cf_val = reinterpret_cast<CTFontRef>(ns_val); - DCHECK(!cf_val || - CTFontGetTypeID() == CFGetTypeID(cf_val) || - [ns_val isKindOfClass:NSClassFromString(@"NSFont")]); - return cf_val; -} -#endif - #undef CF_TO_NS_CAST_DEFN #undef CF_TO_NS_MUTABLE_CAST_DEFN @@ -353,40 +327,8 @@ CF_CAST_DEFN(CFUUID); CF_CAST_DEFN(CGColor); -CF_CAST_DEFN(CTRun); - -#if defined(OS_IOS) CF_CAST_DEFN(CTFont); -#else -// The NSFont/CTFont toll-free bridging is broken when it comes to type -// checking, so do some special-casing. -// http://www.openradar.me/15341349 rdar://15341349 -template<> CTFontRef -CFCast<CTFontRef>(const CFTypeRef& cf_val) { - if (cf_val == NULL) { - return NULL; - } - if (CFGetTypeID(cf_val) == CTFontGetTypeID()) { - return (CTFontRef)(cf_val); - } - - if (!_CFIsObjC(CTFontGetTypeID(), cf_val)) - return NULL; - - id<NSObject> ns_val = reinterpret_cast<id>(const_cast<void*>(cf_val)); - if ([ns_val isKindOfClass:NSClassFromString(@"NSFont")]) { - return (CTFontRef)(cf_val); - } - return NULL; -} - -template<> CTFontRef -CFCastStrict<CTFontRef>(const CFTypeRef& cf_val) { - CTFontRef rv = CFCast<CTFontRef>(cf_val); - DCHECK(cf_val == NULL || rv); - return rv; -} -#endif +CF_CAST_DEFN(CTRun); #if !defined(OS_IOS) CF_CAST_DEFN(SecACL); |