OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkScaledImageCache.h" | 8 #include "SkScaledImageCache.h" |
9 #include "SkMipMap.h" | 9 #include "SkMipMap.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 668 |
669 #include "SkThread.h" | 669 #include "SkThread.h" |
670 | 670 |
671 SK_DECLARE_STATIC_MUTEX(gMutex); | 671 SK_DECLARE_STATIC_MUTEX(gMutex); |
672 static SkScaledImageCache* gScaledImageCache = NULL; | 672 static SkScaledImageCache* gScaledImageCache = NULL; |
673 static void cleanup_gScaledImageCache() { SkDELETE(gScaledImageCache); } | 673 static void cleanup_gScaledImageCache() { SkDELETE(gScaledImageCache); } |
674 | 674 |
675 /** Must hold gMutex when calling. */ | 675 /** Must hold gMutex when calling. */ |
676 static SkScaledImageCache* get_cache() { | 676 static SkScaledImageCache* get_cache() { |
677 // gMutex is always held when this is called, so we don't need to be fancy i
n here. | 677 // gMutex is always held when this is called, so we don't need to be fancy i
n here. |
| 678 gMutex.assertHeld(); |
678 if (NULL == gScaledImageCache) { | 679 if (NULL == gScaledImageCache) { |
679 #ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE | 680 #ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE |
680 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SkDiscardableMemory:
:Create)); | 681 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SkDiscardableMemory:
:Create)); |
681 #else | 682 #else |
682 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SK_DEFAULT_IMAGE_CAC
HE_LIMIT)); | 683 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SK_DEFAULT_IMAGE_CAC
HE_LIMIT)); |
683 #endif | 684 #endif |
684 atexit(cleanup_gScaledImageCache); | 685 atexit(cleanup_gScaledImageCache); |
685 } | 686 } |
686 return gScaledImageCache; | 687 return gScaledImageCache; |
687 } | 688 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 return SkScaledImageCache::GetBytesUsed(); | 775 return SkScaledImageCache::GetBytesUsed(); |
775 } | 776 } |
776 | 777 |
777 size_t SkGraphics::GetImageCacheByteLimit() { | 778 size_t SkGraphics::GetImageCacheByteLimit() { |
778 return SkScaledImageCache::GetByteLimit(); | 779 return SkScaledImageCache::GetByteLimit(); |
779 } | 780 } |
780 | 781 |
781 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { | 782 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { |
782 return SkScaledImageCache::SetByteLimit(newLimit); | 783 return SkScaledImageCache::SetByteLimit(newLimit); |
783 } | 784 } |
OLD | NEW |