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

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

Issue 1068383003: Revert of Rearrange SkRecord with small N in mind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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.cpp ('k') | src/core/SkVarAlloc.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 /*
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
8 #ifndef SkVarAlloc_DEFINED 1 #ifndef SkVarAlloc_DEFINED
9 #define SkVarAlloc_DEFINED 2 #define SkVarAlloc_DEFINED
10 3
11 #include "SkTypes.h" 4 #include "SkTypes.h"
12 5
13 class SkVarAlloc : SkNoncopyable { 6 class SkVarAlloc : SkNoncopyable {
14 public: 7 public:
15 // Smallest block we'll allocate is 2**N bytes. 8 // Smallest block we'll allocate is 2**N bytes.
16 explicit SkVarAlloc(size_t minLgSize); 9 explicit SkVarAlloc(size_t minLgSize);
17 // Same as above, but first uses up to len bytes from storage.
18 SkVarAlloc(size_t minLgSize, char* storage, size_t len);
19
20 ~SkVarAlloc(); 10 ~SkVarAlloc();
21 11
22 // Returns contiguous bytes aligned at least for pointers. You may pass SK_ MALLOC_THROW, etc. 12 // Returns contiguous bytes aligned at least for pointers. You may pass SK_ MALLOC_THROW, etc.
23 char* alloc(size_t bytes, unsigned sk_malloc_flags) { 13 char* alloc(size_t bytes, unsigned sk_malloc_flags) {
24 bytes = SkAlignPtr(bytes); 14 bytes = SkAlignPtr(bytes);
25 15
26 if (bytes > fRemaining) { 16 if (bytes > fRemaining) {
27 this->makeSpace(bytes, sk_malloc_flags); 17 this->makeSpace(bytes, sk_malloc_flags);
28 } 18 }
29 SkASSERT(bytes <= fRemaining); 19 SkASSERT(bytes <= fRemaining);
(...skipping 14 matching lines...) Expand all
44 char* fByte; 34 char* fByte;
45 unsigned fRemaining; 35 unsigned fRemaining;
46 unsigned fLgSize; 36 unsigned fLgSize;
47 37
48 struct Block; 38 struct Block;
49 Block* fBlock; 39 Block* fBlock;
50 }; 40 };
51 SK_COMPILE_ASSERT(sizeof(SkVarAlloc) <= 24, SkVarAllocSize); 41 SK_COMPILE_ASSERT(sizeof(SkVarAlloc) <= 24, SkVarAllocSize);
52 42
53 #endif//SkVarAlloc_DEFINED 43 #endif//SkVarAlloc_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkRecord.cpp ('k') | src/core/SkVarAlloc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698