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

Unified Diff: src/core/SkRecord.h

Issue 674263002: SkVarAlloc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Explicit truncation. Created 6 years, 1 month 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 | « gyp/core.gypi ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecord.h
diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h
index 5362d91da9970829d4366affabdc38239037a106..8302db4505e9e6306ad5ffc376070408480c64be 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -8,10 +8,10 @@
#ifndef SkRecord_DEFINED
#define SkRecord_DEFINED
-#include "SkChunkAlloc.h"
#include "SkRecords.h"
#include "SkTLogic.h"
#include "SkTemplates.h"
+#include "SkVarAlloc.h"
// SkRecord (REC-ord) represents a sequence of SkCanvas calls, saved for future use.
// These future uses may include: replay, optimization, serialization, or combinations of those.
@@ -27,11 +27,10 @@
class SkRecord : SkNoncopyable {
enum {
- kChunkBytes = 4096,
kFirstReserveCount = 64 / sizeof(void*),
};
public:
- SkRecord() : fAlloc(kChunkBytes), fCount(0), fReserved(0) {}
+ SkRecord() : fAlloc(1024, 2.0f), fCount(0), fReserved(0) {}
~SkRecord() {
Destroyer destroyer;
@@ -69,7 +68,7 @@ public:
template <typename T>
T* alloc(size_t count = 1) {
// Bump up to the next pointer width if needed, so all allocations start pointer-aligned.
- return (T*)fAlloc.allocThrow(SkAlignPtr(sizeof(T) * count));
+ return (T*)fAlloc.alloc(sizeof(T) * count, SK_MALLOC_THROW);
}
// Add a new command of type T to the end of this SkRecord.
@@ -226,7 +225,7 @@ private:
// fRecords and fTypes need to be data structures that can append fixed length data, and need to
// support efficient random access and forward iteration. (They don't need to be contiguous.)
- SkChunkAlloc fAlloc;
+ SkVarAlloc fAlloc;
SkAutoTMalloc<Record> fRecords;
SkAutoTMalloc<Type8> fTypes;
// fCount and fReserved measure both fRecords and fTypes, which always grow in lock step.
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698