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 "SkChecksum.h" | 8 #include "SkChecksum.h" |
9 #include "SkMessageBus.h" | 9 #include "SkMessageBus.h" |
10 #include "SkMipMap.h" | 10 #include "SkMipMap.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 | 542 |
543 /////////////////////////////////////////////////////////////////////////////// | 543 /////////////////////////////////////////////////////////////////////////////// |
544 | 544 |
545 SK_DECLARE_STATIC_MUTEX(gMutex); | 545 SK_DECLARE_STATIC_MUTEX(gMutex); |
546 static SkResourceCache* gResourceCache = nullptr; | 546 static SkResourceCache* gResourceCache = nullptr; |
547 static void cleanup_gResourceCache() { | 547 static void cleanup_gResourceCache() { |
548 // We'll clean this up in our own tests, but disable for clients. | 548 // We'll clean this up in our own tests, but disable for clients. |
549 // Chrome seems to have funky multi-process things going on in unit tests th at | 549 // Chrome seems to have funky multi-process things going on in unit tests th at |
550 // makes this unsafe to delete when the main process atexit()s. | 550 // makes this unsafe to delete when the main process atexit()s. |
551 // SkLazyPtr does the same sort of thing. | 551 // SkLazyPtr does the same sort of thing. |
552 #if SK_DEVELOPER | 552 #if SK_DEBUG |
dogben
2016/04/28 01:02:31
I think this needs to be #ifdef rather than #if.
| |
553 delete gResourceCache; | 553 delete gResourceCache; |
554 #endif | 554 #endif |
555 } | 555 } |
556 | 556 |
557 /** Must hold gMutex when calling. */ | 557 /** Must hold gMutex when calling. */ |
558 static SkResourceCache* get_cache() { | 558 static SkResourceCache* get_cache() { |
559 // gMutex is always held when this is called, so we don't need to be fancy i n here. | 559 // gMutex is always held when this is called, so we don't need to be fancy i n here. |
560 gMutex.assertHeld(); | 560 gMutex.assertHeld(); |
561 if (nullptr == gResourceCache) { | 561 if (nullptr == gResourceCache) { |
562 #ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE | 562 #ifdef SK_USE_DISCARDABLE_SCALEDIMAGECACHE |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", rec.bytesUsed( )); | 700 dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", rec.bytesUsed( )); |
701 dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr); | 701 dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr); |
702 } | 702 } |
703 } | 703 } |
704 | 704 |
705 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { | 705 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { |
706 // Since resource could be backed by malloc or discardable, the cache always dumps detailed | 706 // Since resource could be backed by malloc or discardable, the cache always dumps detailed |
707 // stats to be accurate. | 707 // stats to be accurate. |
708 VisitAll(sk_trace_dump_visitor, dump); | 708 VisitAll(sk_trace_dump_visitor, dump); |
709 } | 709 } |
OLD | NEW |