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

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

Issue 1461663003: Add SkRecord::defrag(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkRecord.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkRecord_DEFINED 8 #ifndef SkRecord_DEFINED
9 #define SkRecord_DEFINED 9 #define SkRecord_DEFINED
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 SkASSERT(Existing::kType == fRecords[i].type()); 104 SkASSERT(Existing::kType == fRecords[i].type());
105 SkASSERT(proofOfAdoption == fRecords[i].ptr()); 105 SkASSERT(proofOfAdoption == fRecords[i].ptr());
106 106
107 return fRecords[i].set(this->allocCommand<T>()); 107 return fRecords[i].set(this->allocCommand<T>());
108 } 108 }
109 109
110 // Does not return the bytes in any pointers embedded in the Records; caller s 110 // Does not return the bytes in any pointers embedded in the Records; caller s
111 // need to iterate with a visitor to measure those they care for. 111 // need to iterate with a visitor to measure those they care for.
112 size_t bytesUsed() const; 112 size_t bytesUsed() const;
113 113
114 // Rearrange and resize this record to eliminate any NoOps.
115 // May change count() and the indices of ops, but preserves their order.
116 void defrag();
117
114 private: 118 private:
115 // An SkRecord is structured as an array of pointers into a big chunk of mem ory where 119 // An SkRecord is structured as an array of pointers into a big chunk of mem ory where
116 // records representing each canvas draw call are stored: 120 // records representing each canvas draw call are stored:
117 // 121 //
118 // fRecords: [*][*][*]... 122 // fRecords: [*][*][*]...
119 // | | | 123 // | | |
120 // | | | 124 // | | |
121 // | | +---------------------------------------+ 125 // | | +---------------------------------------+
122 // | +-----------------+ | 126 // | +-----------------+ |
123 // | | | 127 // | | |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int fCount, fReserved; 193 int fCount, fReserved;
190 SkAutoSTMalloc<kInlineRecords, Record> fRecords; 194 SkAutoSTMalloc<kInlineRecords, Record> fRecords;
191 195
192 // fAlloc needs to be a data structure which can append variable length data in contiguous 196 // fAlloc needs to be a data structure which can append variable length data in contiguous
193 // chunks, returning a stable handle to that data for later retrieval. 197 // chunks, returning a stable handle to that data for later retrieval.
194 SkVarAlloc fAlloc; 198 SkVarAlloc fAlloc;
195 char fInlineAlloc[1 << kInlineAllocLgBytes]; 199 char fInlineAlloc[1 << kInlineAllocLgBytes];
196 }; 200 };
197 201
198 #endif//SkRecord_DEFINED 202 #endif//SkRecord_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698