| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // Ownership of the discardablememory is transfered to the pixelref | 81 // Ownership of the discardablememory is transfered to the pixelref |
| 82 SkOneShotDiscardablePixelRef(const SkImageInfo&, SkDiscardableMemory*, size_
t rowBytes); | 82 SkOneShotDiscardablePixelRef(const SkImageInfo&, SkDiscardableMemory*, size_
t rowBytes); |
| 83 ~SkOneShotDiscardablePixelRef(); | 83 ~SkOneShotDiscardablePixelRef(); |
| 84 | 84 |
| 85 protected: | 85 protected: |
| 86 bool onNewLockPixels(LockRec*) override; | 86 bool onNewLockPixels(LockRec*) override; |
| 87 void onUnlockPixels() override; | 87 void onUnlockPixels() override; |
| 88 size_t getAllocatedSizeInBytes() const override; | 88 size_t getAllocatedSizeInBytes() const override; |
| 89 | 89 |
| 90 SkDiscardableMemory* diagnostic_only_getDiscardable() const override { retur
n fDM; } |
| 91 |
| 90 private: | 92 private: |
| 91 SkDiscardableMemory* fDM; | 93 SkDiscardableMemory* fDM; |
| 92 size_t fRB; | 94 size_t fRB; |
| 93 bool fFirstTime; | 95 bool fFirstTime; |
| 94 | 96 |
| 95 typedef SkPixelRef INHERITED; | 97 typedef SkPixelRef INHERITED; |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 SkOneShotDiscardablePixelRef::SkOneShotDiscardablePixelRef(const SkImageInfo& in
fo, | 100 SkOneShotDiscardablePixelRef::SkOneShotDiscardablePixelRef(const SkImageInfo& in
fo, |
| 99 SkDiscardableMemory* dm, | 101 SkDiscardableMemory* dm, |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable); | 681 dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable); |
| 680 } else { | 682 } else { |
| 681 dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed
()); | 683 dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed
()); |
| 682 dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr); | 684 dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr); |
| 683 } | 685 } |
| 684 } | 686 } |
| 685 | 687 |
| 686 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { | 688 void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { |
| 687 VisitAll(sk_trace_dump_visitor, dump); | 689 VisitAll(sk_trace_dump_visitor, dump); |
| 688 } | 690 } |
| OLD | NEW |