Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 30 matching lines...) Expand all Loading... | |
| 41 #include "platform/fonts/FontDescription.h" | 41 #include "platform/fonts/FontDescription.h" |
| 42 #include "platform/fonts/FontPlatformData.h" | 42 #include "platform/fonts/FontPlatformData.h" |
| 43 #include "platform/fonts/FontSmoothingMode.h" | 43 #include "platform/fonts/FontSmoothingMode.h" |
| 44 #include "platform/fonts/SimpleFontData.h" | 44 #include "platform/fonts/SimpleFontData.h" |
| 45 #include "platform/fonts/TextRenderingMode.h" | 45 #include "platform/fonts/TextRenderingMode.h" |
| 46 #include "platform/fonts/opentype/OpenTypeVerticalData.h" | 46 #include "platform/fonts/opentype/OpenTypeVerticalData.h" |
| 47 #include "platform/fonts/shaping/ShapeCache.h" | 47 #include "platform/fonts/shaping/ShapeCache.h" |
| 48 #include "platform/tracing/web_memory_allocator_dump.h" | 48 #include "platform/tracing/web_memory_allocator_dump.h" |
| 49 #include "platform/tracing/web_process_memory_dump.h" | 49 #include "platform/tracing/web_process_memory_dump.h" |
| 50 #include "public/platform/Platform.h" | 50 #include "public/platform/Platform.h" |
| 51 #include "ui/gfx/font.h" | |
| 51 #include "wtf/HashMap.h" | 52 #include "wtf/HashMap.h" |
| 52 #include "wtf/ListHashSet.h" | 53 #include "wtf/ListHashSet.h" |
| 53 #include "wtf/PtrUtil.h" | 54 #include "wtf/PtrUtil.h" |
| 54 #include "wtf/StdLibExtras.h" | 55 #include "wtf/StdLibExtras.h" |
| 55 #include "wtf/Vector.h" | 56 #include "wtf/Vector.h" |
| 56 #include "wtf/text/AtomicStringHash.h" | 57 #include "wtf/text/AtomicStringHash.h" |
| 57 #include "wtf/text/StringHash.h" | 58 #include "wtf/text/StringHash.h" |
| 58 #include <memory> | 59 #include <memory> |
| 59 | 60 |
| 60 using namespace WTF; | 61 using namespace WTF; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 | 297 |
| 297 bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription, | 298 bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription, |
| 298 const AtomicString& family) { | 299 const AtomicString& family) { |
| 299 bool checkingAlternateName = true; | 300 bool checkingAlternateName = true; |
| 300 return getFontPlatformData( | 301 return getFontPlatformData( |
| 301 fontDescription, | 302 fontDescription, |
| 302 FontFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)), | 303 FontFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)), |
| 303 checkingAlternateName); | 304 checkingAlternateName); |
| 304 } | 305 } |
| 305 | 306 |
| 307 String FontCache::firstAvailableOrFirst(const String& families) { | |
| 308 return String::fromUTF8( | |
|
eae
2016/10/26 16:59:36
I don't suppose we could change gfx::Font::FirstAv
kojii
2016/10/28 05:07:14
I think it's possible, but after looking into it,
| |
| 309 gfx::Font::FirstAvailableOrFirst(families.utf8().data()).c_str()); | |
| 310 } | |
| 311 | |
| 306 SimpleFontData* FontCache::getNonRetainedLastResortFallbackFont( | 312 SimpleFontData* FontCache::getNonRetainedLastResortFallbackFont( |
| 307 const FontDescription& fontDescription) { | 313 const FontDescription& fontDescription) { |
| 308 return getLastResortFallbackFont(fontDescription, DoNotRetain).leakRef(); | 314 return getLastResortFallbackFont(fontDescription, DoNotRetain).leakRef(); |
| 309 } | 315 } |
| 310 | 316 |
| 311 void FontCache::releaseFontData(const SimpleFontData* fontData) { | 317 void FontCache::releaseFontData(const SimpleFontData* fontData) { |
| 312 ASSERT(gFontDataCache); | 318 ASSERT(gFontDataCache); |
| 313 | 319 |
| 314 gFontDataCache->release(fontData); | 320 gFontDataCache->release(fontData); |
| 315 } | 321 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 for (iter = gFallbackListShaperCache->begin(); | 480 for (iter = gFallbackListShaperCache->begin(); |
| 475 iter != gFallbackListShaperCache->end(); ++iter) { | 481 iter != gFallbackListShaperCache->end(); ++iter) { |
| 476 shapeResultCacheSize += iter->value->byteSize(); | 482 shapeResultCacheSize += iter->value->byteSize(); |
| 477 } | 483 } |
| 478 dump->AddScalar("size", "bytes", shapeResultCacheSize); | 484 dump->AddScalar("size", "bytes", shapeResultCacheSize); |
| 479 memoryDump->AddSuballocation(dump->guid(), | 485 memoryDump->AddSuballocation(dump->guid(), |
| 480 WTF::Partitions::kAllocatedObjectPoolName); | 486 WTF::Partitions::kAllocatedObjectPoolName); |
| 481 } | 487 } |
| 482 | 488 |
| 483 } // namespace blink | 489 } // namespace blink |
| OLD | NEW |