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

Side by Side Diff: Source/core/platform/graphics/mac/FontCacheMac.mm

Issue 14574002: Replace some trivial WebKitSystemInterface wrappers with direct calls to SPI. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Radar links Created 7 years, 7 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 | Source/core/platform/graphics/mac/GlyphPageTreeNodeMac.cpp » ('j') | 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) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 21 matching lines...) Expand all
32 32
33 #import <AppKit/AppKit.h> 33 #import <AppKit/AppKit.h>
34 #import "core/platform/graphics/Font.h" 34 #import "core/platform/graphics/Font.h"
35 #import "core/platform/graphics/FontPlatformData.h" 35 #import "core/platform/graphics/FontPlatformData.h"
36 #import "core/platform/graphics/SimpleFontData.h" 36 #import "core/platform/graphics/SimpleFontData.h"
37 #import "core/platform/mac/WebCoreSystemInterface.h" 37 #import "core/platform/mac/WebCoreSystemInterface.h"
38 #import "core/platform/mac/WebFontCache.h" 38 #import "core/platform/mac/WebFontCache.h"
39 #import <wtf/MainThread.h> 39 #import <wtf/MainThread.h>
40 #import <wtf/StdLibExtras.h> 40 #import <wtf/StdLibExtras.h>
41 41
42 // Forward declare Mac SPIs.
43 // Request for public API: rdar://13787490
44 extern "C" {
45 void CGFontSetShouldUseMulticache(bool enable);
46 }
42 47
43 namespace WebCore { 48 namespace WebCore {
44 49
45 // The "void*" parameter makes the function match the prototype for callbacks fr om callOnMainThread. 50 // The "void*" parameter makes the function match the prototype for callbacks fr om callOnMainThread.
46 static void invalidateFontCache(void*) 51 static void invalidateFontCache(void*)
47 { 52 {
48 if (!isMainThread()) { 53 if (!isMainThread()) {
49 callOnMainThread(&invalidateFontCache, 0); 54 callOnMainThread(&invalidateFontCache, 0);
50 return; 55 return;
51 } 56 }
52 fontCache()->invalidate(); 57 fontCache()->invalidate();
53 } 58 }
54 59
55 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCe nterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef) 60 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCe nterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef)
56 { 61 {
57 ASSERT_UNUSED(observer, observer == fontCache()); 62 ASSERT_UNUSED(observer, observer == fontCache());
58 ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotifi cation)); 63 ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotifi cation));
59 invalidateFontCache(0); 64 invalidateFontCache(0);
60 } 65 }
61 66
62 void FontCache::platformInit() 67 void FontCache::platformInit()
63 { 68 {
64 WKSetUpFontCache(); 69 // Note: This may break on future OS releases, per https://bugs.webkit.org/s how_bug.cgi?id=102405#c8.
70 CGFontSetShouldUseMulticache(true);
65 CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFon tsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately); 71 CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFon tsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately);
66 } 72 }
67 73
68 static int toAppKitFontWeight(FontWeight fontWeight) 74 static int toAppKitFontWeight(FontWeight fontWeight)
69 { 75 {
70 static int appKitFontWeights[] = { 76 static int appKitFontWeights[] = {
71 2, // FontWeight100 77 2, // FontWeight100
72 3, // FontWeight200 78 3, // FontWeight200
73 4, // FontWeight300 79 4, // FontWeight300
74 5, // FontWeight400 80 5, // FontWeight400
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 229
224 // FontPlatformData::font() can be null for the case of Chromium out-of-proc ess font loading. 230 // FontPlatformData::font() can be null for the case of Chromium out-of-proc ess font loading.
225 // In that case, we don't want to use the platformData. 231 // In that case, we don't want to use the platformData.
226 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo rmFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant())); 232 OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platfo rmFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant()));
227 if (!platformData->font()) 233 if (!platformData->font())
228 return 0; 234 return 0;
229 return platformData.leakPtr(); 235 return platformData.leakPtr();
230 } 236 }
231 237
232 } // namespace WebCore 238 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/platform/graphics/mac/GlyphPageTreeNodeMac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698