aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRecord.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-04-18 11:42:49 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-18 16:19:47 +0000
commit4304d11ada22ebfb6b64d87247ad24cde89c3a74 (patch)
treebbdd9576071af23d021900d344131366fecc19f8 /src/core/SkRecord.cpp
parentbc8ee52d4649afdc972599e5ef2a2a543867985d (diff)
Change SkRecord to use SkArenaAlloc
This CL uses the strategy of allocating raw bytes with the proper alignment so that SkRecord can manage the object lifetimes. Change-Id: I73604d41a3c6a12d1e2f7f8419f75b95c0190f68 Reviewed-on: https://skia-review.googlesource.com/13621 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core/SkRecord.cpp')
-rw-r--r--src/core/SkRecord.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/core/SkRecord.cpp b/src/core/SkRecord.cpp
index 3d098c6c89..4df4131340 100644
--- a/src/core/SkRecord.cpp
+++ b/src/core/SkRecord.cpp
@@ -8,9 +8,6 @@
#include "SkRecord.h"
#include <algorithm>
-SkRecord::SkRecord()
- : fCount(0), fReserved(0), fAlloc(8/*first malloc at 256 bytes*/) {}
-
SkRecord::~SkRecord() {
Destroyer destroyer;
for (int i = 0; i < this->count(); i++) {
@@ -25,9 +22,8 @@ void SkRecord::grow() {
}
size_t SkRecord::bytesUsed() const {
- return sizeof(SkRecord)
- + fReserved * sizeof(Record)
- + fAlloc.approxBytesAllocated();
+ size_t bytes = fApproxBytesAllocated + sizeof(SkRecord);
+ return bytes;
}
void SkRecord::defrag() {