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

Unified Diff: src/core/SkDescriptor.h

Issue 1041953002: Switch to one single bitmap text blob cache allocation (Closed) Base URL: https://skia.googlesource.com/skia.git@bmptext2
Patch Set: third attempt Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDescriptor.h
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index 22ec29316fd30094ed6ad36cff8150acde8808cd..0693ccfe60d82226b95eb5f73e69fc16b46cd9de 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -134,7 +134,13 @@ private:
class SkAutoDescriptor : SkNoncopyable {
public:
- SkAutoDescriptor(size_t size) {
+ SkAutoDescriptor() : fDesc(NULL) {}
+ SkAutoDescriptor(size_t size) : fDesc(NULL) { this->reset(size); }
+
+ ~SkAutoDescriptor() { this->free(); }
+
+ void reset(size_t size) {
+ this->free();
if (size <= sizeof(fStorage)) {
fDesc = (SkDescriptor*)(void*)fStorage;
} else {
@@ -142,14 +148,14 @@ public:
}
}
- ~SkAutoDescriptor() {
+ SkDescriptor* getDesc() const { SkASSERT(fDesc); return fDesc; }
+private:
+ void free() {
if (fDesc != (SkDescriptor*)(void*)fStorage) {
SkDescriptor::Free(fDesc);
}
}
- SkDescriptor* getDesc() const { return fDesc; }
-private:
enum {
kStorageSize = sizeof(SkDescriptor)
+ sizeof(SkDescriptor::Entry) + sizeof(SkScalerContext::Rec) // for rec
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698