aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkSmallAllocator.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-23 16:16:55 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-23 16:16:55 +0000
commit6e5671d8c9b2d9885e351b631b1dfbb4ed403789 (patch)
treebb57851cce11e3881a9051265a7fbdd6c97cc37b /src/core/SkSmallAllocator.h
parent0ad7936b7bf9f4caefd5ff1bd40dc1b50adb76ab (diff)
Revert of Extract most of the mutable state of SkShader into a separate Context object. (https://codereview.chromium.org/207683004/)
Reason for revert: This is blocking the DEPS roll into Chromium. Failures can be seen here: http://build.chromium.org/p/tryserver.chromium/builders/android_dbg/builds/174333 Original issue's description: > Extract most of the mutable state of SkShader into a separate Context object. > > SkShader currently stores some state during draw calls via setContext(...). > Move that mutable state into a separate SkShader::Context class that is > constructed on demand for the duration of the draw. > > Calls to setContext() are replaced with createContext() which returns a context > corresponding to the shader object or NULL if the parameters to createContext > are invalid. > > TEST=out/Debug/dm > BUG=skia:1976 > > Committed: http://code.google.com/p/skia/source/detail?r=14216 > > Committed: http://code.google.com/p/skia/source/detail?r=14323 R=scroggo@google.com, skyostil@chromium.org, tomhudson@chromium.org, senorblanco@chromium.org, reed@google.com, bungeman@google.com, dominikg@chromium.org TBR=bungeman@google.com, dominikg@chromium.org, reed@google.com, scroggo@google.com, senorblanco@chromium.org, skyostil@chromium.org, tomhudson@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia:1976 Author: bsalomon@google.com Review URL: https://codereview.chromium.org/249643002 git-svn-id: http://skia.googlecode.com/svn/trunk@14326 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkSmallAllocator.h')
-rw-r--r--src/core/SkSmallAllocator.h23
1 files changed, 3 insertions, 20 deletions
diff --git a/src/core/SkSmallAllocator.h b/src/core/SkSmallAllocator.h
index 8d4b53a707..655008b706 100644
--- a/src/core/SkSmallAllocator.h
+++ b/src/core/SkSmallAllocator.h
@@ -117,12 +117,10 @@ public:
// but we're not sure we can catch all callers, so handle it but
// assert false in debug mode.
SkASSERT(false);
- rec->fStorageSize = 0;
rec->fHeapStorage = sk_malloc_throw(storageRequired);
rec->fObj = static_cast<void*>(rec->fHeapStorage);
} else {
// There is space in fStorage.
- rec->fStorageSize = storageRequired;
rec->fHeapStorage = NULL;
SkASSERT(SkIsAlign4(fStorageUsed));
rec->fObj = static_cast<void*>(fStorage + (fStorageUsed / 4));
@@ -133,26 +131,11 @@ public:
return rec->fObj;
}
- /*
- * Free the memory reserved last without calling the destructor.
- * Can be used in a nested way, i.e. after reserving A and B, calling
- * freeLast once will free B and calling it again will free A.
- */
- void freeLast() {
- SkASSERT(fNumObjects > 0);
- Rec* rec = &fRecs[fNumObjects - 1];
- sk_free(rec->fHeapStorage);
- fStorageUsed -= rec->fStorageSize;
-
- fNumObjects--;
- }
-
private:
struct Rec {
- size_t fStorageSize; // 0 if allocated on heap
- void* fObj;
- void* fHeapStorage;
- void (*fKillProc)(void*);
+ void* fObj;
+ void* fHeapStorage;
+ void (*fKillProc)(void*);
};
// Number of bytes used so far.