| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkGlyphCache.h" | 8 #include "SkGlyphCache.h" |
| 9 #include "SkGlyphCache_Globals.h" | 9 #include "SkGlyphCache_Globals.h" |
| 10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 rec->fProc(rec->fData); | 463 rec->fProc(rec->fData); |
| 464 AuxProcRec* next = rec->fNext; | 464 AuxProcRec* next = rec->fNext; |
| 465 delete rec; | 465 delete rec; |
| 466 rec = next; | 466 rec = next; |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 /////////////////////////////////////////////////////////////////////////////// | 470 /////////////////////////////////////////////////////////////////////////////// |
| 471 /////////////////////////////////////////////////////////////////////////////// | 471 /////////////////////////////////////////////////////////////////////////////// |
| 472 | 472 |
| 473 size_t SkGlyphCache_Globals::getTotalMemoryUsed() const { |
| 474 SkAutoExclusive ac(fLock); |
| 475 return fTotalMemoryUsed; |
| 476 } |
| 477 |
| 478 int SkGlyphCache_Globals::getCacheCountUsed() const { |
| 479 SkAutoExclusive ac(fLock); |
| 480 return fCacheCount; |
| 481 } |
| 482 |
| 483 int SkGlyphCache_Globals::getCacheCountLimit() const { |
| 484 SkAutoExclusive ac(fLock); |
| 485 return fCacheCountLimit; |
| 486 } |
| 487 |
| 473 size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) { | 488 size_t SkGlyphCache_Globals::setCacheSizeLimit(size_t newLimit) { |
| 474 static const size_t minLimit = 256 * 1024; | 489 static const size_t minLimit = 256 * 1024; |
| 475 if (newLimit < minLimit) { | 490 if (newLimit < minLimit) { |
| 476 newLimit = minLimit; | 491 newLimit = minLimit; |
| 477 } | 492 } |
| 478 | 493 |
| 479 SkAutoExclusive ac(fLock); | 494 SkAutoExclusive ac(fLock); |
| 480 | 495 |
| 481 size_t prevLimit = fCacheSizeLimit; | 496 size_t prevLimit = fCacheSizeLimit; |
| 482 fCacheSizeLimit = newLimit; | 497 fCacheSizeLimit = newLimit; |
| 483 this->internalPurge(); | 498 this->internalPurge(); |
| 484 return prevLimit; | 499 return prevLimit; |
| 485 } | 500 } |
| 486 | 501 |
| 502 size_t SkGlyphCache_Globals::getCacheSizeLimit() const { |
| 503 SkAutoExclusive ac(fLock); |
| 504 return fCacheSizeLimit; |
| 505 } |
| 506 |
| 487 int SkGlyphCache_Globals::setCacheCountLimit(int newCount) { | 507 int SkGlyphCache_Globals::setCacheCountLimit(int newCount) { |
| 488 if (newCount < 0) { | 508 if (newCount < 0) { |
| 489 newCount = 0; | 509 newCount = 0; |
| 490 } | 510 } |
| 491 | 511 |
| 492 SkAutoExclusive ac(fLock); | 512 SkAutoExclusive ac(fLock); |
| 493 | 513 |
| 494 int prevCount = fCacheCountLimit; | 514 int prevCount = fCacheCountLimit; |
| 495 fCacheCountLimit = newCount; | 515 fCacheCountLimit = newCount; |
| 496 this->internalPurge(); | 516 this->internalPurge(); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 } | 845 } |
| 826 | 846 |
| 827 void SkGraphics::PurgeFontCache() { | 847 void SkGraphics::PurgeFontCache() { |
| 828 get_globals().purgeAll(); | 848 get_globals().purgeAll(); |
| 829 SkTypefaceCache::PurgeAll(); | 849 SkTypefaceCache::PurgeAll(); |
| 830 } | 850 } |
| 831 | 851 |
| 832 // TODO(herb): clean up TLS apis. | 852 // TODO(herb): clean up TLS apis. |
| 833 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } | 853 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } |
| 834 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } | 854 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } |
| OLD | NEW |