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

Side by Side Diff: src/core/SkScaledImageCache.cpp

Issue 313823004: Add assertHeld() to SkMutex. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 6 years, 6 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
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/pdf/SkPDFGraphicState.cpp » ('j') | 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 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
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
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 }
OLDNEW
« no previous file with comments | « src/core/SkPixelRef.cpp ('k') | src/pdf/SkPDFGraphicState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698