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

Unified Diff: chrome/common/sandbox_mac_fontloading_unittest.mm

Issue 4121004: Fixes up warning about const NSTypes from presubmit message. Gets rid of leak of font. (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: Created 10 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: chrome/common/sandbox_mac_fontloading_unittest.mm
diff --git a/chrome/common/sandbox_mac_fontloading_unittest.mm b/chrome/common/sandbox_mac_fontloading_unittest.mm
index 834fc0bb4b800d0793e5d05ed9cfc23ab50e56df..d0bf7a0b67d67249547688e3b645526bcdb06ed7 100644
--- a/chrome/common/sandbox_mac_fontloading_unittest.mm
+++ b/chrome/common/sandbox_mac_fontloading_unittest.mm
@@ -126,32 +126,32 @@ bool FontLoadingTestCase::SandboxedTest() {
// Unload the font container when done.
ScopedFontContainer scoped_unloader(font_container);
- CGFontRef font_ref;
- if (!CGFontFromFontContainer(font_container, &font_ref)) {
+ CGFontRef cg_font_ref;
+ if (!CGFontFromFontContainer(font_container, &cg_font_ref)) {
LOG(ERROR) << "CGFontFromFontContainer failed";
return false;
}
- if (!font_ref) {
+ if (!cg_font_ref) {
LOG(ERROR) << "Got NULL CGFontRef";
return false;
}
- base::mac::ScopedCFTypeRef<CGFontRef> cgfont;
- cgfont.reset(font_ref);
+ base::mac::ScopedCFTypeRef<CGFontRef> cgfont(cg_font_ref);
- const NSFont* nsfont = reinterpret_cast<const NSFont*>(
- CTFontCreateWithGraphicsFont(cgfont.get(), 16.0,
- NULL, NULL));
- if (!nsfont) {
+ CTFontRef ct_font_ref =
+ CTFontCreateWithGraphicsFont(cgfont.get(), 16.0, NULL, NULL);
+ base::mac::ScopedCFTypeRef<CTFontRef> ctfont(ct_font_ref);
+
+ if (!ct_font_ref) {
LOG(ERROR) << "CTFontCreateWithGraphicsFont() failed";
return false;
}
// Do something with the font to make sure it's loaded.
- CGFloat cap_height = [nsfont capHeight];
+ CGFloat cap_height = CTFontGetCapHeight(ct_font_ref);
if (cap_height <= 0.0) {
- LOG(ERROR) << "Got bad value for [NSFont capHeight] " << cap_height;
+ LOG(ERROR) << "Got bad value for CTFontGetCapHeight " << cap_height;
return false;
}
« 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