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

Side by Side Diff: src/core/SkRecord.cpp

Issue 1061783002: Rearrange SkRecord with small N in mind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 32-bit fix Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/core/SkRecord.h ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
1 #include "SkRecord.h" 8 #include "SkRecord.h"
2 9
3 SkRecord::~SkRecord() { 10 SkRecord::~SkRecord() {
4 Destroyer destroyer; 11 Destroyer destroyer;
5 for (unsigned i = 0; i < this->count(); i++) { 12 for (unsigned i = 0; i < this->count(); i++) {
6 this->mutate<void>(i, destroyer); 13 this->mutate<void>(i, destroyer);
7 } 14 }
8 } 15 }
9 16
10 void SkRecord::grow() { 17 void SkRecord::grow() {
11 SkASSERT(fCount == fReserved); 18 SkASSERT(fCount == fReserved);
12 fReserved = SkTMax<unsigned>(kFirstReserveCount, fReserved*2); 19 SkASSERT(fReserved > 0);
20 fReserved *= 2;
13 fRecords.realloc(fReserved); 21 fRecords.realloc(fReserved);
14 fTypes.realloc(fReserved);
15 } 22 }
16 23
17 size_t SkRecord::bytesUsed() const { 24 size_t SkRecord::bytesUsed() const {
18 return fAlloc.approxBytesAllocated() + 25 return fAlloc.approxBytesAllocated() +
19 fReserved * (sizeof(Record) + sizeof(Type8)) + 26 (fReserved - kInlineRecords) * sizeof(Record) +
20 sizeof(SkRecord); 27 sizeof(SkRecord);
21 } 28 }
OLDNEW
« no previous file with comments | « src/core/SkRecord.h ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698