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

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

Issue 326913007: Clean up SkScaledImageCache at exit only in SK_DEVELOPER mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « 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 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 fCount, fBytesUsed, locked, 663 fCount, fBytesUsed, locked,
664 fDiscardableFactory ? "discardable" : "malloc"); 664 fDiscardableFactory ? "discardable" : "malloc");
665 } 665 }
666 666
667 /////////////////////////////////////////////////////////////////////////////// 667 ///////////////////////////////////////////////////////////////////////////////
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() {
674 // We'll clean this up in our own tests, but disable for clients.
675 // Chrome seems to have funky multi-process things going on in unit tests th at
676 // makes this unsafe to delete when the main process atexit()s.
677 // SkLazyPtr does the same sort of thing.
678 #if SK_DEVELOPER
679 SkDELETE(gScaledImageCache);
680 #endif
681 }
674 682
675 /** Must hold gMutex when calling. */ 683 /** Must hold gMutex when calling. */
676 static SkScaledImageCache* get_cache() { 684 static SkScaledImageCache* get_cache() {
677 // gMutex is always held when this is called, so we don't need to be fancy i n here. 685 // gMutex is always held when this is called, so we don't need to be fancy i n here.
678 gMutex.assertHeld(); 686 gMutex.assertHeld();
679 if (NULL == gScaledImageCache) { 687 if (NULL == gScaledImageCache) {
680 #ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE 688 #ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE
681 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SkDiscardableMemory: :Create)); 689 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SkDiscardableMemory: :Create));
682 #else 690 #else
683 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SK_DEFAULT_IMAGE_CAC HE_LIMIT)); 691 gScaledImageCache = SkNEW_ARGS(SkScaledImageCache, (SK_DEFAULT_IMAGE_CAC HE_LIMIT));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 return SkScaledImageCache::GetBytesUsed(); 783 return SkScaledImageCache::GetBytesUsed();
776 } 784 }
777 785
778 size_t SkGraphics::GetImageCacheByteLimit() { 786 size_t SkGraphics::GetImageCacheByteLimit() {
779 return SkScaledImageCache::GetByteLimit(); 787 return SkScaledImageCache::GetByteLimit();
780 } 788 }
781 789
782 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) { 790 size_t SkGraphics::SetImageCacheByteLimit(size_t newLimit) {
783 return SkScaledImageCache::SetByteLimit(newLimit); 791 return SkScaledImageCache::SetByteLimit(newLimit);
784 } 792 }
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