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

Unified Diff: src/core/SkRecord.h

Issue 569373002: SkRecord: clean up comments and 4 bytes per SkRecord. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: enum Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 203a16c4e872768fbf47f5204f5ebf82e83dc7b7..5362d91da9970829d4366affabdc38239037a106 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -26,9 +26,12 @@
// get this wrong.
class SkRecord : SkNoncopyable {
+ enum {
+ kChunkBytes = 4096,
+ kFirstReserveCount = 64 / sizeof(void*),
+ };
public:
- SkRecord(size_t chunkBytes = 4096, unsigned firstReserveCount = 64 / sizeof(void*))
- : fAlloc(chunkBytes), fCount(0), fReserved(0), kFirstReserveCount(firstReserveCount) {}
+ SkRecord() : fAlloc(kChunkBytes), fCount(0), fReserved(0) {}
~SkRecord() {
Destroyer destroyer;
@@ -74,7 +77,7 @@ public:
template <typename T>
T* append() {
if (fCount == fReserved) {
- fReserved = SkTMax(kFirstReserveCount, fReserved*2);
+ fReserved = SkTMax<unsigned>(kFirstReserveCount, fReserved*2);
fRecords.realloc(fReserved);
fTypes.realloc(fReserved);
}
@@ -221,7 +224,7 @@ private:
// chunks, returning a stable handle to that data for later retrieval.
//
// fRecords and fTypes need to be data structures that can append fixed length data, and need to
- // support efficient forward iteration. (They don't need to be contiguous or indexable.)
+ // support efficient random access and forward iteration. (They don't need to be contiguous.)
SkChunkAlloc fAlloc;
SkAutoTMalloc<Record> fRecords;
@@ -229,7 +232,6 @@ private:
// fCount and fReserved measure both fRecords and fTypes, which always grow in lock step.
unsigned fCount;
unsigned fReserved;
- const unsigned kFirstReserveCount;
};
#endif//SkRecord_DEFINED
« 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