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

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

Issue 2558453005: Allow calling FontCache::purge() at any timing (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | 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, 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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 DEFINE_STATIC_LOCAL(CustomCountHistogram, shapeCacheHistogram, 387 DEFINE_STATIC_LOCAL(CustomCountHistogram, shapeCacheHistogram,
388 ("Blink.Fonts.ShapeCache", 1, 1000000, 50)); 388 ("Blink.Fonts.ShapeCache", 1, 1000000, 50));
389 shapeCacheHistogram.count(items); 389 shapeCacheHistogram.count(items);
390 } 390 }
391 391
392 void FontCache::invalidateShapeCache() { 392 void FontCache::invalidateShapeCache() {
393 purgeFallbackListShaperCache(); 393 purgeFallbackListShaperCache();
394 } 394 }
395 395
396 void FontCache::purge(PurgeSeverity PurgeSeverity) { 396 void FontCache::purge(PurgeSeverity PurgeSeverity) {
397 // We should never be forcing the purge while the FontCachePurgePreventer is 397 // Ideally we should never be forcing the purge while the
398 // in scope. 398 // FontCachePurgePreventer is in scope, but we call purge() at any timing
399 ASSERT(!m_purgePreventCount || PurgeSeverity == PurgeIfNeeded); 399 // via MemoryCoordinator.
400 if (m_purgePreventCount) 400 if (m_purgePreventCount)
401 return; 401 return;
402 402
403 if (!gFontDataCache || !gFontDataCache->purge(PurgeSeverity)) 403 if (!gFontDataCache || !gFontDataCache->purge(PurgeSeverity))
404 return; 404 return;
405 405
406 purgePlatformFontDataCache(); 406 purgePlatformFontDataCache();
407 purgeFontVerticalDataCache(); 407 purgeFontVerticalDataCache();
408 purgeFallbackListShaperCache(); 408 purgeFallbackListShaperCache();
409 } 409 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 for (iter = gFallbackListShaperCache->begin(); 485 for (iter = gFallbackListShaperCache->begin();
486 iter != gFallbackListShaperCache->end(); ++iter) { 486 iter != gFallbackListShaperCache->end(); ++iter) {
487 shapeResultCacheSize += iter->value->byteSize(); 487 shapeResultCacheSize += iter->value->byteSize();
488 } 488 }
489 dump->AddScalar("size", "bytes", shapeResultCacheSize); 489 dump->AddScalar("size", "bytes", shapeResultCacheSize);
490 memoryDump->AddSuballocation(dump->guid(), 490 memoryDump->AddSuballocation(dump->guid(),
491 WTF::Partitions::kAllocatedObjectPoolName); 491 WTF::Partitions::kAllocatedObjectPoolName);
492 } 492 }
493 493
494 } // namespace blink 494 } // namespace blink
OLDNEW
« 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