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

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

Issue 1304083006: Fix SkOneShotDiscardablePixelRef to return discardable segment. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 "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
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
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 }
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