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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/FontCache.cpp

Issue 1685053002: blink fonts: Load Android SkFontMgr on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@windows_change
Patch Set: Rebase. Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "wtf/ListHashSet.h" 52 #include "wtf/ListHashSet.h"
53 #include "wtf/StdLibExtras.h" 53 #include "wtf/StdLibExtras.h"
54 #include "wtf/Vector.h" 54 #include "wtf/Vector.h"
55 #include "wtf/text/AtomicStringHash.h" 55 #include "wtf/text/AtomicStringHash.h"
56 #include "wtf/text/StringHash.h" 56 #include "wtf/text/StringHash.h"
57 57
58 using namespace WTF; 58 using namespace WTF;
59 59
60 namespace blink { 60 namespace blink {
61 61
62 #if !OS(WIN) 62 #if !OS(WIN) && !OS(LINUX)
63 FontCache::FontCache() 63 FontCache::FontCache()
64 : m_purgePreventCount(0) 64 : m_purgePreventCount(0)
65 { 65 {
66 } 66 }
67 #endif // !OS(WIN) 67 #endif // !OS(WIN) && !OS(LINUX
68 68
69 typedef HashMap<FontCacheKey, OwnPtr<FontPlatformData>, FontCacheKeyHash, FontCa cheKeyTraits> FontPlatformDataCache; 69 typedef HashMap<FontCacheKey, OwnPtr<FontPlatformData>, FontCacheKeyHash, FontCa cheKeyTraits> FontPlatformDataCache;
70 typedef HashMap<FallbackListCompositeKey, OwnPtr<ShapeCache>, FallbackListCompos iteKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache; 70 typedef HashMap<FallbackListCompositeKey, OwnPtr<ShapeCache>, FallbackListCompos iteKeyHash, FallbackListCompositeKeyTraits> FallbackListShaperCache;
71 71
72 static FontPlatformDataCache* gFontPlatformDataCache = nullptr; 72 static FontPlatformDataCache* gFontPlatformDataCache = nullptr;
73 static FallbackListShaperCache* gFallbackListShaperCache = nullptr; 73 static FallbackListShaperCache* gFallbackListShaperCache = nullptr;
74 74
75 SkFontMgr* FontCache::s_fontManager = nullptr;
76
75 #if OS(WIN) 77 #if OS(WIN)
76 bool FontCache::s_useDirectWrite = false; 78 bool FontCache::s_useDirectWrite = false;
77 SkFontMgr* FontCache::s_fontManager = nullptr;
78 bool FontCache::s_useSubpixelPositioning = false; 79 bool FontCache::s_useSubpixelPositioning = false;
79 float FontCache::s_deviceScaleFactor = 1.0; 80 float FontCache::s_deviceScaleFactor = 1.0;
80 #endif // OS(WIN) 81 #endif // OS(WIN)
81 82
82 FontCache* FontCache::fontCache() 83 FontCache* FontCache::fontCache()
83 { 84 {
84 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ()); 85 DEFINE_STATIC_LOCAL(FontCache, globalFontCache, ());
85 return &globalFontCache; 86 return &globalFontCache;
86 } 87 }
87 88
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 142 }
142 143
143 typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, IntHash<Fo ntCache::FontFileKey>, UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey>> Fo ntVerticalDataCache; 144 typedef HashMap<FontCache::FontFileKey, RefPtr<OpenTypeVerticalData>, IntHash<Fo ntCache::FontFileKey>, UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey>> Fo ntVerticalDataCache;
144 145
145 FontVerticalDataCache& fontVerticalDataCacheInstance() 146 FontVerticalDataCache& fontVerticalDataCacheInstance()
146 { 147 {
147 DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ()); 148 DEFINE_STATIC_LOCAL(FontVerticalDataCache, fontVerticalDataCache, ());
148 return fontVerticalDataCache; 149 return fontVerticalDataCache;
149 } 150 }
150 151
151 #if OS(WIN)
152 void FontCache::setFontManager(const RefPtr<SkFontMgr>& fontManager) 152 void FontCache::setFontManager(const RefPtr<SkFontMgr>& fontManager)
153 { 153 {
154 ASSERT(!s_fontManager); 154 ASSERT(!s_fontManager);
155 s_fontManager = fontManager.get(); 155 s_fontManager = fontManager.get();
156 // Explicitly AddRef since we're going to hold on to the object for the life of the program. 156 // Explicitly AddRef since we're going to hold on to the object for the life of the program.
157 s_fontManager->ref(); 157 s_fontManager->ref();
158 } 158 }
159 #endif
160 159
161 PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData(const FontFileKey& k ey, const FontPlatformData& platformData) 160 PassRefPtr<OpenTypeVerticalData> FontCache::getVerticalData(const FontFileKey& k ey, const FontPlatformData& platformData)
162 { 161 {
163 FontVerticalDataCache& fontVerticalDataCache = fontVerticalDataCacheInstance (); 162 FontVerticalDataCache& fontVerticalDataCache = fontVerticalDataCacheInstance ();
164 FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key); 163 FontVerticalDataCache::iterator result = fontVerticalDataCache.find(key);
165 if (result != fontVerticalDataCache.end()) 164 if (result != fontVerticalDataCache.end())
166 return result.get()->value; 165 return result.get()->value;
167 166
168 RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(pla tformData); 167 RefPtr<OpenTypeVerticalData> verticalData = OpenTypeVerticalData::create(pla tformData);
169 if (!verticalData->isOpenType()) 168 if (!verticalData->isOpenType())
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 iter != gFallbackListShaperCache->end(); 409 iter != gFallbackListShaperCache->end();
411 ++iter) { 410 ++iter) {
412 shapeResultCacheSize += iter->value->byteSize(); 411 shapeResultCacheSize += iter->value->byteSize();
413 } 412 }
414 dump->addScalar("size", "bytes", shapeResultCacheSize); 413 dump->addScalar("size", "bytes", shapeResultCacheSize);
415 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate dObjectPoolName)); 414 memoryDump->addSuballocation(dump->guid(), String(WTF::Partitions::kAllocate dObjectPoolName));
416 } 415 }
417 416
418 417
419 } // namespace blink 418 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698