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

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: more tidying 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
Index: src/core/SkDescriptor.h
diff --git a/src/core/SkDescriptor.h b/src/core/SkDescriptor.h
index 22ec29316fd30094ed6ad36cff8150acde8808cd..4df5d8fcc287c186ff36fb48a1fb4744929bdf4c 100644
--- a/src/core/SkDescriptor.h
+++ b/src/core/SkDescriptor.h
@@ -134,12 +134,9 @@ private:
class SkAutoDescriptor : SkNoncopyable {
public:
+ SkAutoDescriptor() : fDesc(NULL) {}
SkAutoDescriptor(size_t size) {
- if (size <= sizeof(fStorage)) {
- fDesc = (SkDescriptor*)(void*)fStorage;
- } else {
- fDesc = SkDescriptor::Alloc(size);
- }
+ this->reset(size);
}
~SkAutoDescriptor() {
@@ -148,7 +145,15 @@ public:
}
}
- SkDescriptor* getDesc() const { return fDesc; }
+ void reset(size_t size) {
+ if (size <= sizeof(fStorage)) {
bsalomon 2015/03/31 21:19:10 don't you need to free the old one here?
joshualitt 2015/04/01 13:21:17 Acknowledged.
+ fDesc = (SkDescriptor*)(void*)fStorage;
+ } else {
+ fDesc = SkDescriptor::Alloc(size);
+ }
+ }
+
+ SkDescriptor* getDesc() const { SkASSERT(fDesc); return fDesc; }
private:
enum {
kStorageSize = sizeof(SkDescriptor)
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkPaint.cpp » ('j') | src/core/SkPaint.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698